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.


Messages - Sai Siddhartha

Pages: [1] 2 3 4
1
Purpose:
Fetching values from inputfields using there positioning on screen.
This is useful in case where screen has multiple fields with same label technical name.

Below example demonstrates the fetching of values using second screen of 'MB1B' transaction.
This screen has multiple fields with same technical name under 'Items' groupbox.

-Create script file  SAPMM07M.E0421.sjs with below code.

LiquidUI Code:
///////////////////////////////////// SAPMM07M.E0421.sjs ////////////////////////////////////
   z_mat = [];
   z_qty = [];
   i = 0;
   while(true){
      row = 6+i;
      set('V[z_tmp_mat]','&#['+row+',8]');
      z_mat.push(z_tmp_mat);
      set('V[z_temp_qty]','&#['+row+',27]');
      z_qty.push(z_temp_qty);
      i++;
      if(isBlank(z_tmp_mat)){
         goto END;
      }
   }
   END:;
   println('-----------materails-------'+z_mat);
   println('-----------quantity-------'+z_qty);

-   Navigate to 'Enter Transfer Posting: New Items' screen in 'MB1B' transaction and enter some data into fields under labels 'Material' and 'Quantity' inside 'Items' group box.
-   Refresh the screen by entering '?' in command field it will run the code and fetch values entered into arrays specified.
-   Values assigned to arrays will be displayed on Cornelius window.


2
Purpose:
Selecting rows and columns in a Liquid UI table.

To select particular row in a table use following syntax.
     table_name.selectedrows[row_index] = "X";

To select particular column in a table use following syntax.
     table_name.selectedcols[col_index] = "X";

      table_name - represents name of the liquid ui table.
      row_index   - represents row number you want to select.
      col_index    - represents column number you want to select.

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

del("X[IMAE_CONTAIeNER]");// deletes image
table([1,1], [12,48], {"name":"proj", "title":"All items", "rows":10,"rowselection":true,"columnselection":true}); // creates table
column('Material', {"table":"T[All items]", "size":30, "name":"matnr", "position":1, "table":"T[All items]"});       
column('Quantity', {"table":"T[All items]", "size":10, "name":"qty", "position":2, "table":"T[All items]"});

// for selecting a row of a table
proj.selectedrows[0] = "X";

// for selecting a column of a table.
proj.selectedcols[1] = "X";

note: selectedrows and selectedcols are arrays there index starts from '0'

3
Purpose:
Using copytext command with line option data from textbox is copied into table cells.

In the following example, We are using variables to specify the line numbers to be copied.
These variable are trimmed to remove whitespace and place the value into an array.
A 'set' command is used to move these values into the table.

Example uses 'All items' table from 'VA01' transaction to set values from textbox.

Liquid UI Code
//////////////////////////////////////// SAPMV45A.E0101.sjs /////////////////////////////////////

textbox([7,82], [11,113], { "name":"z_copytext","textfont":"Arial","textheight":"12", "textweight":"5"});
pushbutton([TOOLBAR], "Screen Copy",{ "process":copy_test});

