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 - Vivek Indripala

Pages: [1]
1
Purpose: Delete the Specified Integer from an Array.

Liquid UI Code:

var found;
var position;
var num = [23,65,89,54,74];
var num_tobe_deleted = 54;
var array_length = num.length;

println("The Array Elements = [23,65,89,54,74]");
println("The given number to be deleted is = "+num_tobe_deleted);
for (var m = 0; m < array_length; m++)
   {
      if (num[m] == num_tobe_deleted)
      {
         found = 1;
         position = m;
         break;
      }
   }                  

if (found == 1)
   {
      for (var k = position; k <  array_length - 1; k++)
      {
         num[k] = num[k + 1];
      }

      println("The resultant Array after deleting the number is = "+num_tobe_deleted);
      for (var z = 0; z < array_length - 1;z++)
      {   
         println(num[z]);
      }

   }
   else {
      println("This number is not found", num_tobe_deleted);
   }

2
Purpose: Calculate Sum & Average of elements in Array.

Liquid UI Code:

var array_sum = 0; 
var averge;
var num = [23,65,89,54,74];
var array_length = num.length; 
for(var k=0;k<num.length;k++)
   {          
      if(num[k] > 0)
         {
            array_sum = array_sum + num[k];      
         }   
}      
average = array_sum/array_length;     
println("Sum of integers in Array="+array_sum);
println("Average of Integers in Array="+average);

3


Purpose:
To Read Table data to excel.

Pre-Requisites:
1.Load wsoffice library load('wsoffice.dll');


Liquid UI Code :

/////////////////////////////////// SAPLSMTR_NAVIGATION.E0100 ////////////////////////////////


load('wsoffice.dll');
del("X[IMAGE_CONTAINER]"); 
inputfield( [1,2], "Order", [1,22],{ "name":"z_message_info","shname":"VBELN", "size":16, "searchhelp":"VMVA"});
pushbutton([1,45], "Get Data to Excel","?",{  "process":z_AssigntoSAPTbale,"size":[1,15],"using":{"z_message_info":z_message_info}});


table([5,5],[15,45],{"name":"va01_AllItems","title":"All items", "rows":10, "rowselection":true,"columnselection":true});
column('Item',{"table":"va01_AllItems","size":4,"name":"z_va01_item","position":1});
column('Material',{"table":"va01_AllItems","size":15,"name":"z_va01_material","position":2});
column('Order Quantity',{"table":"va01_AllItems","size":15,"name":"z_va01_Orderquantity","position":3});


