Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Sai Siddhartha

Pages: 1 2 [3] 4
31
WS aka Web Scripts (Attended RPA for SAP) / System Variable - _ashost
« on: August 31, 2017, 10:16:28 AM »
This is an example of using system variable "_ashost". This system variable specifies the actual server name of the given SAP server.
Operations can be performed  based on a particular system name. this is particularly useful when users are connecting to multiple SAP ERP systems.

In the following example, based on the server name we navigate to different transactions using a single function.

Liquid UI Code:

///////////////////////// 'SAPLSMTR_NAVIGATION.E0100.sjs ///////////////////////////

println("Name of the server in use is "+_ashost);
del("X[IMAGE_CONTAINER]");
if(_ashost == "juneau"){
     set("V[z_tran]","/nVA01");
}
else if(_ashost == "ZEUS"){
     set("V[z_tran]","/nMM01");
}
onUIEvents['enter']=z_navigate;

//on enter navigates to "VA01" if server is Juneau and to "MM01" if server is zues
function z_navigate(){
     // SAP Easy Access
     onscreen 'SAPLSMTR_NAVIGATION.0100'
          enter("&V[z_tran]");
}

32
Purpose:
Configuration of Liquid UI web server to connect to SAP R/3 Server with SAP Router Strinig

Sample SAP connection:
Description:- SAP Router
Application Server:- Application server-IP
Instance Number:-00
System ID:- SID
System ID:- /H/ROUTER-STRING/S/ROUTER-PORT/H/

In "config.js" file, the below line need to be added/modified, to connect to SAP Server
const  R3_SERVER_NAME   = "/H/<ROUTER-STRING>/S/<ROUTER-PORT> /H/ <Application server-IP >/S/32<instance-port>";   

const DEF_WEBPORT_BASE   = g_arArgs['_PORT']!=void 0?g_arArgs['_PORT']:"88";      // portnumber

In browser use following url 
http://<serverhostname/IPAddress>:<portnumber>/Guixt4web/logon.gsp#

See attachment for screenshots

33
Purpose:
Creating pushbuttons dynamically using "for loop".
Passing array values as parameters to these pushbuttons with "using" option.

Below example explains the creation of pushbuttons with for loop
And passing values of an array into these pushbuttons as parameters with "using" option.
When clicked on a pushbutton parameter assigned to that pushbutton is displayed on screen as comment.

Liquid UI Code:
//////////////////////////SAPLSMTR_NAVIGATION.E0100.sjs//////////////////////////

// Function to trim blank spaces at the end of the string
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');}

// Function to check if the string value is blank
function isBlank(jvar){
   if(typeof jvar == 'string') {
      jvar = jvar.trim();
   }
   if(typeof jvar == 'undefined') {
      jvar = '';
   }
   return(jvar == 'undefined' || jvar == undefined || jvar == null || jvar == "" || jvar == void 0);
}

del("X[IMAGE_CONTAINER]"); // deletes image on easy access screen
var notifications = ["","10000101","10000102","10000103","10000104","10000105"] // array

for(idx = 1, row = 0; idx <= 5; idx++){ // for loop for creating pushbuttons
      pushbutton([3+row,10], "Notification &V[idx]",{"size":[1,20], "process":z_display_param, "using":{"value":notifications[idx]}});
      row = row+2;
}

if(!isBlank(z_param)){ // displays only when clicked on any pushbutton created
    text([3+row,10], "Notification number is &V[z_param]",{ "size":24,"comment":true});
}

//function called when clicked on pushbutton with parameter
function z_display_param(param){
   set("V[z_param]",param.value);
   println("-------------param passed is"+z_param);
}

See attachment for screenshots and more information

34
Purpose:

Using "search" option in "set" command, you can search in the specified text and return the next immediate string in the text to a variable or field.
If the word you are searching for is not in the original string, then it returns blank string.
This is very useful in scenarios like extracting an order number from a successful saving message.

Usage:

The search option specifies that a given string will be searched in the relevant text.

Syntax:

set("variable/field","original string",{"search":"string"});

Where "original string" refers to the text that will be searched.
"string"refers to the word you want to search for.
"variable/filed" to which the result of the search will be assigned.

Liquid UI Script:
///////////////////////////////SAPLSMTR_NAVIGATION.E0100.sjs/////////////////////////////////

del("X[IMAGE_CONTAINER]");
inputfield([2,1], "Order Type", [2,24], {"name":"z_var", "size":10});
temp = "standard order OR xyz"; // text for searching
set("V[z_var]","&V[temp]",{"search":"order"}); // set with search option

You can see value returned in the Liquid UI field "Order Type" and also on Cornelius window.

See attachment for screenshots

35
Purpose:
To get the past date in the current user's date format based on the number of days entered.

User Interface:
Log into SAP and on the SAP Easy Access Screen you will see the Liquid UI fields. Enter the 'no. of Days in past' field which is required and click on 'Get past date'.

Liquid UI Code:

// SAPLSMTR_NAVIGATION.E0100.sjs

// Validate if the variable holds blank or null value
function isBlank(jvar){
    if(typeof jvar == 'string'){
        jvar = jvar.trim();
    }
    return(jvar == 'undefined' || jvar == null || jvar == "" || jvar == void 0);
}

// Change date from 6 digit or 8 digit to correct format
function formatDate(date,dformat){
    var date1 = "";
    month = date.substring(4,6);
    year = date.substring(0,4);
    date = date.substring(6,8);
   switch (dformat){
            case '1':
                date1 = date + "." + month + "." + year;
                break;
            case '2':
                date1 = month + "/" + date + "/" + year;           
                break;
            case '3':
                date1 = month + "-" + date + "-" + year;                           
                break;
            case '4':
                date1 = year + "." + month + "." + date;           
                break;
            case '5':
                date1 = year + "/" + month + "/" + date;               
                break;
            case '6':
                date1 = year + "-" + month + "-" + date;
                break;
        }
    return(date1);     
}

// Get past date based on the number of days
function getPastDate(){
    if(isBlank(z_days)) {
        return('E: Enter number of Days');
    }
   
    onscreen 'SAPLSMTR_NAVIGATION.0100'
        var curr_date = new Date();
        curr_date.setMilliseconds(curr_date.getMilliseconds()-(z_days*24*60*60*1000));

        var tmp_cur_month = curr_date.getMonth();
        var tmp_cur_date = curr_date.getDate();
        var tmp_cur_year = curr_date.getFullYear();

        if(tmp_cur_month<9)
            tmp_cur_month = "0"+(tmp_cur_month+1);
        else
            tmp_cur_month = (tmp_cur_month+1).toString();

        if(tmp_cur_date<10)
                        tmp_cur_date = "0"+tmp_cur_date;

        z_target_date = formatDate(tmp_cur_year+tmp_cur_month+tmp_cur_date,"2");
        enter('?');
}
// User Interface
del('X[IMAGE_CONTAINER]');  // Delete ActiveX Container on SAP Easy Access screen
inputfield([1,1], "No. of Days in Past", [1,24], {"name":"z_days", "size":3, "required":true});
inputfield([2,1], "Date", [2,24], {"name":"z_target_date", "size":10});
pushbutton([2,36], "Get past date", "?", {"process":getPastDate});

36
Purpose:
Fetching data from the SAP grid into Array variables using WS function.

Using:
Data from grid is fetched into array variables with WS function by using “Select All” and “Details” buttons functionality of SAP.

Below example demonstrates the reading of notification grid data into array variables from IW28 transaction.
-> On screen "Selection of Notifications" enter appropriate filters and click on "Execute".
-> On screen "List of Notifications" add below code.

LiquidUI Code:

////////////////////////// SAPLSLVC_FULLSCREEN.E0500.sjs /////////////////////////////

//pushbutton to call function getnotifications function
pushbutton( [TOOLBAR], "Read to Arrays",{ "process":getnotifications});