function isBlank(jvar) { 
   if (typeof jvar == 'string'){   
      jvar = jvar.trim(); 

   return(jvar == null || jvar=="" || jvar == void 0);
}

String.prototype.trim = function() {  return this.replace(/^\s+|\s+$/g,""); }

function copy_test(){
   var z_str = "";
   var arMaterial = [];
   var lastIndex = 2;
   for (loop = 1; loop <lastIndex; loop++){ 
      // copytext with line option and variable as line number
      copytext({"fromtext":"z_copytext", "tostring":"z_str", "line":loop}); 
      if (isBlank(z_str) || z_str=='undefined'){   
         break;         // exits loop
      } 
      arMaterial.push(z_str.trim());  // adding values to array
      lastIndex++;
   }

   relrow=1;
   absrow=1;
   row_max=0;
   materialvalue="";
   onscreen 'SAPMV45A.4001'
      set("F[Sold- To Party]","1460");      // default sold- to party value
      gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow"});
      new_screen: //scroll the table to the absolute row              
      enter('/ScrollToLine=&V[absrow]', {"table":"T[All items]"});   

   onscreen 'SAPMV45A.4001'
      println("Inside 2nd Screen Block");
      gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow"});
      println("After get table attribute");
      relrow=1;                               
      new_row:                                                               
      if (row_max == arMaterial.length){                                               
         goto end_of_table;                               
      }                                                               
      if(absrow>LVisRow) {                                                 
         goto new_screen;                               
      }                                                                                                             
      set("cell[All items,Material,&V[relrow]]", arMaterial[row_max]);                               
      set("cell[All items,Order Quantity,&V[relrow]]", 1); // default value '1' is added
      set("V[tmp1]", "&cell[All items,Material,&V[relrow]]");                               
      set("V[tmp2]", "&cell[All items,Order Quantity,&V[relrow]]");                               
      println('**********tmp1 and tmp2 = ' + tmp1 + ' & ' + tmp2);                                                               
      enter();                                               
      onerror              // error handling                                                 
      enter("/nva01");

   onscreen 'SAPLSPO2.0300'                                               
      enter("=OPT1");   
 
   onscreen 'SAPMV45A.4001'                               
      row_max++;                               
      absrow=absrow+1;                               
      relrow++;                               
      goto new_row;               
      end_of_table:;       
      enter('/ScrollToLine=1', {"table":"T[All items]"});
}   

After executing function you can see values added to All items table of VA01 second screen.

See attachment for more information and screenshots

4
WS aka Web Scripts (Attended RPA for SAP) / Liquid UI - selectedrows option
« on: February 15, 2018, 06:09:54 AM »
Purpose:
To determine selected rows in a table using 'selectedrows' option in 'gettableattribute' command.

Liquid UI Code:
//////////////////////////////// SAPMV45A.E4001 //////////////////////////////

pushbutton( [TOOLBAR], "Selectedrows ","?",{  "process": print_selectedrows});

function print_selectedrows(){
     gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow",
                             "selectedrows":"SelRows"});
     for(i=0;i<LastRow;i++){
            ROW_NUMBER = i;
            if(SelRows[ROW_NUMBER]=="X"){
                   // adding 1 as SelRows is array which has index begin from 0
                 selected_row_number = ROW_NUMBER+1;
                 println("Selected row is>> " + selected_row_number);
            }
       }
 }

After executing the function you will see row number of selected rows in a table on Cornelius output window.

See attached document for more information and screenshots.

5
Purpose:
To perform "Object for Services" functionality by passing ActiveX parameter to enter command

Liquid UI Script
/////////////////////////////// SAPMF05A.E1100.sjs ///////////////////////////////

pushbutton([TOOLBAR], "Store Business Doc", {"process":objServicesExecute});
function objServicesExecute()
{
     onscreen 'SAPMF05A.1100'
          enter({"control":"GOSCONTAINERCTRL.Toolbar", "item":"%GOS_TOOLBOX;381;328", "event":2});
     onscreen 'SAPMF05A.1100'
          enter({"control":"GOSCONTAINERCTRL.Toolbar", "item":"%GOS_ARL_LINK","event":1});
}

After entering the above code in the script file 'SAPMF05A.E1100.sjs' for the 'FV60' transaction.
Save your changes and launch and login to SAPGUI and follow below steps to demonstrate functionality.

  - Goto 'FBV2' transaction and click on 'Document List(F5)' button on the toolbar.
  - On screen "List of parked Documents", enter values for an existing document to edit.
     Sample data:
       . company code - 0001
       . Document Number- 1900000338
       . Fiscal year - 2012
       Note: above data may not be similar please enter existing data.
  - Once entered values click on 'Execute(F8)' on toolbar.
  - On screen "Changed Parked Documents: List", click on 'Choose(F2)' first button on toolbar.
  - You are now in the 'FV60' transaction and the script you previously created will take effect.
     Click on GUIXT created toolbar button 'Store Business Doc'.
  - Clicking the 'Store Business Doc' button will execute the WS function 'objServicesExecute' and will send the ActiveX services
     for Object menu which will trigger the action to store a business document.
  - If the operation completes successfully, you will see the 'Archive from Frontend' window appear.