function z_AssigntoSAPTbale(param){
 
   println(param.z_message_info); 
   temp_items=[];
   temp_material=[];
   temp_quantity=[];
   enter('/nva02');

   onscreen 'SAPMV45A.0102'
      set('F[Order]', "&V[z_message_info]");
      enter();
   
   
   onscreen 'SAPMSDYP.0010'
      enter();
   
   onscreen 'SAPMSDYP.0010'
      enter();
   
   onscreen 'SAPMV45A.4001'
      absrow = 1;
      relrow = 1;   
      gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow"});
      if(FVisRow==1) {
         goto new_row;
      }   
      enter("/ScrollToLine=&V[absrow]", {"table":"T[All items]"});       
      new_screen:;
   
   onscreen 'SAPMV45A.4001'   
      gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow"});   relrow = 1;
      new_row:;
     if(absrow>LVisRow){
         enter("/ScrollToLine=&V[absrow]", {"table":"T[All items]"});
         goto new_screen;
      }
      if(absrow>LastRow){
         goto end_of_table;
      }
                                                                  
      set("V[z_va01_item]","&cell[All items,Item,&V[relrow]]");
      set("V[z_va01_mat]","&cell[All items,Material,&V[relrow]]");
      set("V[z_va01_OQ]","&cell[All items,Order Quantity,&V[relrow]]");
      println('The item Data is '+z_va01_item+':');
      println('The Material Data is '+z_va01_mat+':');
      println('The Order Quantity Data is '+z_va01_OQ+':');                
      temp_items.push(z_va01_item);
      temp_material.push(z_va01_mat);
      temp_quantity.push(z_va01_OQ);   
   
     
      absrow++;
      relrow++;
      goto new_row;
      end_of_table:;     
      enter("/ScrollToLine=1", {"table":"T[All items]"});    
      enter("/n");    
   
   
   onscreen 'SAPLSMTR_NAVIGATION.0100'   
      gettableattribute("T[va01_AllItems]", {"firstvisiblerow":"FisRow", "lastvisiblerow":"LisRow", "lastrow":"LatRow"});   
      var z=1;
   
      for(var m=0;m<=temp_items.length;m++)
      {             
         va01_AllItems.z_va01_item[m] = temp_items[m];
         va01_AllItems.z_va01_material[m] = temp_material[m];
         va01_AllItems.z_va01_Orderquantity[m] = temp_quantity[m];         
         z=z+1;

      }        
      copy_To_Excel(temp_items,temp_material,temp_quantity)
      enter("?"); 
}

 function copy_To_Excel(temp_items,temp_material,temp_quantity)
{
   
   var ExcelApp = new ActiveXObject("Excel.Application");
   var ExcelSheet = new ActiveXObject("Excel.Sheet");   
   ExcelSheet.ActiveSheet.Cells(1,1).Value = "Items";
   ExcelSheet.ActiveSheet.Cells(1,2).Value = "Materials";
   ExcelSheet.ActiveSheet.Cells(1,3).Value = "Quantity";         
   var k=0;
   for(p=2;p<temp_items.length;p++) {     
      ExcelSheet.ActiveSheet.Cells(p,1).Value = temp_items[k];
      ExcelSheet.ActiveSheet.Cells(p,2).Value = temp_material[k];
      ExcelSheet.ActiveSheet.Cells(p,3).Value = temp_quantity[k];     
      k=k+1;
   }   
   var str = "C:\\LiquidUI\\scripts\\TEST.XLS";     
   var fso = new ActiveXObject("Scripting.FileSystemObject");   
   if(fso.FileExists(str)){     
      message("E:FILE ALREADY EXISTS PLEASE REMOVE OLD FILE");
   }
   else{     
      ExcelSheet.SaveAs(str);   
      ExcelSheet.Application.Quit();

   }     
}     
 

4
Purpose:
Read List-screen data to excel.


Pre-Requisites:
1.Load wscurl library  load('wsoffice.dll');

In Below example data from column "Document" of listscreen is read into an Excel file by using position in set command.


Liquid UI Code :

/////////////////////////////////// RVKRED01.E0120.sjs ////////////////////////////////

load('wsoffice.dll');
pushbutton( [TOOLBAR], "scroll  ",{ "process": z_readfromlist });

function z_readfromlist(){    

       z_doc  = [];
       z_doc1 = [];
       z_doc2 = [];   
       lfvrow = 1;

      onscreen 'RVKRED01.0120'
              SCROLL_NEXT:;
              enter("/scrolltoline=&V[lfvrow]");
     
      onscreen 'RVKRED01.0120'
              enter("/hscrollto=0");


     if(lfvrow >= _listlastvisiblerow){
              goto END;
    }
   
    START:;
    lfvrow = _listfirstvisiblerow;
    llvrow = _listlastvisiblerow;
    z_row = 3;


    LOOP:;   
    set("V[doc_val]","&#["+z_row+",30]");
    set("V[doc_val1]","&#["+z_row+",72]");
    set("V[doc_val2]","&#["+z_row+",97]");   
    z_doc.push(doc_val);
    z_doc1.push(doc_val1);
    z_doc2.push(doc_val2);
    lfvrow = lfvrow+1;                 
    if(lfvrow <= _listlastvisiblerow){    
             z_row = z_row+1;
             goto LOOP;
    }
    else{
         goto SCROLL_NEXT
    }   
    END:;


   for(k=0;k<z_doc.length;k++){
         
      println("*******************************************************");
      println("document number at z_doc["+k+"]="+z_doc[k]);
      println("document Name at z_doc["+k+"]="+z_doc1[k]);
      println("document City at z_doc["+k+"]="+z_doc2[k]);
      println("*******************************************************");
   
   }   
    copy_To_Excel(zdoc,zdoc1,zdoc2)
}