function countnotifications(){
      z_count_notif=0;
      z_iw28_notif = []; // initializing array variables
      z_iw28_notifdesc = [];
      z_iw28_notifdate = [];
        // Display Notifications: List of Notifications
      onscreen 'SAPLSLVC_FULLSCREEN.0500'
         enter('/5');      //triggers "Selecl All" button to select all notifications in grid

      // Display Notifications: List of Notifications
      onscreen 'SAPLSLVC_FULLSCREEN.0500'
         enter('/37');  //triggers "Details" button which navigates to details of first notification

      // Display PM Notification: Maintenance request
      onscreen 'SAPLIQS0.7200'
              //logic to fetch notification numbers and respective details by looping
         FETCHNOTIF:             
            z_count_notif = z_count_notif+1;
            set("V[z_iw28_n]","&F[VIQMEL-QMNUM]");
            z_iw28_notif.push(z_iw28_n);
            set("V[z_iw28_ndate]","&F[VIQMEL-QMDAT]");
            z_iw28_notifdate.push(z_iw28_ndate);
            set("V[z_iw28_nd]","&F[VIQMEL-QMTXT]");
            z_iw28_notifdesc.push(z_iw28_nd);
            enter('/3');    // with ‘/3’ screen navigates to details of next notification till last notification in grid is reached

      onscreen 'SAPLIQS0.7200'
         goto FETCHNOTIF;
         enter();

      onscreen 'SAPLSLVC_FULLSCREEN.0500'
         message("number of notifications is:"+z_count_notif); // displays the number notifications on statusbar
         enter('?');
}

// display the data in the arrays on cornelius
for(idx=0;idx<z_count_notif;idx++){ 
println('--------------------------------z_iw28_notif_'+idx+'='+z_iw28_notif[idx]);
println('--------------------------------z_iw28_notif_'+idx+'='+z_iw28_notifdesc[idx]);
println('--------------------------------z_iw28_notif_'+idx+'='+z_iw28_notifdate[idx]);
}

-> Click on "Read to Arrays" button on toolbar.
-> After execution data stored in arrays can be viewed on cornelius window.

See attachment for sreenshots

37
Purpose:
To get Liquid UI field attributes using getfieldattribute command.

This example is to use getfieldattribute command for Liquid UI Inputfield.
By using command, it returns the field name, field row, field text row, field column, field text column, field techname, field size and isprotected value.

Liquid UI code:
//on SAPLSMTR_NAVIGATION.E0100.sjs script file

Step 1: Create Liquid UI inputfield on screen
Clearscreen();
inputfield( [6,1], "Liquid UI Field", [6,15],{ "name":"z_field", "size":50,"readonly":true});
 
Step2: Create function to get inputfield attributes
function printInfo(){
    getfieldattribute("F[Liquid UI Field]",
    {"name":"fname", "textrow":"ftextrow",
    "textcolumn":"ftextcolumn",  "row":"frow",
    "column":"fcol", "techname":"ftechname",
    "size":"fsize", "isprotected":"fprotected",
    "header":"fheader",  "columnnumber":"fcolumnnumber",
    "displaycolumnnumber":"fdisplaycolumnnumber",
    "width":"fwidth"});
    println("Printing Field attributes!");
    println("\t fname = " + fname);
    println("\t ftextrow = " + ftextrow);
    println("\t ftextcolumn = " + ftextcolumn);
    println("\t frow = " + frow);
    println("\t fcol = " + fcol);
    println("\t ftechname = " + ftechname);
    println("\t fsize = " + fsize);
    println("\t isprotected = " + fprotected);
}

After execution these values can be checked in cornelius window by using println statements.

Note: getfieldattribute can also be used to fetch attributes of SAP native fields and other Liquid UI elements such as radiobutton,checkbox,pushbutton,textfileld and groupbox.

See attachment for screenshots

38
Purpose:
Using the select directory custom function with WS.