See attachment for more information and screenshots

6
WS aka Web Scripts (Attended RPA for SAP) / Liquid UI - file command
« on: February 01, 2018, 06:27:07 AM »
Purpose:
The file command assigns short names - also called aliases - to scripts housed in a SAP web repository(SAPWR).

Usage:
This command is very useful since SAPWR set a limit of thirty characters on a filename. This syntax is as follows:
file("long_filename",{"alias":"short_filename"});
The file command is placed in the session.sjs file if such a file is present.

Options
The file command takes the following option:
alias - this is used to specify the short filename that will be used instead of original filename.
Syntax:
{"alias":"shortfilename"}

Assigning an alias:
The file command can be used with to assign aliases to files.
In the following example, we will assign an alias to a file SAPWR with a very long file name.
1.Create a file in SAPWR with the following filename:
        an_extremely_and_over_the_top_lengthy_script_filename.sjs
2.Open the 'esession.sjs' file and enter the following code. Create the file if it does not exist.
        file("an_extremely_and_over_the_top_lengthy_script_filename.sjs",{"alias":"longfile.sjs"});
3.Save the file.
4.You should now be able to access the file using alias instead of the actual file name.

7
Purpose:
In this scenario, we will use a pushbutton to run the process with dynamic function names.
You can navigate to the function based on the value entered in the module field.
Here the user is navigated to either 'VA01' or 'MM01' transaction based on the module entered.

User Interface:
On the easy access screen, enter the module name as 'SD' in the inputfield and click on 'RFC TEST' toolbar pushbutton then you are navigated to VA01 transaction.
Enter the module name as 'MM' in the inputfield and click on 'RFC TEST' toolbar pushbutton then you are navigated to MM01 transaction.

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

del('X[IMAGE_CONTAINER]');
// Create an inputfield to retrieve the Module value
inputfield([1,1],"Module:",[1,10],{"size":2,"name":"z_name"});
// a button to run the function to navigate to transaction
pushbutton([TOOLBAR],"RFC Test",{"process":['RFCTestFunc&V[z_name]']});

// function navigates to VA01 screen
 function RFCTestFuncSD(){
   enter('/nva01');
}

// function navigates to MM01 screen
 function RFCTestFuncMM(){
    enter('/nmm01');
}

8
_title
This variable retrieves the screen title where the user currently resides.
It is useful in Scenario where the script needs to be conditionalized based on the title of the current screen.
println("Screen title is>>"+_title);

_user
This variable specifies the current user. To find the user information and output it to console.
This variable is very useful in cases where you need to conditionalize scripts based on username.
println("User>>"+_user);

Liquid UI Code:
////////////////////////////////// SAPLCRA0.E4000 /////////////////////////////////////

// conditionalizing script based on "_title" system variable
if(_title=="Change Work Center: Basic Data"){
   del("G[General Data]");
}   
else if(_title=="Change Work Center: Default Values"){
   del("G[Units of Measurement of Standard Values]");
}


//////////////////////////// SAPLSMTR_NAVIGATION.E0100.sjs /////////////////////////////
// conditionalizing script based on "_user" system variable
if(_user=="JOHN"){
   pushbutton([5,15], "Create Sales Order","/nVA01");
   pushbutton([7,15], "Create Sales Order","/nVA02");
   pushbutton([9,15], "Create Sales Order","/nVA03");
}   
else if(_user=="SHANE"){
   pushbutton([5,15], "Create Material","/nMM01");
   pushbutton([7,15], "Change Material","/nMM02");
   pushbutton([9,15], "Display Material","/nMM03");
}



9
_dynpro
 A dynpro is the actual SAP program name. each SAP program is identified by a dynpro number. Examples of dynpro numbers are the following:
  0101
  0100