function copy_To_Excel(zdoc,zdoc1,zdoc2)
{
   
   var ExcelApp = new ActiveXObject("Excel.Application");
   var ExcelSheet = new ActiveXObject("Excel.Sheet");   
   ExcelSheet.ActiveSheet.Cells(1,1).Value = "Doccument Number";
   ExcelSheet.ActiveSheet.Cells(1,2).Value = "Name of the Person";
   ExcelSheet.ActiveSheet.Cells(1,3).Value = "City";         
   for(p=2;p<z_doc.length;p++) {      
      ExcelSheet.ActiveSheet.Cells(p,1).Value = z_doc[p];
      ExcelSheet.ActiveSheet.Cells(p,2).Value = z_doc1[p];
      ExcelSheet.ActiveSheet.Cells(p,3).Value = z_doc2[p];      
   }   
   var str = "C:\\LiquidUI\\scripts\\TEST.XLS";      
   var fso = new ActiveXObject("Scripting.FileSystemObject");   
   if(fso.FileExists(str)){     
      message("E:FILE ALREADY EXISTS PLEASE REMOVE OLD FILE");
   }
   else{     
      ExcelSheet.SaveAs(str);   
      ExcelSheet.Application.Quit();
   
   }         
}      



see the attachments for further reference.

5
Purpose: To get IP Address and Location details using WSCurl.

Pre-Requisites:
1. Specify the URL
2. Load wscurl library  load('wscurl.dll');

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

load('wscurl.dll');

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


var city;
function getLocationdetails(){

   var wsCurl = new Curl();
   var completeURL = "https://api.ipify.org/?format=text";
   wsCurl.setopt(Curl.CURLOPT_URL,completeURL);
   var response = wsCurl.exec();      
   
   var url = "http://api.ipinfodb.com/v3/ip-city/?key=87a58495dd687d6a0ca9bfadda301bf44fc2697afeb0220d4a6bffff74f18623&ip=";
   
   
   var baseurl = url + response;
   wsCurl.setopt(Curl.CURLOPT_URL,baseurl);
   var JSON_Data = wsCurl.exec();
   var JSON_Data = JSON_Data.toString().split(";");   
   var ipaddress = JSON_Data[1];
   var country = JSON_Data[4];
   var state = JSON_Data[5];
   city = JSON_Data[6];
   set("V[ip_address]",response);
   set("V[city_name]",city);
   set("V[state_name]",state);
   set("V[country_name]",country);
   wsCurl.close();
   wsCurl= NULL;
}


function showOnMaps()
{
   view([5,10],[30,200], "http://maps.google.com/?q="+city,{ "floating":true});   
}

//User Interface
clearscreen();
pushbutton([10,10], "Get Location Details",{ "process":getLocationdetails});
pushbutton([12,10], "Show on Maps",{ "process":showOnMaps});

inputfield( [1,0], "IP_address", [1,16],{ "name":"ip_address", "size":15, "readonly":true});
inputfield( [3,0], "City", [3,16],{ "name":"city_name", "size":15, "readonly":true});
inputfield( [5,0], "state", [5,16],{ "name":"state_name", "size":15, "readonly":true});
inputfield( [7,0], "country", [7,16],{ "name":"country_name", "size":15, "readonly":true});
 
see the attachments for further reference.

6
WS aka Web Scripts (Attended RPA for SAP) / WSCurl Send SMS
« on: February 26, 2019, 07:52:28 AM »
Purpose:
Send sms using WSCurl from SAP.

Liquid UI Code:

//SAPLSMTR_NAVIGATION.E0100.sjs
load('wscurl.dll');


