Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
jamie_cawley
Advisor
Advisor

Browser based Debugging:

Google Chrome

  • Create a shortcut on your desktop for Google Chrome.
  • Add the following parameters to the shortcut command
  • -allow-file-access-from-files
  • -disable-web-security

Mozilla Firefox

  • From Firefox, download and install the Firebug plugin

Apple Safari

  • Select "Show develop menu in the menu bar" from Settings -> Preferences -> Advanced

To display the Hybrid Web Container in the browser:

  • Determine the URL for the generated application (e.g. workflow_jQueryMobileLookAndFeel.html)
    • In the SUP Workspace Expand the Generated Workflow/<workflow>/html folder
    • Right-click on the workflow***.html file
    • Choose Properties Copy the Location to the clipboard
  • Determine the Key of the desired screen (e.g. Start) by selecting your workflow, the desired screen and referring to the Key within the General properties
  • Add the ?screentoshow=<screen key> URL parameter to the end of the file URL
  • Within the browser open the combined url

file:///C:/Users/<myusername>/workspace/<supprojectname>/Generated%20Workflow/ myWF/html/workflow.ht... (If an error occurs make sure the "?" did not get encoded with "%3F")

Debugging with Weinre

Installation according to http://people.apache.org/~pmuellr/weinre/docs/latest/Installing.html

  • Install nodejs - http://nodejs.org/
  • Open a command prompt and type: "npm install weinre" to install npm package.  Network restrictions may cause the download to fail.
  • Create a batch file with the following making sure to change the paths if necessary.

@echo OFF

echo navigate to http://localhost:port/client/

echo add the following to the customBeforeWorkflowLoad() function within Custom.js

echo ____

echo var headID = document.getElementByTagName("head")[0];

echo var newScript = document.createElement('script');

echo newScript.type = 'text/javascript';

echo newScript.src = 'http://127.0.0.1:8080/target/target-script-min.js#anonymous';

echo headID.appendChild(newScript);

echo return true;

echo ____

node "C:\Program Files\nodejs\node_modules\weinre\weinre" --httpPort 8080 --boundHost -all-

  • Run the batch file.
  • Within SUP project navigate to Generated Workflow/Project Name/html/js/Custom.js and add the following to the customBeforeWorkflowLoad method

     function customBeforeWorkflowLoad() {

             //  Please note some scenarios that should not be handled here:

             //    1)  There is no screen available before workflow load finishes

             //    2)  You cannot called any SharedStorage functions here because the url parameters

             //        have not yet been parsed and workflow setting are not yet initialized.

             var headID = document.getElementsByTagName("head")[0];

             var newScript = document.createElement('script');

         newScript.type = 'text/javascript';

         newScript.src = 'http://<SUP Server>:8080/target/target-script-min.js#anonymous';

         headID.appendChild(newScript);

             return true;

     }

               

After deploying your project open http://localhost:8080/ and refer to the Weinre documentation

1 Comment