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 - rajesh.sabbineni

Pages: 1 [2]
16
WS aka Web Scripts (Attended RPA for SAP) / Liquid UI: setcursor
« on: August 18, 2016, 03:57:10 PM »
With setcursor command  you can set the cursor into a certain input field. Below example explains on how to setcursor on appropriate fields.

// Code Sample: User Interface
inputfield( [2,3], "Plant", [2,15],{ "name":"z_plant", "size":4, "required":true});
inputfield( [3,3], "Material", [3,15],{ "name":"z_material", "size":10, "required":true});
inputfield( [4,3], "Stor Loc.", [4,15],{ "name":"z_storloc", "size":4, "required":true});
pushbutton([6,10], "Set Cursor", {"process":setCursor});

if(!isBlank(cursorPosition)) {
   setcursor(cursorPosition);
   cursorPosition = '';
} else {
   setcursor('V[z_plant]');
}

// Function to check required entry and setcursor on appropriate field
function setCursor(){
    if(isBlank(z_plant)){
         message('E: Please enter Plant');
         enter('?');
         goto END;
      }
       if(isBlank(z_material)){
         message('E: Please enter Material');
         set('V[cursorPosition]','V[z_material]');
         enter('?');
         goto END;
      }
       if(isBlank(z_storloc)){
         message('E: Please enter storage location');
         set('V[cursorPosition]','V[z_storloc]');
         enter('?');
         goto END;
      }
      
      END:;
   
}

//Function to check if the field value is blank or not
function isBlank(jvar) {
    if (jvar== void 0 || jvar==null || jvar=="") {
       return true;
    } else {
       return false;
    }
}

see attachments..

17
WS aka Web Scripts (Attended RPA for SAP) / LiquidUI-Retryonerror
« on: August 15, 2016, 12:28:39 PM »
Upon the appearance of an error message adding delay time option in a loop repeatedly activates the "Enter" button until the error message disappears from the current screen. This is particularly useful in a function  following a modifying or complementary transaction, when you call up a further transaction for which the completion of the current transaction is a necessary condition. The system displays an error message until the required modification has been confirmed.

LiquidUI code:

Note: Declare a variable in esession file to start the delay time in seconds.
DELAY = 20;  // start delay time with 20 seconds

Function:
onscreen 'SAPLIQS0.0100'
   i=0;
   enter("/niw51");
RETRY_DELAY:;      
onerror
   i++;
   delaytime = DELAY*i;
   enter(delaytime);      
   goto RETRY_DELAY;

see attachments..



18
On a Liquid UI inputfield we can bring F4 searchhelp display using function module. This method will allow to display custom field values and also restricted search help.

Note: Since F4 search help display will open in a new window, functions should be loaded in esession file.

LiquidUI code:
// Input field Display screen
del("X[IMAGE_CONTAINER]");
inputfield( [2,3], "Plant", [2,10],{ "name":"z_plant", "size":4});
pushbutton([2,15], "@8D@", {"process":getPlantList,"size":[1,2]});

// F4 values display screen
clearscreen();
windowsize([0,2,105,10]);

title("Select Plant");

del("P[Generate]");         // Toolbar Button on Popup
del("P[End Session]");      // Toolbar Button on Popup
del("P[Continue]");         // Toolbar Button on Popup
text('P[Cancel]','@02@Cancel');

if(plantValue.length > 0){
   rowNumber = 0;      // Row Number to start painting controls on the screen
   colNumber = 1;      // Column Number to start painting controls on the screen
   plantNumber = '';
   
   for (var loop=0; loop<plantValue.length; loop++){
      if (colNumber > 100){   // On the screen, if the width of the screen exceeds 100, then draw controls on next row
         rowNumber+=3;
         colNumber=1;
      }
      plantNumber = plantValue[loop].substring(0,4).trim();

      pushbutton([rowNumber,colNumber],plantNumber,{"process":selectPlant, 'using':{'l_plant':plantNumber},"size":[2,5]});
      colNumber+=7;
   }
}


