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 - Benjamin Dasari

Pages: 1 2 [3] 4 5 ... 7
31
WS aka Web Scripts (Attended RPA for SAP) / Liquid UI - "box" command
« on: September 19, 2017, 02:51:15 PM »
Purpose:
The box command is used to create boxes around groups of elements.
The box command enables users to create boxes for either single screen element or a group of elements.
This command is very useful when a user wishes to create a cleaner interface and enclose SAP elements into a single group.

The syntax is as follows:
   box([row_start,column_start],[row_end,column_end], "Field label");
   
Options:
The box command takes the one option called "offset".
This option specifies by how many rows and columns the box will be offset.
Offset is relative to the screen margin so we need to specify by how much the box will be offset from the screen margin.

The syntax is as follows:
   box( {"offset":[row_start,column_start]}, {"offset":[row_end,column_end]}, "Label");

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMV45A.E0101.sjs       // VA01 transaction
----------------------------------------------------------------------------------------------------------------------------------------------
// Creating custom group box
box([11,0], [15,61], "Custom Groupbox");


See attachments for code samples!

32
WS aka Web Scripts (Attended RPA for SAP) / Liquid UI - "boxsize" command
« on: September 19, 2017, 02:32:27 PM »
Purpose:
The boxsize command is used to resize native SAP group boxes.

The syntax is as follows:
   boxsize("G[box_name]",[rows,columns]);
   
NOTE: The windowsize command does not take any options.   
The boxsize command is only for native SAP screen controls - it cannot be used on Liquid UI screen controls.

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMV45A.E0101.sjs       // VA01 transaction
----------------------------------------------------------------------------------------------------------------------------------------------
// Resizing the group box
boxsize("G[Organizational Data]",[10,65]);


See attachments for code samples!

33
Purpose:
The nodropdownlist changes dropdown lists into inputfields.
This is especially useful if users prefer direct input into SAP fields.
By using this command, users can change the screen element into a direct-entry field.

The syntax is as follows:
   nodropdownlist("F[screenElementName]");
   
NOTE: The nodropdownlist command does not take any options.   

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLMGMM.E0060.sjs            // MM01 Transaction
----------------------------------------------------------------------------------------------------------------------------------------------
nodropdownlist("F[Material Type]");


See attachments for code samples!

34
Purpose:
The fieldsize command restricts character entry on native SAP and Liquid UI fields.
The fieldsize command works both on native SAP fields and on user-created fields.
It is restricted to standard SAP editable fields.

The syntax is as follows:
   fieldsize("F[fieldName]", n);
   
NOTE: The fieldsize command cannot be used to increase a field's size to be greater than the original size - it can only make a field smaller.

Options:
The fieldsize command takes the one option called "scrollable".
The scrollable option specifies if the resized field will or will not be scrollable by the user. What this means in practice is that if the field is originally 20 characters and the user specifies that the new fieldsize will be only 10, applying the scrollable options enables the user to enter up to the original twenty characters.

The syntax is as follows:
       {"scrollable":true}

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMV45A.E0102.sjs    // VA02 transaction
----------------------------------------------------------------------------------------------------------------------------------------------
fieldsize("F[Order]",5);                               // To reduce the length of the field to size 5
fieldsize("F[Order]",5, {"scrollable":true});  // To reduce the length of the field to size 5, however user can enter upto the original length of the field


See attachments for code samples!

35
WS aka Web Scripts (Attended RPA for SAP) / Multi language Support
« on: August 25, 2017, 10:48:09 AM »
Purpose:
There are two ways to handle different languages in Liquid UI Scripts:
1. You maintain a distinct set of scripts for each language.
2. You work with one set of scripts, covering all languages within the script.

Here we describe the 2nd possibility.
An advantage of the 2nd  approach is that you can simplify your maintenance work: You can split each script into a language independent part in which you delete and rearrange fields, set defaults etc, and a language specific part in which you rename fields or add new texts.

A disadvantage is that you have to use the technical field names in the language independent part.

In the Liquid UI Configuration file, i.e., guixt.sjs we specify the below option:
nolanguagekey = true;

NOTE:
1. Make sure to specify "nolanguagekey = true;" in guixt.sjs file.
2. Make sure to use the technical names of the screen elements in the scripts to use it for multiple languages.
3. These files will be affected:
  <key>SESSION.SJS, <key>LOGON.SJS, SAPLSMTR_NAVIGATION.<KEY>0100.sjs,DOMTEXT.<KEY>.txt and dom.<KEY>.domain.txt
  If nolanguagekey is true, <key> will not be used in these files.
  In the case of DOM, the new filenames are DOMTEXT.txt and dom.domain.txt