The dynpro is used with the language code and the program name to identify a given SAP screen.
The _dynpro variable is used to find which dynpro is currently being accessed or to perform operations based on a particular dynpro number.
In our example, we will simply find out which dynpro we are accessing and output that information to the console.
println("Dynpro>>"+_dynpro);

_language
The _language variable is used to return the current language code of a given implementations.
If users are operating in different languages, this variables is useful for  specifying the different files or different operations for different users based on language.
To find the current language and output that information to the console, we would write the following:
println("The language is >>"+_language);

_program
Everyday dynpro has a program name associated with it, as shown in the following examples:
  SAPMV45A
  SAPLSMTR_NAVIGATION
The _Program variable returns the program name for the current screen.
To return the current program number to the console, the following code can be used.
Println("program is >>"+_program);


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

println("name of the current screen is  >>"+_program+"."+_language+""+_dynpro); // display output on console window

Name of the .sjs script files is made up of these variables.
you can see output similar to the name of script file currently in process on cornelius output window.

10
Purpose:
To check value of the indexed variable set command must be used.
The set command will obtain the value of indexed variable into a regular variable which can be checked against the value.

Below example demonstrates the value check of the indexed variables using set command.

Liquid UI Code
////////////////////////////// SAPLSMTR_NAVIGATION.E0100 ///////////////////////////////

materialnumber = ["1001","1002","1003","1004","1005"]; // array with material numbers
for(idx=0;idx<5;idx++){     
   set("V[z_temp]" , materialnumber[idx]); // assigning values to temp variable using index
    // conditions for checking value in temp variable           
   if (z_temp == "1005") { 
      println("Material at 5th position in materialnumber array>>>" +z_temp);           
   }
   if (z_temp == "1004") {           
      println("Material at 4th position in materialnumber array>>>" +z_temp);           
   }
   if (z_temp == "1003") {           
      println("Material at 3th position in materialnumber array>>>" +z_temp);           
   }
   if (z_temp == "1002") {           
      println("Material at 2th position in materialnumber array>>>" +z_temp);           
   }
   if (z_temp == "1001") {           
      println("Material at 1th position in materialnumber array>>>" +z_temp);           
   }
}

You can see output on Cornelius output window as per the conditions in script.

See attachment for screenshots

11
WS aka Web Scripts (Attended RPA for SAP) / LiquidUI - tablewidth Command
« on: December 28, 2017, 04:52:02 AM »
Purpose:
With tablewidth(), you can change the width of a table control in SAP. This command can be used only with native SAP tables.

Syntax:
tablewidth("T[Tablename]",X);

Properties:
     Tablename - name of a SAP table.
     X -  specified new width for SAP table

Note: "X" is replaced by the numerical value which specifies the new width for the table. The width specifies the number of characters.

Below example demonstrates the tablewidth command on "All items" table of "VA01" transaction.
Navigate to second screen of "VA01" transaction where we have "All tems" table and below enter below code in script file of this screen.

Liquid UI Code:
//////////////////////////// SAPMV45A.E4001.sjs //////////////////////////////

tablewidth("T[All items]", 50);

See attachment for screenshots

12
WS aka Web Scripts (Attended RPA for SAP) / Data Dependent Views
« on: December 21, 2017, 06:47:35 AM »
Purpose:
Data dependent viewing ability enables user might have a number of files, named with different names.
If a user enters a value in a given inputfield the file linked to that field would be displayed.

Usage:
This functionality allows you to use variables to specify the file names.
To demonstrate this functionality, please do the following.
1.   Create several files, naming them 'img0005001','img0005002','img0005003'.
2.   Enter below code in file ''SAPSLMTR_NAVIGATION.E0100.sjs'.

Liquid UI Code
/////////////////////////// 'SAPSLMTR_NAVIGATION.E0100.sjs' //////////////////////////

del("X[IMAGE_CONTAINER]");  // deletes image
inputfield([1,5], "Material Number", [1, 31], {"name":"z_matno", "size":20});  //field to specify file name to open
pushbutton([TOOLBAR], "View Files", {"process":z_view});  // executes function on click