onUIEvents['/12']={"process":exitPopup};
onUIEvents['Enter']={"process":exitPopup};

// Functions
function getPlantList(){
   plantValue = [];
   call("Z_GUIXT_GET_PLANT",{"table.TBL_PLANT":"plantValue"});
   if(plantValue.length > 0){
      enter('/o');
   }
}

function selectPlant(param){
   enter('/12');

   onscreen '*'
      set("V[z_plant]",param.l_plant);
      enter('?');
}
   
function exitPopup(){
   enter('/12');
}

see attachments..

19
WS aka Web Scripts (Attended RPA for SAP) / Liquid UI: Image
« on: April 07, 2016, 03:12:10 PM »
Using image command you can add images on the screen and also you can display images dynamically on the screen

LiquidUI Code:
inputfield ([2,4], "Material", [2,16],{"name":"z_mm01_material", "size":18, "searchhelp":"MAT1"});
pushbutton([4,12], "Display Image", "?");
image([6,10], '&V[z_mm01_material].jpg', {'nostretch':true});


see attachments..

20
Values can be passed between sessions as a parameter by using "using" option.

Note: When you are passing values between sessions. Function should be loaded in esession file since we are opening a new session.

LiquidUI code:
pushbutton([TOOLBAR], "Pass Values", "/oiw31",{"process":open_new_session, "using":{"z_order_type":"PM01" }});

//Initiate functions in esession file
load('functions_iw31.sjs');

// Function to pass the value - functions_iw31.sjs
function open_new_session(param){
   onscreen 'SAPLCOIH.0100'
    set('F[Order Type]', param.z_order_type);
   enter('?');
}

 Refer to below link for more details on using option
http://www.guixt.com/forum/index.php?topic=58.0


see attachments..

21
WS aka Web Scripts (Attended RPA for SAP) / Liquid UI: Table manipulation
« on: February 05, 2016, 11:42:25 AM »
Table attributes can be changed using the following commands

LiquidUI Code:

// Samples for changing  table attributes

//Changing column width
columnwidth("[All items, Material]", 4);

//Changing name of the column
columnheader("[All items, Material]", "Product");

//Changing the order of the column
columnorder("[All items, Material]", 3);

//Making a column non editable
noinput("[All items, Material]");

//Making a table non editable
noinput("[All items]");


See attached document for details

22
WS aka Web Scripts (Attended RPA for SAP) / Search value in an array
« on: January 29, 2016, 04:36:15 PM »
You can search for a value in an array using the custom find function-

// Code Sample: User Interface
inputfield ([2,4], "Taxable State", [2,18],{"name":"z_state", "size":2});
pushbutton([4,4], "Validate State",{"size":[1,15], "process":validate_state});

//Array with values
var stateArray = ["AK","FL","NV","NH","SD","TN","TX","WA","WY"];  // Non taxable states

// Function to return true or false if the search element is found in the array
Array.prototype.find = function (p){
   for(i=0;i<this.length;i++)   if(this == p) return true;
   return false;
}

//Function to check the value
function validate_state(){
   if(stateArray.find(z_state)){   
      return('E: Please enter taxable state');
   }
}

see attachments

23
WS aka Web Scripts (Attended RPA for SAP) / Get today's date
« on: January 28, 2016, 04:18:51 PM »
Get today's date in user's date format


// Code Sample: User Interface

inputfield ([2,4], "Date", [2,16],{"name":"z_todaydate", "size":10});
pushbutton([4,8], "Get Today's Date","/nsu3",{"size":[2,22], "process":today_date});

// Function to get user formatted date

function today_date(){
// Maintain User Profile
onscreen 'SAPLSUU5.0100'
   enter('=DEFA');

// Maintain User Profile
onscreen 'SAPLSUU5.0100'
   set("V[z_dateformat]", "&F[Date format]");
   z_dateformat = z_dateformat.trim();   
   z_todaydate = getTodaysDate(z_dateformat);               
   enter('/n');   

}