Liquid UI now searches the scripts without a language key, e.g. instead of "SAPMV45A.E0101.sjs" it reads the file "SAPMV45A.0101.sjs" [OR] instead of "ESESSION.sjs" it reads "SESSION.sjs".

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.0100.sjs   // Notice the name of the file specified without the language key
----------------------------------------------------------------------------------------------------------------------------------------------
// Read an inputfield using technical name and display multi language support
function readBOMApplication(){
   onscreen "SAPLSMTR_NAVIGATION.0100"
      enter("/nIH01");
   
   onscreen "RIIFLO10.1000"
      set("V[z_ih01_bomappl]","&F[DY_CAPID]");    // "BOM Application" field
      enter("/n");
}

// User Interface
clearscreen();
box([2,2],[8,30]);
inputfield([3,4], "BOM Application", [3,20], {"name":"z_ih01_bomappl", "size":4});
pushbutton([5,4], "Test MultiLanguage Support", "?", {"process":readBOMApplication, "size":[2,24]});


See attachments for code samples!


36
Purpose:
The "globaltextreplace" command replaces user-specified text throughout an SAP environment.
This command can be used either to perform the replacement on all screens, or users can specify screens that can
be either included or excluded from the replacement process.
Please note that if you are replacing a hex number, you must isolate the term by preceding it with the caret mark (^).

NOTE:
You must have the "wsoffice.dll" loaded in order to use this command.
Also recommend using this command in the 'esession.sjs' script file.

Syntax:
// In case of Single Screen
globaltextreplace(/TextToBeReplaced/,'ReplacementText',{"ocx":true, "listscreen":false,"screen":"DynProName"});

// In case of Multiple Screens
globaltextreplace(/TextToBeReplaced/,'ReplacementText',{"ocx":true, "listscreen":false,"screen":["DynProName1","DynProName2"]});
[OR]
globaltextreplace(/TextToBeReplaced/,'ReplacementText',{"ocx":true, "listscreen":false});

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
load("wsoffice.dll");

// Function for Single Screen Global Text Replace
function z_globalTextReplace_singleScreen(){
   onscreen "SAPMV45A.0102"
      globaltextreplace(/Order/, 'Request', {"ocx":true, "listscreen":false, "screen":["SAPMV45A.0102"]});
      enter("?");
}

// Function for Multi Screen Global Text Replace [Do not specify "screen" option]
function z_globalTextReplace_multiScreen(){
   onscreen "SAPMV45A.0102"
      globaltextreplace(/Order/, 'Request', {"ocx":true, "listscreen":false});
      enter("?");
}

// User Interface
pushbutton([TOOLBAR], "GTR - Single Screen", "/nVA02", {"process":z_globalTextReplace_singleScreen});
pushbutton([TOOLBAR], "GTR - Multi Screen", "/nVA02", {"process":z_globalTextReplace_multiScreen});


See attachments for code samples!


37
Purpose:
Use the enter command to execute on an ActiveX control.
This command can be directly copied from "Cornelius" output window of Liquid UI.

When user clicks on the selection in Standard SAP, the command is generated in the output (Cornelius) window which can be directly copied and used.
The below example is executing CN42N transaction, where the "Details" and "Export->Local file" buttons are being clicked in the background through the below functions.

NOTE:
// onUIEvent on an OCX control can also be obtained from "Cornelius" output window of Liquid UI.
// Syntax formats: Separated by semicolon AND commas
onUIEvents["%_GC DOCKINGCTRL.TableTreeControl 35@[0001;Column01,]"]= z_process_treecontrolclick;
onUIEvents["%_GC DOCKINGCTRL.TableTreeControl 35@[0001;Column01,]"]= {'process':z_process_treecontrolclick};
onUIEvents["%_GC DOCKINGCTRL.TableTreeControl 35@[0001;Column01,]"]= {'fcode':"/niw21",'process':z_process_treecontrolclick};
onUIEvents["%_GC DOCKINGCTRL.TableTreeControl 35@[0001;Column01,,0\\1]"]= z_process_treecontrolclick;


Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
// Function is called when clicked on "Details" Toolbar pushbutton
function clickDetails(){
   onscreen 'SAPLSMTR_NAVIGATION.0100'
      enter("/nCN42N");   

   onscreen 'SAPLCNIS.0600'
      set('F[Database prof.]', '000000000001');
      enter();
   
   onscreen 'RPSISPD000.1000'
      set('F[Project]', 'I/2302');
      set('F[Layout]', '1SAP');
      enter('/8');
   
   onscreen 'SAPLPSIS_SINGLE01.0100'
      enter({'control':'CONTAINERCTRL.GridViewCtrl','item':'&DETAIL','event':10});      
}