function z_view() {
     view("img&V[z_matno].txt");  // view command take value field variable
}

See attachment for more information and screenshots

13
WS aka Web Scripts (Attended RPA for SAP) / Liquid UI - removefile command
« on: December 14, 2017, 08:41:25 AM »
Purpose:
The removefile command is used to delete files.
When a file is no longer needed, use the removefile command to delete the file. It is necessary to use the full path of the file.

Syntax:
removefile("filename.ext");

Example:
In below example, we will use removefile command to delete a sample file using WS function. The code would be as follows:

LiquidUI Code:
////////////////////////// SAPLSMTR_NAVIGATION.E0100.sjs ///////////////////////////

pushbutton([TOOLBAR],'Remove File','?',{'process':z_removefile});

function z_removefile(){
   removefile("file1.txt ");
}

The "file1.txt" is now deleted.

14
Purpose:
To read data from file into a textbox on SAPGUI.

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

del("X[IMAGE_CONTAINER]"); // deletes image
textbox([2,1], [8,117], { "name":"z_textbox", "textfont":"Arial", "textheight":"12", "textweight":"5"}); // textbox
pushbutton([TOOLBAR],'Copy from File','?',{'process':z_readfile}); // triggers function on click

function z_readfile(){
// filename specifies the file in use
     openfile('filename.ext'); // command opens specified file
NEXT_LINE_READ:
     readfile('filename.ext',{"z_content":true}); // read file data into variable
     if(isBlank(z_content)){  // condition to exit loop
         println("<<<<<<<<<<<<<<GOING END>>>>>>>>>>>>>>"); 
         goto END;
      }
     copytext({"fromstring":"z_content","totext":"z_textbox", "appendline":true}); //copy data from variable to textbox
     goto NEXT_LINE_READ;
END:   
     closefile('filename.ext');  //close opened file
}

Note: File with data to be read should be available in the specified path.
         Filename is case sensitive.


See attachment for more screenshots

15
Purpose
To automate Steps in the transaction using URL to minimize user interaction and increase the cost and time savings.

User Interface
Liquid UI for Android & IOS.

Automation via URL
Liquid UI for Android will parse the URL and perform require function depending on tcode, fields value and action definition. All the required information is included in the URL and pass to the SAP. The app requires sap login credentials.

Example:
Open link below in a web browser on your Android/IOS device which has Liquid UI installed.

<a href='sapr3://r3/target?gui=/H/SAPAPPSERVER/S/3600/G/SPACE&client=800&user=username&password=userpassword&language=EN&command=VA03;VBAK-VBELN=ordernumber;enter';>Display Sales Order[/url]
 
You will be navigated to specified SAP transaction with values assigned to fields and actions carried out as specified in the URL.

Note: On IOS you will see a pop up click on "open" on this popup to launch Liquid UI app.

Web URL Parameters
Liquid UI follows its own connection parameter in its URL as below.

sapr3:// :  Tell browser to open link through LUI app
//r3/target?gui : Specify the target server you want to connect
/H/Servername : Application server configuration
/M/Servername : Message server configuration
/S/3224 : Sapproxy Port configuration
Client : specifies Liquid UI Client number such as 800
User : needs to provide user name beside this parameter
Password : needs to provide password beside this parameter
Language : specify the language such as EN
Command : it can be transaction or system command

Example URLs:

Message Server:
<a href='sapr3://r3/target?gui=/M/SAPMSGSERVER/S/3600/G/SPACE&client=800&user=luiuser&password=luipassword&language=EN&command=VA03;enter'>Connect to SAP Message Server[/url]

Application Server
<a href='sapr3://r3/target?gui=/H/SAPAPPSERVER/S/3200&client=800&user=luiuser&password=luipassword&language=EN&command=VA03;enter'>Connect to SAP Application Server[/url]

Note: Liquid UI app will only get connected to SAP if the connection parameters in URL matches with the connection configured on Liquid UI app.

See Attachment for more information and screenshots

Pages: [1] 2 3 4