////////////////////////////////////////////////////////////////////////////////////////////
//Function prototypes, to remove blank spaces from variable values
////////////////////////////////////////////////////////////////////////////////////////////
String.prototype.trim = function() {
   return this.replace(/^\s+|\s+$/g,"");
}


////////////////////////////////////////////////////////////////////////////////////////////
//Function to get todays date and convert the date to users date format
////////////////////////////////////////////////////////////////////////////////////////////
function getTodaysDate(dformat) {
   var z_date = new Date();
   println(">>>>>>>>>>>>>>>>>",z_date);
   var str = "";
   switch(dformat)
   {
      case '1':
      {
         str = padString(z_date.getDate(),2,PADDING_LEFT,"0") + "." + padString((z_date.getMonth()+1),2,PADDING_LEFT,"0") + "." + z_date.getFullYear();
      }
      break;
      
      case '2':
      {
         str = padString((z_date.getMonth()+1),2,PADDING_LEFT,"0") + "/" + padString(z_date.getDate(),2,PADDING_LEFT,"0") + "/" + z_date.getFullYear();
      }
      break;

      case '3':
      {
         str = padString((z_date.getMonth()+1),2,PADDING_LEFT,"0") + "-" + padString(z_date.getDate(),2,PADDING_LEFT,"0") + "-" + z_date.getFullYear();
      }
      break;

      case '4':
      {
         str = z_date.getFullYear() + "." + padString((z_date.getMonth()+1),2,PADDING_LEFT,"0") + "." + padString(z_date.getDate(),2,PADDING_LEFT,"0");
      }
      break;

      case '5':
      {
         str = z_date.getFullYear() + "/" + padString((z_date.getMonth()+1),2,PADDING_LEFT,"0") + "/" + padString(z_date.getDate(),2,PADDING_LEFT,"0");
      }
      break;
      
      case '6':
      {
         str = z_date.getFullYear() + "-" + padString((z_date.getMonth()+1),2,PADDING_LEFT,"0") + "-" + padString(z_date.getDate(),2,PADDING_LEFT,"0");
      }
      break;
      case '7':
      {
         str = padString(z_date.getDate(),2,PADDING_LEFT,"0") + padString((z_date.getMonth()+1),2,PADDING_LEFT,"0") +z_date.getFullYear();
      }
      break;
   }
   println(str);
   return str;
}

////////////////////////////////////////////////////////////////////////////////////////////
//Function to pad a string with characters
////////////////////////////////////////////////////////////////////////////////////////////
const PADDING_LEFT = 0;
const PADDING_RIGHT = 1;
function padString(source,length,direction,character) {
   var loop;
   var output = "";
   var sourceLength = 0;
   set('V[z_source]',source);
   if(z_source) {
      sourceLength = z_source.length;
   }
   
   switch(direction) {
   case PADDING_LEFT:
      for(loop = 0; loop < (length - sourceLength); loop++) {
         output += character;
      }
      output = output + z_source;
      break;
      
   case PADDING_RIGHT:
      for(loop = 0; loop < (length - sourceLength); loop++) {
         output += character;
      }
      output = z_source + output;
      break;
   }
   return output;
}

24
WS aka Web Scripts (Attended RPA for SAP) / LiquidUI:Dropdownlist
« on: January 27, 2016, 04:59:10 PM »
dropdownlist command (also called combobox) creates or modifies dropdown lists on SAP screens. Below example explains on how to restrict dropdownlist values and execute a function automatically when a value is selected from the dropdownlist

LiquidUI Code:

// Sample User Interface in MM01 transaction
set("V[mylist]", "=--- Select Industry Type ---;B=Beverage;C=Chemical Industry;M=Mechanical Engineering;");
dropdownlist([10, 0], "mylist", {"refer":"F[Industry sector]", "width":30,"process":test_dropdown});


// Sample Function
function test_dropdown(){
   set("F[Industry sector]", z_ordertypeselected);
   set("F[Material Type]", "FERT");
   enter();
}

See attached document for details

25
WS aka Web Scripts (Attended RPA for SAP) / Liquid UI: SearchHelp
« on: January 27, 2016, 12:24:28 PM »
Below example explains about how to display search help for liquid UI field  and additional search help options