// Function is called when exporting local file on "CN42N" transaction
function exportLocalFile(){
   onscreen 'SAPLSMTR_NAVIGATION.0100'
      enter("/nCN42N");   

   onscreen 'SAPLCNIS.0600'
      set('F[Database prof.]', '000000000001');
      enter();
   
   onscreen 'RPSISPD000.1000'
      set('F[Project]', 'I/2302');
      set('F[Layout]', '1SAP');
      enter('/8');
   
   onscreen 'SAPLPSIS_SINGLE01.0100'
      enter({'control':'CONTAINERCTRL.GridViewCtrl','item':'&MB_EXPORT;1139;159','event':11});      
   
   onscreen 'SAPLPSIS_SINGLE01.0100'
      enter({'control':'CONTAINERCTRL.GridViewCtrl','item':'&PC','event':14});         
}

// User Interface - Pushbuttons on TOOLBAR
pushbutton([TOOLBAR],"Details",{"process":clickDetails});
pushbutton([TOOLBAR],"Local File",{"process":exportLocalFile});


See attachments for code samples!

38
Purpose:
Variable based function calling can be used to change the function name at one place even though it is used at multiple places in a file.

In the below example, if we need to change the name of the function; even though the function is called thrice, we just need to change it at one place i.e., wherever we have initialized it.

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
var myfunction = "variableFunction";

function variableFunction(param){
   onscreen 'SAPLSMTR_NAVIGATION.0100'
      enter("/n"+param.l_screen);
}

// User Interface
clearscreen();
pushbutton([1,4], "VA01", "?", {"size":[2,20], "process":eval(myfunction), "using":{"l_screen":"VA01"}});
pushbutton([4,4], "MM01", "?", {"size":[2,20], "process":eval(myfunction), "using":{"l_screen":"MM01"}});
pushbutton([7,4], "CS01", "?", {"size":[2,20], "process":eval(myfunction), "using":{"l_screen":"CS01"}});


See attachments for code samples!


39
Purpose:
Re-size or re-position popup windows in SAP.
The windowsize command is used to re-size or re-position onscreen popup windows in SAP.

The syntax is as follows:
   windowsize([startRow, startCol, width, height]);
   
NOTE: The windowsize command does not take any options.   

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: RSM04000_ALV_NEW.E2000.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
// "/o" - Session Popup
windowsize([15,4,80,12]);

See attachments for code samples!


40
Purpose:
The buttonsize command enables users to change the size of a given SAP pushbutton.
The buttonsize command enables both width and height of a given button to be changed.
The buttonsize command does not take any options.

The syntax is as follows:
   buttonsize("P[buttonName]", [rows, columns]);

NOTE: The buttonsize command can only be used on native pushbuttons.
The rows and columns in the command syntax identify the size of the resulting button,
not the start row and column.

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMV45A.E0102.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
// VA02 Transaction
buttonsize("P[Search]", [2,25]);

See attachments for code samples!


41
Purpose:
To check if File of any type exists in a specified path location.
Used for validation before/after performing additional steps.

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
// User Interface
load('wsoffice');         // Need to load this file to use for ActiveXObject
del("X[IMAGE_CONTAINER]");   // Clear the SAP Easy Access screen
text([1,1],"Enter File Path in the format- Directory:\\Folder1\\Folder2\\...\\Filename", {"comment":true});
inputfield([2,1], "File Path", [2,15], {"name":"z_file_path", "size":40, "maxlength":100});
inputfield([3,15], {"name":"z_file_path_res", "size":20, "nolabel":true});
pushbutton([2,60],"@8T@Validate File", "?", {"process":validateFileInPath, "using":{"p_type":z_file_path}});

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

// 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);
}

