Playing SAP ITS sounds on Windows Mobile and CE Devices with Enterprise Browser

Sabir Valappil Thattath -
2 MIN READ

I had seen many support questions on playing SAP ITS mobile application transaction sounds on Enterprise Browser. Earlier, I had written blog on playing SAP ITS mobile sound on Android version of Enterprise Browser which can be found here.

From Enterprise Browser 2.0 onward, separate apk file is available only for SAP ITS customers; which has an inbuilt support for playing sap transaction sounds.

Unlike Android users, Enterprise Browser does not provide any SAP specific package for windows customers. For windows, it involves additional configuration to enable SAP ITS transaction sounds on Enterprise Browser.

This blog talks about enabling SAP ITS sounds on Enterprise Browser with Webkit engine on Windows Mobile and CE devices.

Why SAP Sounds are not played by default on Webkit Engine?

SAP ITS plays various sound to notify its users whether the server transaction was a failure or success. SAP ITS achieves this by presenting a HTML tag to the browser. tag is not supported by any of the standard browsers available in the market except on IE. It needs some additional configuration on windows devices to play this sound with Enterprise Browser.

Enterprise Browser JavaScript Library

Enterprise Browser provides utility javascripts for playing a sound file that resides locally on the device. Similarly, it also provides a javascript API to transfer a file from remote location to device. We are going to use these APIs via dominjection to enable SAP ITS mobile sound support on Enterprise Browser with Webkit engine.

Enterprise Browser provides, fileTransfer scriptable object and generic scriptable object by default on the DOM window. Users should ensure that below Config.xml attribute is enabled for getting Enterprise Browser specific scriptable objects on the DOM Window.

                                   

Enterprise Browser DOMInjection Technique

Enterprise Browser allows users to inject a custom script file resides on the device to the SAP pages loaded on the Webkit engine. User just needs to develop his script and configure the same on the Enterprise Browser.

Script for playing the tag

Whenever a SAP page is loaded after any server transaction, we do a search for tag using dominjected script. If any tag occurrence is found, we transfer the file to the device from the remote location. This will be followed by playing the transferred file.

Below script does the search for the tag

var bgs = document.getElementsByTagName('bgsound');

below script transfer the sound file from SAP server to device using Enterprise Browser Javascript API

   for (var i=0; i

   {      

     

               var attribute = bgs[i].getAttribute("src");

               var newURL = window.location.protocol + "//" + window.location.host +  attribute; 

               newURL = "url('"+newURL+"')";  

               fileTransfer.source = newURL;

               fileTransfer.destination = "url('file://\\Program Files\\EnterpriseBrowser\\HTML\\sapsound.wav')";

               fileTransfer.transferEvent = "url('JavaScript:handleResult(%json);')";

               fileTransfer.overWrite = true;

               fileTransfer.transfer();

   }

Below script plays the transferred sound file when a transfer callback is fired from Enterprise Browser

function handleResult(params)

{

               generic.PlayWave('\\Program Files\\EnterpriseBrowser\\HTML\\sapsound.wav', 0);

}

Below is the complete script that can be copied and saved into a file named customsound.js

(function ()

{

     var bgs = document.getElementsByTagName('bgsound');

      for (var i=0; i

      {      

     

               var attribute = bgs[i].getAttribute("src");

               var newURL = window.location.protocol + "//" + window.location.host +  attribute;

               newURL = "url('"+newURL+"')";

               fileTransfer.source = newURL;

               fileTransfer.destination = "url('file://\\Program Files\\EnterpriseBrowser\\HTML\\sapsound.wav')";

               fileTransfer.transferEvent = "url('JavaScript:handleResult(%json);')";

               fileTransfer.overWrite = true;

               fileTransfer.transfer();

   }

})();

function handleResult(params)

{

    //alert('Download Result:' + params['transferResult']);

     generic.PlayWave('\\Program Files\\EnterpriseBrowser\\HTML\\sapsound.wav', 0);

}

Configuring Enterprise Browser to DomInject

To inject any user created javascript file without modifying server application, user needs to include the javascript file names inside ‘tags’ file. To know more about dominjectiong ‘tags’ file grammar, please click here.

Below is the entry present inside ‘tags’ file in our case

profile

Sabir Valappil Thattath

Please register or login to post a reply

Replies