Liquid UI Script:

del("X[IMAGE_CONTAINER]");

\\Basic Searchhelp:
inputfield ([2,4], "Sales Org.", [2,16],{"name":"z_va01_salesorg", "size":4, "searchhelp":"H_TVKO"});
inputfield ([4,4], "Mat Grp.", [4,16],{"name":"z_mm01_matgrp", "size":3, "techname":"MARA-MATKL"});

\\Restricted search help with a default value:
inputfield ([6,4], "Material", [6,16],{"name":"z_mm01_material", "size":18, "searchhelp":"MAT1", "shselname1":"WERKS", "shselvalue1":"1000"});

\\Restricted search help with dynamic value:
inputfield ([8,4], "Plant", [8,10],{"name":"z_mm01_plant", "size":4});
inputfield ([8,17], {"name":"z_mm01_material", "size":18, "searchhelp":"MAT1", "shselname1":"WERKS", "shselvalue1":"V[z_mm01_plant]","nolabel":true});

\\Retrieve description associated with the selection:
inputfield ([10,4], "Industry Sector", [10,18],{"name":"z_mm01_indsec", "size":2, "searchhelp":"H_T137","shname1":"MBBEZ", "shdest1":"V[z_mm01_inddesc]"});
inputfield ([10,23], {"name":"z_mm01_inddesc", "size":8,"nolabel":true});

See attached document for details

26
WS aka Web Scripts (Attended RPA for SAP) / Logging Capability
« on: January 21, 2016, 09:15:19 PM »
Liquid UI: Logs can be generated to debug user issues

Step 1: User Interface [ Navigate to MM01 ]
Enter the information and click on create material button to generate log file
Variable ENABLE_FILE_LOGGING is used to turn on the logging option

set('V[ENABLE_FILE_LOGGING]',true);
pushbutton([22,54], "@2L@Create Material", { "process":mm01_create_material});

Step 2: Successful log creation in the specified path. Initiatelogfile function is used to create a file and logToFile function is used to write to a log file
function initiateLogFile(strDir,strProcess) {
   if(ENABLE_FILE_LOGGING) {      // Global variable for enabling logging, set to TRUE based on URL parameter 'mode'
      var d = new Date();
      mm = d.getMonth()+1;
      if(mm<10) mm='0'+mm;   // Convert to 2 characters month for months 1-9
      dd = d.getDate();
      if(dd<10) dd='0'+dd;   // Convert to 2 characters date for dates 1-9
      
      dt = mm.toString() + dd.toString() + d.getFullYear().toString();   // Date Stamp
      thr = d.getHours();
      if(thr<10) thr='0'+thr;   // Convert to 2 characters hours for hours 1-9
      tmin = d.getMinutes();   
      if(tmin<10) tmin='0'+tmin;   // Convert to 2 characters minutes for minutes 1-9
      tsec = d.getSeconds();
      if(tsec<10) tsec='0'+tsec;   // Convert to 2 characters seconds for seconds 1-9
      
      tm = thr.toString() + tmin.toString() + tsec.toString(); // Time Stamp
      ts = dt + '_' + tm;   // Date & Time Stamp
      var z_filename = strDir + _user.toString().trim()+"_"+ts+"_"+ strProcess + ".txt";
      openfile(z_filename, {"output": true});   
      return z_filename;
   }
}

function logToFile(strFileName, strIdentifier, strValue) {
   if(ENABLE_FILE_LOGGING) {
      var z_system_datetime = new Date();
      logStr = z_system_datetime + ':' + strIdentifier + ':' + strValue;
      appendfile(strFileName, {logStr:true});         
   }
}