Prerequisites:
WSoffice.dll

Usage:
Select directory custom function chooses a directory from which users can select a file to be opened. This is very useful  when choosing an Excel or PDF file to open for bulk data transfer to SAP via WS office.The custom function code is as follows.

function selectDirectory() {
    var dirName = " ";
    dirvalue = readDirectory(0, "Please select a directory", 0);
    set('V[z_directory]', dirvalue);
}

The selectDirectory custom function calls a second custom function, the readDirectory function. This function is where the dialog box attributes are defined and this function must be called for a user to display dialog box.The code is as below.

function readDirectory(wHnd,strTitle,iOptions){
    //This function is for selecting a directory
     //BIF_browseincludefiles
   //the use of this option enables the selection of file in select directory dialog box

   var aWshShell = new ActiveXObject("Shell.Application");
   var objFolder = aWshShell.BrowseForFolder(wHnd, strTitle, iOptions);
   objFolder = objFolder.ParentFolder.ParseName(objFolder.Title).Path;
   aWshShell = void 0;
   return objFolder;
 }

Example:
In this example, we will select a directory and output the directory name on the SAP easy access screen. To demonstrate this operation, please do the following.

Liquid UI Script
----------------------------------------------------------------
On 'SAPLSMTR_NAVIGATION.E0100.sjs script file
----------------------------------------------------------------


load('wsoffice.dll'); //enables wsoffice functionalities
del("X[IMAGE_CONTAINER]");
pushbutton([8,25], "Select Directory", "/0", {"process":selectDirectory});  //pushbutton to call 'selectDirectory' function
inputfield([6,1], "Directory", [6,15], {"name":"z_directory", "size":"50"}); // inputfield to show selected directory

function readDirectory(wHnd,strTitle,iOptions){                    //readDirectory custom function
   var aWshShell = new ActiveXObject("Shell.Application");
   var objFolder = aWshShell.BrowseForFolder(wHnd, strTitle, iOptions);
   objFolder = objFolder.ParentFolder.ParseName(objFolder.Title).Path;
   println("-------Specified Directory--------"  + objFolder + "--------");
   aWshShell = void 0;
   return objFolder;
}

function selectDirectory() {  //selectDirectory custom function
    var dirName = " ";
    dirvalue = readDirectory(0, "Please select a directory", 0);
    set('V[z_directory]', dirvalue);
  }


Note: wsoffice.dll should be installed and needs to be loaded using code below.
         load('wsoffice.dll');


See attachment for screenshots and more details

39
Purpose:
We can encrypt and decrypt SAP password with a simple WS function using 'RC4 Encryption Algorithm'.

Usage:
If password is currently being saved in the 'SAP USER' table. It is saved by default in an unencrypted format. To encrypt the password, please do the following.

Encrypting the SAP Password:
1.   Create a new RC4 object as shown in the following example:
var crp = new system.rc4("12345678");
The value "12345678" Is the encryption key. This is optional -if you do not supply a key, the algorithm will use the Synactive default key.
2.   Create new variable containing the encrypted password as shown in the following example:
Var encryptedpwd = crp.crypt("Password");
3.   The password has now been encrypted.

Decrypting the SAP Password:
To decrypt  the password, you will need to create a RC4 object. Please see the instructions below.
1.   Create a new RC4 object as in the example below:
var decrypt = new system.rc4("12345678");
2.   Create new variable containing the decrypted password as shown in the following example:
Var decryptedpwd = crp.crypt(encryptedpwd);

Example functions:

You can use this function for Encryption.
function EncryptText(){
    var crp = new system.rc4("12345678");
    var Encryptedtext = crp.crypt(str);
    return Encryptedtext;
}

Function to decrypt password.
function DecryptText(){
    var crp = new system.rc4("12345678");
    var Decryptedtext = crp.crypt(Encryptedtext);
    return Decryptedtext;
}