// File Validation in the path specified
function validateFileInPath(param){
   var str = "";
   if(isBlank(z_file_path)){
      message("E: Please enter the File Path");
      set("V[z_file_path_res]", "");
      enter("?");
      goto END;
   }   

   set("V[str]", param.p_type);
   str = str.replace(/\\/g,"\\\\");
   var fso = new ActiveXObject("Scripting.FileSystemObject");
   if(fso.FileExists(str)){      
      set("V[z_file_path_res]", "FILE EXISTS");
   } else{
      set("V[z_file_path_res]", "FILE DOES NOT EXISTS");
   }   
   enter("?");

   END:;   
}


See attachments for code samples!


42
Purpose: Scroll through Liquid UI table to read details from user selected row.

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
// User Interface
del("X[IMAGE_CONTAINER]");

var item_array = ['10','20','30','40','50','60'];
var material_array = ['L-10Y','100-300','L-80F','CP-100','C-200','L-200'];
var plant_array = ['1000','1200','1300','1400','2500','3000'];
           
// Liquid UI Table
table([1,3], [10,27], {"name":"z_table", "title":"Material List", "rows":10, "singlerowselection":true, "readonly":true});
column("Item", {"position":1, "table":"z_table", "name":"z_itemcolumn", "size":4, "readonly":true});
column("Material", {"position":2, "table":"z_table", "name":"z_matcolumn", "size":9, "maxlength":18, "readonly":true});
column("Plant", {"position":3, "table":"z_table", "name":"z_plantcolumn", "size":4, "readonly":true});     

inputfield([5,30], "Item", [5,40], {"name":"z_va0x_item", "size":3});
inputfield([6,30], "Material", [6,40], {"name":"z_va0x_mat", "size":18});
inputfield([7,30], "Plant", [7,40], {"name":"z_va0x_plant", "size":4});

pushbutton([1,30], "Clear Selection", {"process":deSelect});
pushbutton([4,30], "Read  Selection Details", {"process":readSelection});

// Populating Data

for(j=0;j<material_array.length;j++){
   z_table.z_itemcolumn[j] = item_array[j];
   z_table.z_matcolumn[j] = material_array[j];
   z_table.z_plantcolumn[j] = plant_array[j];      
}   

// Function to clear the row selection
function deSelect(){
   onscreen '*'
      for(j=0; j<item_array.length; j++){   
         z_table.selectedrows = " ";      // Deselect line items
      }
      set("V[z_va0x_*]","");
      enter('?');   
}

// Function to read the selection details (Material in this case)
function readSelection(){
   onscreen '*'
      for(j=0; j<z_table.selectedrows.length; j++){
         if(z_table.selectedrows[j] == "X"){
            set("V[z_va0x_item]",z_table.z_itemcolumn[j]);
            set("V[z_va0x_mat]",z_table.z_matcolumn[j]);
            set("V[z_va0x_plant]",z_table.z_plantcolumn[j]);
            break;      
         } else{
            if(i == z_table.selectedrows.length){
               break;
            }
         }
      }
      enter('?');   
}


See attachments for code samples!


43
Purpose: Use relative positioning to re-arrange screen elements.
Below example re-arranges "Order type" field relative to position of "Sales Organization" field.
Syntax for 2 different ways of accomplishing relative positioning on VA01 transaction screen.

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMV45A.E0101.sjs
----------------------------------------------------------------------------------------------------------------------------------------------

// Syntax 1 - Using Offset Option
pos('F[Order Type]',{"field":"F[Sales Organisation]","offset":[11,1]});

// Syntax 2
pos('F[Order Type]',"F[Sales Organisation]+[11,1]");

44
Purpose: Restrict user selection from menu items by deleting/hiding all menu items.

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------
// Function to hide all Menu items on SAP screen
function deleteAllMenuItems() {
   for(i=1;i>0;i++) {
      for(j=1;j>0;j++) {
         if(!<'M['+i+','+j+']'>.isValid)   break;
         del('M['+i+','+j+']');
      }
      j = 1;
      if(!<'M['+i+','+j+']'>.isValid)   break;
   }
}

// Call the function on the screen where the menu items should be hidden/disabled
deleteAllMenuItems();       

45
Purpose: To check if an SAP screen element is read-only or not.

isprotected - Will return 1 if it is read-only and 0 if it is editable.
Syntax:
if(<"F[LIKP-BLDAT]">.isprotected)       // Checks the 'Document Date' field on the Picking screen. If it is read-only then Document already posted
     set("V[z_vl02n_docdatestatus]","X");   


NOTE - Below is the link of another forum article where it is used:
http://www.guixt.com/forum/index.php?topic=81.msg85#msg85

Pages: 1 2 [3] 4 5 ... 7