function mm01_create_material(){
   set("V[z_mm01_error]","");
   var logFileName;
   logFileName = initiateLogFile('C:\\TEMP\\GuiXT Cache\\','CreateMaterial');
    // Constructed File Name would be C:\\TEMP\\GuiXT Cache\\<UserName>_<DateTimeStamp>_CreateMaterial.txt
   // Example: C:\\TEMP\\GuiXT Cache\\test1_10102014_121234_CreateMaterial.txt
   
// Create Material (Initial Screen)
onscreen 'SAPLMGMM.0060'
logToFile(logFileName, 'Navigating to', 'Selecting Views');
enter('/5');

// Create Material (Initial Screen)
onscreen 'SAPLMGMM.0070'
logToFile(logFileName, 'Inside Screen', 'Selecting Views');
set('Cell[Table,0,1]', 'X');
set('Cell[Table,0,4]', 'X');
set('Cell[Table,0,6]', 'X');
set('Cell[Table,0,12]', 'X');
set('Cell[Table,0,13]', 'X');
set('Cell[Table,0,14]', 'X');
enter('/6');

// Create Material (Initial Screen)
onscreen 'SAPLMGMM.0080'
logToFile(logFileName, 'Inside Screen', 'Organizational levels');
set('F[Plant]', '&V[z_mm01_plant]');
set('F[Stor. Location]', '&V[z_mm01_storloc]');
set('F[Sales Org.]', '1000');
set('F[Distr. Channel]', '10');
enter();

// Create Material 68999 (Finished product)
onscreen 'SAPLMGMM.4004'
logToFile(logFileName, 'Inside Tab',  'Basic Data 1');
set('V[z_mm01_material]', "&F[Material]")
set('F[MAKT-MAKTX]', '&V[z_mm01_desc]');
set('F[Base Unit of Measure]', '&V[z_mm01_buom]');
set('F[Material Group]', '&V[z_mm01_matgrp]');
enter('=SP04');
onmessage
      if(_message.substring(0,2) == "E:"){
         set("V[z_mm01_error]",_message);
         message(z_mm01_error);
         logToFile(logFileName, 'Basic Data 1', 'Error:' + _message);
         enter("/nmm01")
         goto end_function;
      } else {
         logToFile(logFileName,'Basic Data 1', 'Warning:' + _message);      
         enter();
      }

// Create Material 68999 (Finished product)
onscreen 'SAPLMGMM.4000'
logToFile(logFileName, 'Inside Tab', 'Sales Org. 1');
set('cell[TABLE,5,1]', '1');
set('cell[TABLE,5,2]', '1');
enter('=SP06');
// Create Material 68999 (Finished product)
onscreen 'SAPLMGMM.4000'
logToFile(logFileName, 'Inside Tab', 'Sales General/Plant');
set('F[Trans. Grp]', '0001');
set('F[LoadingGrp]', '0001');
enter('=SP12');
onmessage
      if(_message.substring(0,2) == "E:"){
         set("V[z_mm01_error]",_message);
         message(z_mm01_error);
         logToFile(logFileName, 'Sales General/Plant', 'Error:' + _message);
         enter("/nmm01")
         goto end_function;
      } else {
         logToFile(logFileName,'Sales General/Plant', 'Warning:' + _message);      
         enter();
      }

// Create Material 68999 (Finished product)
onscreen 'SAPLMGMM.4000'
logToFile(logFileName, 'Inside Tab', 'MRP Type 1');
set('F[MRP Type]', '&V[z_mm01_mrptype]');
enter('=SP13');

// Create Material 68999 (Finished product)
onscreen 'SAPLMGMM.4000'
logToFile(logFileName, 'Inside Tab', 'MRP Type 2');
if (z_mm01_blkmat=='X')
set('C[Bulk Material]', 'X');
set('F[SchedMargin key]', '000');
enter('=SP14');

// Create Material 68999 (Finished product)
onscreen 'SAPLMGMM.4000'
logToFile(logFileName, 'Inside Tab', 'MRP Type 3');
set('F[Availability check]', '01');
z_mm01_material = z_mm01_material.trim();
logToFile(logFileName, 'Material',z_mm01_material+'Successfully Created');
closefile(logFileName, {"output": true});
set ("V[z_mm01*]", '');
enter('/11');

end_function:;
closefile(logFileName, {"output": true});
}
 
See attachments for code samples

Pages: 1 [2]