Below example demonstrates the encrypting and decrypting of text using single liquid ui function
Liquid UI Code:
------------------------------------------------------------------------------------------------------------------------------------------
Script file :  SAPLSMTR_NAVIGATION.E0100.sjs
------------------------------------------------------------------------------------------------------------------------------------------
//pushbutton for calling function
pushbutton([10,15], "Encrypt & Decrypt PWD  ",{ "process":cryptText, "using":{ "z_crypt":z_password }});
//inputfield to show encrypted and decrypted text
inputfield( [4,9], "Password", [4,25],{ "name":"z_password", "size":32});
del("X[IMAGE_CONTAINER]");

//function to encrypt and decrypt provided text
function cryptText(param){

    set("V[crypt]",param.z_crypt);
    var crp = new system.rc4("12345678"); //key for encryption(optional)
    cryptedtext = crp.crypt(crypt);

    onscreen 'SAPLSMTR_NAVIGATION.0100'
         set("V[z_password]","&V[cryptedtext]"); // crypted text assigned to inputfield "password"
          enter('?');
}

See attachment for more information and screenshots

40
Purpose:

Making system calls using WS custom functions.

Prerequisite:

wsoffice.dll

Usage:

The ActiveXObject adds support for the Microsoft COM objects. It enables user to make calls to a user local file system among other useful actions.The ActiveXObject requires the wsoffice.dll installed along with WS, it has function call methods from Microsoft office to perform various tasks.

Using ActiveXObject and wsoffice.dll we can create a custom function to make system calls.

In the following example, we are creating a pushbutton on a SAP screen. The pushbutton will call a function that contains an ActiveXObject. When the toolbar pushbutton is clicked, the function will proceed to make a call to the local file system that will result in a pre-specified file being moved from its original location to a new location. TO demonstrate this, please do the following:

1.Log into SAP and go to the Easy Access screen.
2.Open the 'SAPLSMTR_NAVIGATION.E0100.sjs' script file. Create the file if it does not exist. First, create a toolbar pushbutton with the following code:

   pushbutton([TOOLBAR], "Move File    ",{ "process":MoveFile});

3.Create a function that the pushbutton will call.
   An example is shown below:

   function MoveFile(){ 
         load("wsoffice.dll"); 
         var objCopy, test; 
          //Creates ActiveXObject for file system object
         objCopy = new ActiveXObject("Scripting.FileSystemObject"); 
         test = objCopy.GetFile("C:\\guixt\\test.txt"); 
         test.Move("C:\\LiquidUI\\test_moved.txt");
   }

4.   Save your changes and click the toolbar pushbutton to initiate the function.

In the preceding function, we have created a new ActiveXObject named 'objCopy', which now allows us to make calls to the file system through the WSOffice DLL. Methods of this new object are then utilized to get a specified file. A method of the new object is then utilized to move the file to a new location(LiquidUI folder) with new name(test_moved.txt).

Note: In order to use wsoffice.dll features, we need to add following code is included in the script immediately before the new ActiveXObject variable is created.
load("wsoffice.dll");


see attachment for screenshots

41
Purpose
To Determine fcode for Keyboard Combination.

Usage
Fcode: 'fcode' means the function code that is passed to application program by an event when the user chooses the pushbutton.
In Liquid UI, we can use fcodes In liquid UI  pushbuttons to perform a particular functionality and also in onUIEvents to trigger function when an event of that fcode occurs.

Usage of fcode with pushbutton:
pushbutton([3,144], "SAVE", "/11");
/11 - is the fcode for save

Usage of fcode with onUIEvents:
onUIEvents["/11"] = {"fcode":z_save};
/11 - fcode for save.
Z_save - liquidui function executed on save event.

In SAP, we find this function keys assigned to buttons in the form of function keys such as F1,F2,F3… CTRL and SHIFT.
We can determine fcode for these keyboard combinations to use them with liquid UI as below.

F1 = 1      F2 = 2      F3 = 3      F4 = 4
F5 = 5      F6 = 6      F7 = 7      F8 = 8
F9 = 9      F10 = 10   F11 = 11   F12 = 12
SHIFT = 12   CTRL = 24