//User Interface

clearscreen();
inputfield([6,3],"Message",[6,18],{"name":"z_message_info","size":50});
inputfield([3,3],"Phone number",[3,18],{"name":"to_number","size":23});
pushbutton([12,17], "Send sms",{ "process":send_sms, "using":{"z_message_info":z_message_info,"to_number":to_number}});



function send_sms(param)
{
   
   /*Copy the meesage from param object to variable z_message */
   var z_message = param.z_message_info;         
   
   /*Copy the source number from param object to variable mobile */
   var mobile = param.to_number;   
   
   /*Initialize the Curl object for making the call*/
   var wsCurl = new Curl();
   
   /* base url is the fixed string to concat our details and send message */
   var baseURL = "http://www.bhashsms.com/api/sendmsg.php?";            
   
   
   /* user credentials which needed to be concated to baseurl */
   var user= "user=tfhgld&pass=donate&sender=MPAYAD&phone=";
   
   
   /*String &text= is used in the URL to concat message to it */
   var tex = "&text=";      
   
   /* The messsage format from the input field is text format we convert it to string format using copytext */
   copytext({"fromtext":"z_message", "tostring":"z_str", "line":1}); 
   
   /* All the empty spaces in message body is replaced %20 to maintain the same user given space gap between words*/
   var message = z_str.replace(/ /g,'%20');      
   
   /* To provide priority and type for the message */
   var misc = "&priority=ndnd&stype=normal";
   
   /*Complete Url is stored in variable completeURL after concatenating necessary details*/
   var completeURL = baseURL + user + mobile + tex + message + misc ;
   
        /*Stored the complete URL in variable to g_url to know the URL format in Cornelius window*/
    set("V[g_URL]",completeURL);   
   
   
        /* This is the name of the proxy, if a proxy is used. the second parameter should be a string. */
   wsCurl.setopt(Curl.CURLOPT_URL, completeURL);         
   
   /* The exec API enables you to specify a response to the query you are making. The response can be either JSON or HTML */
   var response = wsCurl.exec();   
   
   
   /* Close the http connection for the URL fetch*/
   wsCurl.close();
   
   /*Remove any reference for Garbage Collection*/
   wsCurl= NULL;
   
   /* Condition to check the message delivery status */
   if(!isBlank(response))
   {
     return("S: message sent");
   }
   else
   {
     return("E:message not sent");
   }
          
}


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

7
Purpose:  To "Fast access the keyboard" upon "cursor Autofocus" in input field.

Steps:

1. Open "Liquid UI" app on your device and click on the "Menu" icon at the top left corner.
2. Click on the "App Settings".
3. Scroll down to find "Show keyboard on focus" option and "Enable" it by clicking "ON" button.
4. Goto "VA01" transaction.
5. The "Order Type" input field is automatically focused and displays the "keyboard for fast access" to input the value.

See the Attachments for further reference...

8
Mobile Products (Android, iOS and CE) / Using OCR on Liquid UI Android.
« on: October 10, 2018, 08:19:51 AM »
Purpose: To photo scan the required text from the image into the input field, using device's built in camera.

Steps:

1. Navigate to transaction "PRMD  (Maintain HR master data) ".

2. Place the cursor on the "Personnel No." input field and then click f4 to view the possible entries for the 
    input field.

3. You will be navigated to the "Restrict Value Range" screen. Place the cursor on the "Last name" input field and click "Continue".

4. Select a "Username" and click "ok".

5. The "Personnel no."  will be populated. Select the option "Travel Privileges" under "Travel Expenses" column and click "Create" button on the toolbar as shown below.

6. On the "Create Travel Privileges" screen. Long press on "License Plate number" input field and select the option "OCR".

7. The device's built-in camera will be activated to scan the vehicle number plate. Select "Done".
   
    Note: You can change the dimensions of the rectangular box while capturing the text details.

8. The vehicle's number will be captured in the input field "License Plate number".


    See the attachments for further reference.

Pages: [1]