To find fcode for keyboard combination for (CTRL + F1)
CTRL + F1 = /25
24 + 1 =25

To find the keyboard combination for (/37)
/37 = CTRL + SHIFT + F1
37 = 24 + 12 + 1

Note: fcode for events is also generated while recording using designer.




42
Prerequisites:
1. Installation of Liquid UI app on the IOS device.
2. Connection to SAP R/3 Server (even demo.guixt.com can be used).

Steps to Set Toolbar Height for Liquid UI IOS:
-> Login to the SAP R/3 connection.
-> Select the right bottom corner of the screen @ SAP Server Name.
-> A bubble with a list of entries pop's up.
-> Tap on "Set Toolbar Height" entry.
-> Another pop up appears with a Scale to set the height in pixels.
-> Move the pointer on scale to set desired height and click "OK".
-> Toolbar height is changed on Liquid UI IOS.

See attachment for more information.

43
Mobile Products (Android, iOS and CE) / Scan Credit Card on IOS
« on: June 27, 2017, 03:32:58 AM »
Purpose

With Liquid UI for iOS, you can scan Credit Card information on the native SAP table and Liquid UI table. For you, it just look for identifier/field name while scanning Credit Card.

Note: Valid Liquid UI license is required to use Liquid UI Scan feature.

Prerequisites
->Navigate to your device Settings, and move to GuiXT App. Then, enable the Dynamic Table Control switch to avoid inconvenience with the Scan option. (specifically for iPhone users)
->Disable Dynamic Grid Control switch.

User Interface

Liquid UI Credit Card Scan feature eliminates manual data entries by populating the card number. Just do a single tap on any field in the table to add credit card details. You will get the Scan option.
1.For Example, navigate to VA01 second screen → Header data → Payment Card tab
2.In Table "Payment cards", select column "Card number".
3. On selecting the Scan option on keyboard, the built in camera will get activated with a PayPal.
4. Once the scan is done, it populates the card and asks you to enter Expiry date and CVV number of the card.
5. After providing the required details, click Done to finish the scan. The scanned value will be read into the field.
6. You can now make your payments easily by populating the values through scanning.

Note: Based on the column, it will scan specific info. The identifiers are:
CCNUM --> Credit card number field
CCDate --> Date field
CCARD_CVV --> CVV field


See attachment for more information


44
Purpose:-  Connecting to Message Server using Liquid UI Android.

To Configure Message Server on Liquid UI Android Provide your SAP Server Information and Click on CONNECT TO MY SAP. We need to Provide Message Server in below Format:
/M/JUNEAU/S/3600/G/DESIGNER

M                ->   Stands for Message Server
Juneau       ->   Message Server Name
S                 ->   Stands for Service Port Number
G                 ->   Stands for Group Name
DESIGNER ->   Name of the Group

Note:-Service Port Number is found in "services" file at below path on machine Configured with message server
          C:\Windows\System32\drivers\etc
          Eg:- sapmsTRX  3600/TCP
          TRX is the SAP SystemID  and 3600 is the service port number.


See attachments for more information

45
Purpose: Connecting to Message Server using Liquid UI IOS.

To Configure Message Server on Liquid UI IOS Provide your SAP Server Information and Click on CONNECT TO MY SAP. We need to Provide Message Server in below Format:
 /M/JUNEAU/S/3600/G/DESIGNER

M                ->   Stands for Message Server
Juneau       ->   Message Server Name
S                 ->   Stands for Service Port Number
G                 ->   Stands for Group Name
DESIGNER ->   Name of the Group

Note: Service Port Number is found in "services" file at below path on Machine Configured with Message Server
         C:\Windows\System32\drivers\etc
         Eg:- sapmsTRX  3600/TCP
        TRX is the SAP SystemID  and 3600 is the service port number


See attachments for more information.

Pages: 1 2 [3] 4