Recent Posts

Pages: [1] 2 3 ... 10
1
Purpose:
The below example demonstrates how to display native SAP function module details into a Liquid UI table on Easy Access Screen by making an RFC call.

Note:
For each output parameter in the function module, we need to specify individual structure object.
See Convert function module structure detail into type object to generate ready-to-use type object for selected structure.

Liquid UI Code:
------------------------------------------------------------------------------------------------------------------------------------
Script File Name : SAPLSMTR_NAVIGATION.E0100.sjs
------------------------------------------------------------------------------------------------------------------------------------

//User Interface
clearscreen();

pushbutton([0,1], "BAPI_USER_GET_DETAIL", "?", {"process":callBAPI_USER_GET_DETAIL, "size":[1,30]});

//LUI Table of Export Parameter
table([2,1], [25,42],{"name":"z_table_export", "title":"Data of Export Parameter", "rows":200});
column("Component", {"size":18, "table":"z_table_export", "name":"z_comp_export", "readonly":true});
column("Value", {"size":18, "maxlength":40, "table":"z_table_export", "name":"z_comp_value_export", "readonly":true});

//LUI Table of Table Parameter
table([2,50], [25,92],{"name":"z_table", "title":"Data of Table Parameter", "rows":200});
column("Component", {"size":18, "table":"z_table", "name":"z_comp_table", "readonly":true});
column("Value", {"size":18, "maxlength":40, "table":"z_table", "name":"z_comp_value_table", "readonly":true});


//Function
//Function to display data of export parameter and table parameter in the LUI table
function callBAPI_USER_GET_DETAIL() {
   
   var z_BAPILOGOND = {

      name:'BAPILOGOND',

      components:[

         { name:'GLTGV',      length:8,      decimalpl:0,      type:'D' },
         { name:'GLTGB',      length:8,      decimalpl:0,      type:'D' },
         { name:'USTYP',      length:1,      decimalpl:0,      type:'C' },
         { name:'CLASS',      length:12,      decimalpl:0,      type:'C' },
         { name:'ACCNT',      length:12,      decimalpl:0,      type:'C' },
         { name:'TZONE',      length:6,      decimalpl:0,      type:'C' },
         { name:'LTIME',      length:6,      decimalpl:0,      type:'T' },
         { name:'BCODE',      length:8,      decimalpl:0,      type:'undefined' },
         { name:'CODVN',      length:1,      decimalpl:0,      type:'C' },
         { name:'PASSCODE',      length:20,      decimalpl:0,      type:'undefined' },
         { name:'CODVC',      length:1,      decimalpl:0,      type:'C' },
         { name:'PWDSALTEDHASH',      length:255,      decimalpl:0,      type:'C' },
         { name:'CODVS',      length:1,      decimalpl:0,      type:'C' },
         { name:'SECURITY_POLICY',      length:40,      decimalpl:0,      type:'C' },
      ]

   };
   
   
   var z_BAPIPARAM = {

      name:'BAPIPARAM',

      components:[

         { name:'PARID',      length:20,      decimalpl:0,      type:'C' },
         { name:'PARVA',      length:18,      decimalpl:0,      type:'C' },
         { name:'PARTXT',      length:60,      decimalpl:0,      type:'C' },
      ]

   };
   
   rfcResult = call("BAPI_USER_GET_DETAIL", {"in.USERNAME":"&V[_user]",
                  "out.LOGONDATA(type:z_BAPILOGOND)":"z_export_logon",
                  "table.PARAMETER(width:3000,type:z_BAPIPARAM)":"z_table_param"});
   println("=====>>Exception: " + rfcResult.exception);

      

   
   var value_export = '';
   var a = 0;
   for (var idx in z_export_logon) {
      z_table_export.z_comp_export[a] = idx;
      set('V[value_export]',z_export_logon[idx]);
      z_table_export.z_comp_value_export[a] = value_export;
      a++;
   }
   

   
   var value_table = '';
   var c = 0;
    for (var j in z_table_param){
        for (var k in z_table_param[j]){
         z_table.z_comp_table[c] = k;
         set('V[value_table]',z_table_param[j][k]);
         z_table.z_comp_value_table[c] = value_table;
         c++;
        }
    }
}
2
WS aka Web Scripts (Attended RPA for SAP) / Making Structured RFC Calls
« Last post by lakshmi.k on March 18, 2024, 10:13:32 PM »
Purpose:
Below example demonstrates structure to make function module calls, display message to the user if the call was successful and display an error message if the call was not successful.

Note:
To make the function module call, it is required to provide the rfc parameters in the configuration file i.e, guixt.sjs

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------
// User Interface
clearscreen();
inputfield([1,0],"Message",[1,10],{"name":"z_message","size":70,"readonly":true});
pushbutton([3,1],"Get Messsage","?",{"size":[2,20],"process":getMessage});

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

//Function to return trimmed string
function getString(strInput) {
   return (typeof(strInput) == 'undefined' || strInput == 'undefined') ? "" : strInput.toString().trim();
}

//Function to check for blank string
function isBlank(strInput) {
   var strVal = getString(strInput);
   var blank = strVal == "";
   return blank;
}

//Function to call BAPI and display results
function getMessage(){
   onscreen 'SAPLSMTR_NAVIGATION.0100'
      rfcresult = call('BAPI_USER_CHANGE',{'in.USERNAME':'&V[_user]','out.GENERATED_PASSWORD':'z_gen_pswd','table.RETURN':'z_return'});
      if(rfcresult.rfc_rc != 0) {         
         // Cannot Call RFC for any reason
         // RFC call was *NOT* successful.
         message('E: Error! RFC Call Failed to Return Data');
         enter("?");
         goto SCRIPT_END;
      } else {
         if(!isBlank(rfcresult.exception)) {
            // RFC Call succeeded, but the ABAP code in the function module generated an exception
            // Display message to user, that rfc exception occured (you can use rfcresult.exception)
            message('E: Error! '+rfcresult.exception);
            enter("?");
            goto SCRIPT_END;
         }
      }

      // RFC call was successful
      if(!isBlank(z_return)){
         set('V[z_message]', z_return.toString().substring(24,244));   
      }
      message('S: RFC call was successful');
      enter('?');
    SCRIPT_END:;   
}

3
WS aka Web Scripts (Attended RPA for SAP) / RFC CALL: BAPI_USER_GETLIST
« Last post by lakshmi.k on March 18, 2024, 09:29:22 PM »
Purpose:
Below example demonstrates to display users list on Easy Access Screen by calling BAPI_USER_GETLIST function module.

Note:
To make the function module call, it is required to provide the rfc parameters in the configuration file i.e., guixt.sjs

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
----------------------------------------------------------------------------------------------------------------------------------------------------
del("X[IMAGE_CONTAINER]");       //Deletes the image container on the Easy Access Screen

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

getUsersList();         //Calls the getUserList function and executes it

//To create text based on the number of users in the list
for(i=0; i<user_id.length; i++){
   text([1+i,0], user_id);
}

//Function to get users list
function getUsersList() {
call('BAPI_USER_GETLIST',{'in.WITH_USERNAME':'&V[_user]','out.ROWS':'z_rows','table.USERLIST':'z_userslist'});
   user_id = [];
   for(i = 0; i<z_userslist.length; i++){
             temp = z_userslist.trim();
             user_id.push(temp);       
    }
}
4
Purpose:
To extract data from a SAP table and load it into a Liquid UI table. Additionally, the data in table will be cleared using pushbuttons.

The following example illustrates the above defined process established on the easy access screen.

Liquid UI Code:
------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
------------------------------------------------------------------------------------------------------------------------------------

//Delete Image Container
del("X[IMAGE_CONTAINER]");

//User Interface
inputfield( [0,1], "Order", [0,11],{ "name":"va02_Order", "size":21, "searchhelp":"VMVA"});

table([2,1],[8,68],{"name":"va02_AllItems","title":"All items", "rows":20, "rowselection":true,"columnselection":true});
column('Item',{"table":"va02_AllItems","size":4,"name":"va02_item","position":1});
column('Material',{"table":"va02_AllItems","size":15,"name":"va02_mat","position":2});
column('Order Quantity',{"table":"va02_AllItems","size":15,"name":"va02_qty","position":3});
column('description',{"table":"va02_AllItems","size":25,"name":"va02_desc","position":4});

pushbutton( [10,1], "Extract Data To LiquidUI Table","?",{ "process":extractDataToLiquidUiTable,"size":[1,27]});
pushbutton([10,30], "Clear Table Data", {"process":clearData}); //clearTableData



//Functions
//Function to retrieve data to Liquid UI table
function extractDataToLiquidUiTable(){ 
   // SAP Easy Access
   onscreen 'SAPLSMTR_NAVIGATION.0100'
      enter("/nva02");
   
   // Change Sales Order: Initial Screen
   onscreen 'SAPMV45A.0102'
      set('F[Order]', '&V[va02_Order]');
      enter("=SUCH");
   
   
   // Change Sales Order: Initial Screen
   onscreen 'SAPMSDYP.0010'
      enter();
   
   // Change Sales Order: Initial Screen
   onscreen 'SAPMSDYP.0010'
      enter();
   
   onscreen 'SAPMV45A.4001'
      
      z_va02_item=[];
      z_va02_mat=[];
      z_va02_qty=[];
      z_va02_desc=[];
   
      
      gettableattribute('T[All items]', {'firstvisiblerow':'FVisRow', 'lastvisiblerow':'LVisRow', 'lastrow':'LastRow'});

      relrow=1;
      absrow=1;
      total=0;
      println("=====> First visible row is: "+FVisRow);
      println("=====> Last visible row is: "+LVisRow);
      println("=====> Last row of the table is: "+LastRow);

      if(FVisRow != 1){
         println("=====> Scroll to first row before start...");
         enter('/ScrollToLine=1', {table:'T[All items]'});
      } else {
         enter('?');
      }

   newscreen:;
   onscreen 'SAPMV45A.4001'
      relrow=1;
      gettableattribute('T[All items]', {'firstvisiblerow':'FVisRow', 'lastvisiblerow':'LVisRow'});
      println("=====> New first visible row is: "+FVisRow+", new last visible row is: "+LVisRow);

      newlabel:;
      
      if(absrow>LVisRow){
         println("=====> Scroll to next visible row before continue...");
         enter('/ScrollToLine=&V[absrow]', {table:'T[All items]'});
         goto newscreen;
      }

      if(absrow>LastRow){
         println("=====> Reach the end of table, end of scrolling");
         goto end;
      }
      set('V[z_curr_item]', '&cell[All items,Item,&V[relrow]]');
      z_va02_item.push(z_curr_item);
      set('V[z_curr_mat]', '&cell[All items,Material,&V[relrow]]');
      z_va02_mat.push(z_curr_mat);
      set('V[z_curr_quan]', '&cell[All items,Order Quantity,&V[relrow]]');
      z_va02_qty.push(z_curr_quan);
      set('V[z_curr_desc]', '&cell[All items,Description,&V[relrow]]');
      z_va02_desc.push(z_curr_desc);
      

      absrow++;
      relrow++;
      goto newlabel;
      
      end:;
      println("=====> Scroll to the first row of table at the end");
      enter('/ScrollToLine=1', {table:'T[All items]'});
   
      
      total = absrow;
      println("This is absolute row :"+absrow+":"+total);
      
      
   onscreen 'SAPMV45A.4001'
      for(var idx=1, i=0; idx<total-1;idx++, i++){

         va02_AllItems.va02_item=z_va02_item;
         va02_AllItems.va02_mat=z_va02_mat;
         va02_AllItems.va02_qty=z_va02_qty;
         va02_AllItems.va02_desc=z_va02_desc;

      }
      enter('/n');   
      
   
}


//clear table data
function clearData() {   
   var table_value = ' ';

   for(i=1;i<total-2;i++) { 
      table_value += ' ';
   }

   onscreen 'SAPLSMTR_NAVIGATION.0100'
      set('V[va02_*]','');
      set('V[z_*]','&V[table_value]');
      enter();
      
}
5
WS aka Web Scripts (Attended RPA for SAP) / Read LiquidUI Table
« Last post by lakshmi.k on February 29, 2024, 08:33:15 PM »
Purpose:
Read values in the LiquidUI table with toolbar pushbutton.

Below example demonstrates read LiquidUI table data and display them on the console window.

Liquid UI Code:
------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
------------------------------------------------------------------------------------------------------------------------------------
//Delete image container
del("X[IMAGE_CONTAINER]");

//User Interface
table([1,5],[10,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});

pushbutton([TOOLBAR],"Read LiquidUI Table","?",{"process":readLiquidUITableValues,"size":[2,23]});

//Functions
// Function prototype to trim blank characters from a string
String.prototype.trim = function () {
   return this.replace(/^\s+|\s+$/g, "");
}

// Function to return trimmed string
function getString(strInput) {
   return (typeof(strInput) == 'undefined' || strInput == 'undefined') ? "" : strInput.toString().trim();
}

// Function to check for blank string
// Specifically used to determine if input exist in the edit field
function isBlank(strInput) {
   var strVal = getString(strInput);
   var blank = strVal == "";
   return blank;
}


//function to read LiquidUI table 'All items'
function readLiquidUITableValues(){
   i = 0;
   //declaring variables and arrays
   temp_items=[];
   temp_material=[];
   temp_quantity=[];
   
   STARTLABEL:; 
   z_temp1 = va01_AllItems.z_va01_item[i ];   
   z_temp2 = va01_AllItems.z_va01_material[i ];   
   z_temp3 = va01_AllItems.z_va01_Orderquantity[i ];
   
   if(!isBlank(z_temp1) && !isBlank(z_temp2) && !isBlank(z_temp3)){   

      temp_items.push(z_temp1);
      temp_material.push(z_temp2);
      temp_quantity.push(z_temp3);
   
      i=i+1;
      goto STARTLABEL;
      
   }   
    
   println('-----------items-------'+temp_items);
   println('-----------material-------'+temp_material);
   println('-----------order quantity-------'+temp_quantity);
   

}
6
WS aka Web Scripts (Attended RPA for SAP) / Add Inputfield Values to SAP Table
« Last post by lakshmi.k on February 28, 2024, 11:35:37 PM »
Purpose:
Add Inputfield values to SAP table using pushbutton.

Below example demonstrates adding inputfield values created on the VA02 screen to the "All items" table.

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

//User Interface
del("G[Search Criteria]");      //Deletes Search Criteria group box

comment([4,2], "Item   Material        Order Quantity  Plnt");

inputfield([5,2], {"name":"z_va02_item", "size":6,"nolabel":true});
inputfield([5,9], {"name":"z_va02_mat", "size":15,"nolabel":true});
inputfield([5,25], {"name":"z_va02_qty", "size":15,"nolabel":true});
inputfield([5,41], {"name":"z_va02_plnt", "size":4,"nolabel":true});

pushbutton([2,59],"Add Values To SAP Table", {"process":addValuesToSAPtable});


//Function to add values in the inputfield to SAP table
function addValuesToSAPtable(){

   onscreen "SAPMV45A.0102"
      enter();
   onscreen "SAPMSDYP.0010"
      enter();
   onscreen "SAPMV45A.4001"
      var absrow = 1;
      var relrow = 1;
      
   NEW_SCREEN:;   
   
      enter("/scrolltoline=&V[absrow]", {"table":"T[All items]"});
   onscreen "SAPMV45A.4001"
      relrow = 1;

      gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LRow"});
   NEW_ROW:;
   
      if(absrow > LVisRow){
         goto NEW_SCREEN;
      }
      if(absrow > LRow){
         goto END_OF_TABLE_SCROLL;
      }
      
      relrow++;
      absrow++;
      
      goto NEW_ROW;
   END_OF_TABLE_SCROLL:;
   
      //Adding inputfields values to the All items table
      set("cell[All items,Item,&V[relrow]]","&V[z_va02_item]");
      set("cell[All items,Material,&V[relrow]]","&V[z_va02_mat]");
      set("cell[All items,Order Quantity,&V[relrow]]","&V[z_va02_qty]");
      set("cell[All items,Plnt,&V[relrow]]","&V[z_va02_plnt]");
      
      set('V[z_*]','');       //it clears the values in the inputfield
      enter('/11');
      
      onerror               //It navigates to VA02 screen if there is an error
      message(_message)
      enter('/nva02')
      
}




7
Purpose:
Using _tabrow on Liquid UI table with pushbutton option to retrieve the clicked row details.

For the below example, Liquid UI table is displayed on SAP Easy Access screen.
Click the pushbuttons on the UI to clear or populate the table with random data.
Click the pushbuttons in the Liquid UI table to retrieve the clicked row number and get that row Material details.

Liquid UI Code:
---------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
---------------------------------------------------------------------------------

pushbutton([TOOLBAR],'Find Position',{'process':readCursorPosition});

function readCursorPosition(){
        // Put cursor in the table cell, to find out its position
        set('V[z_rowcol]','['+_tabrow+','+_tabcol+']');
        println('Value:' + z_rowcol);
}


//USER INTERFACE
clearscreen();
table([6,1], [30,48],{"name":"z_table", "title":"LUI Table", "rows":20, "rowselection":true});
   column("Material", {"size":18, "table":"z_table", "name":"z_print_mat", "readonly":true});
   column("Desc", {"size":18, "maxlength":40, "table":"z_table", "name":"z_print_matdesc", "readonly":true});
   column("Row #'s", {"size":4, "table":"z_table","label":"@AA@", "pushbutton":true,"fcode":"?","process":fnGetClickedRowData});
               
pushbutton([1,1],"Clear Table","?",{"process":fnClearTable,"size":[2,20]});               
pushbutton([1,22],"Fill Data Table","?",{"process":fnFillTable,"size":[2,20]});               
comment([4,1],"[Click on the LUI table row pushbuttons to get the Row number and Material number]");      
         



// FUNCTIONS
// Function to clear the Liquid UI table based on parameters
function clear_values(tablename, columnArray, rows){   
   for (var loop = 0; loop < rows; loop++){
      for (var col=0; col<columnArray.length; col++){   
         tablename[columnArray[col]][loop] = "";
      }
   }   
}               


function fnClearTable(){
   if(typeof z_table =='object'){
      clear_values(z_table,["z_print_mat","z_print_matdesc"],20);
      for(var idx=0;idx<20;idx++){
         z_table.selectedrows[idx] = " ";
      }
   }        
}


function fnFillTable(){
   if(typeof z_table =='object'){
      for(var idx=0;idx<20;idx++){
         z_table.z_print_mat[idx] = "12340"+idx;
         z_table.z_print_matdesc[idx] = "Test Desc_"+idx;
      }
   }        
}

function fnGetClickedRowData(){
   if(_tabrow == -1){
      message("E: No data found, please click 'Fill Data Table' first");
   } else {
      zrow = _tabrow-1;
      message("S: You clicked Row# "+_tabrow+" and Material# is "+z_table.z_print_mat[zrow]);
   }
}
8
User Count and Details based on specific user role

For role based customization using Liquid UI, Liquid UI needs to be enabled for a pre-determined role
Example: Z_LIQUIDUI

Use Transaction SE16
Table: AGR_USERS
Role: Z_LIQUIDUI  (in this example)
Click 'Execute'

This will give all the users who has Z_LIQUIDUI role assigned.

This can be used to determine the user count for Liquid UI usage.

9
WS aka Web Scripts (Attended RPA for SAP) / RFC CALL: /GUIXT/SELECT
« Last post by umang@guixt.com on January 17, 2024, 03:52:03 PM »
This article describes the details on how to call /GUIXT/SELECT , RFC enabled function module in SAP using Liquid UI

Calling /GUIXT/SELECT Function Module

Things to pay attention to:

1. FUNCTION NAME SHOULD BE UPPERCASE IN CALL STATEMENT
2. PARAMETER NAMES SHOULD BE UPPERCASE IN CALL STATEMENT
3. WIDTH FOR OUTPUT IS 2X THE TOTAL CHAR COUNT (DOUBLE BYTE UNICODE)
4. IF TABLE OUTPUT IS CHAR (EXAMPLE: CHAR8000), THEN PASS DEFINED STRUCTURE TO RETRIEVE DATA. 
5. STRUCTURE DETAILS TO BE DETERMINED BASED ON WHAT THE OUTPUT IS DERIVED FROM
(EXAMPLE: TABLE, CHECK SE11 FOR TABLE STRUCTURE)
6. THE STRUCTURE NEEDS TO BE DEFINED TILL THE LAST FIELD DATA THAT NEEDS TO BE RETRIEVED

// Sample script: Easy Access Screen


// SAPLSMTR_NAVIGATION.E0100.sjs

del("X[IMAGE_CONTAINER]");

pushbutton([1,1],"RFC Test","?",{"size":[1,20], "process":fnTestRFC});

function fnTestRFC() {
   var r = [];

   var z_KNA_DETAILS_E = {
      name:'CHAR8000_D',
      components:[
            { name:'MANDT',      length:3,      decimalpl:0,    type:'C' },                                 //Order Number
            { name:'KUNNR',      length:10,      decimalpl:0,    type:'C' },                                 //Order Type
            { name:'LAND1',      length:3,      decimalpl:0,    type:'C' },                                 //Maintenance Planning Plant
            { name:'NAME1',      length:35,      decimalpl:0,    type:'C' }                                 //Business Area
      ]
   }

   //set("V[z_flds]","MANDT,KUNNR,LAND1,NAME1");
   set("V[z_flds]","KUNNR,NAME1");

   println("Calling RFC.......");

   var rfcResult = call("/GUIXT/SELECT",{"in.TABLE":"KNA1","in.FIELDS":"&V[z_flds]", "in.CONDITION":"ORT01 = 'HEIDELBERG'", "table.RESULTTABLE(width:16000,type:z_KNA_DETAILS_E)":"r","verbose":true});

   println("rfcResult.rc:"+rfcResult.rfc_rc+":");
   println("rfcResult.key:"+rfcResult.key+":");
   println("rfcResult.exception:"+rfcResult.exception+":");
   println("Total Records:"+r.length+":");

   for(i=0;i<r.length;i++) {
      println("i:"+i+":"+r["KUNNR"]+":"+r["NAME1"]+":");
   }
}

10
Purpose:
Opening a URL link is different via direct connect and Liquid UI Server.
This article explains how to open links when connecting through a Liquid UI server.


Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs       // SAP Easy Access
----------------------------------------------------------------------------------------------------------------------------------------------
//================================================
// User Interface
//================================================
del("X[IMAGE_CONTAINER]");
pushbutton([4,1],"Open URL/Link via LUI Server","?",{"process":openURLviaServer});



//================================================
//Function Scripts
//================================================
// Function prototype to trim blank characters from a string
String.prototype.trim = function () {
   return this.replace(/^\s+|\s+$/g, "");
}

// Function to return trimmed string
function getString(strInput) {
   return (typeof(strInput) == 'undefined' || strInput == 'undefined') ? "" : strInput.toString().trim();
}

// Function to check for blank string
// Specifically used to determine if input exist in the edit field
function isBlank(strInput) {
   var strVal = getString(strInput);
   var blank = strVal == "";
   return blank;
}

//Function to delete toolbar buttons on popup
function delButtonsRSM0400() {
   del('P[Continue]');
   del('P[Generate]');
   del('P[End Session]');
   del('P[Cancel]');
   if(<'P[Delete Session]'>.isValid)      del("P[Delete Session]");
}

//Function to display Liquid UI message popup
function procLUIMessageBox(param){
   var intHeight = 5 + 4 + param.l_message.length;
   var intPaintRow = 1;
   var intPaintCol = 3;
   enter("/o");
               
   onscreen 'RSM04000_ALV_NEW.2000'
      goto RESIZE_REPAINT;
      
   onscreen 'RSM04000_ALV.2000'
      RESIZE_REPAINT:;
      clearscreen();
      delButtonsRSM0400();
   
      title(param.l_title);
      
      if(isBlank(param.l_viewtext))   var viewTextContent='';
      else var viewTextContent = param.l_viewtext;
      if(isBlank(param.l_viewhtml))   var viewHTMLContent='';
      else var viewHTMLContent = param.l_viewhtml;
      if(isBlank(param.l_viewheight))   var viewHeight=0;
      else var viewHeight = param.l_viewheight;
      
      //Logic to render message
      for(var idxI=0; idxI<param.l_message.length; idxI++){
         var intWidth = (intWidth>param.l_message[idxI].length)?intWidth:param.l_message[idxI].length;
         if(param.l_message[idxI].indexOf("\t")==0)      //When message needs to be indented
            text([intPaintRow+idxI,intPaintCol+4], param.l_message[idxI]);
         else
            text([intPaintRow+idxI,intPaintCol], param.l_message[idxI]);
      }
      intWidth = intWidth+20;
      if(intWidth<51) intWidth=52;
      
      intPaintRow = 2 + param.l_message.length;
      if(!isBlank(fileURL)) {
         windowsize([5,5,90,intHeight+viewHeight]);
         view([intPaintRow-1,5],[intPaintRow+viewHeight,60],fileURL,{'name':fileURLName});
         intPaintRow = intPaintRow+1;
      } else if(viewTextContent.length>0) {
         textbox([intPaintRow,1],[intPaintRow+14,148],{'name':'viewTextContent','readonly':true});
         intPaintRow = intPaintRow+15;
         windowsize([5,5,150,intHeight+15]);
      } else if(viewHTMLContent.length>0) {
         var viewingFile = generatePrintableView(viewHTMLContent);
         var viewHNDL = getTodayDateTimeStr('HMS');
         //var viewingFile = viewHNDL+GP_Path_User+'PRINTCONTENT.htm';
         //view([intPaintRow,1],[intPaintRow+14,146],'&V[GP_Path_User]PRINTCONTENT.htm',{'name':viewHNDL});
         view([intPaintRow,1],[intPaintRow+14,146],viewingFile,{'name':viewHNDL});
         intPaintRow = intPaintRow+15;
         windowsize([5,5,150,intHeight+15]);
      } else {
         windowsize([5,5,intWidth,intHeight+1]);
      }
      fileURL = '';
      
      //Draw buttons according to type
      switch(param.l_type) {
         case "MB_YESNO":
            pushbutton([intPaintRow,intPaintCol], "@01@Yes", "/12",{"eventid":"YES", "size":[2,20]});
            pushbutton([intPaintRow,25], "@02@No", "/12",{"eventid":"NO", "size":[2,20]});
            break;
            
         case "MB_OKCANCEL":
            pushbutton([intPaintRow,intPaintCol], "@01@OK", "/12",{"eventid":"OK", "size":[2,20]});
            pushbutton([intPaintRow,25], "@02@Cancel", "/12",{"eventid":"CANCEL", "size":[2,20]});
            break;
            
         case "MB_OK":
            pushbutton([intPaintRow+viewHeight,intPaintCol], "@01@OK", "/12",{"eventid":"OK", "size":[2,20]});
            break;
            
         default:
            pushbutton([intPaintRow,intPaintCol], "OK", "/12",{"eventid":"OK", "size":[2,20]});
            break;
      }
}


function openURLviaServer(){
   //Set the path to where the html file can be created
   Z_PATH_LINK = "C:\\LiquidUI\\Scripts\\";
   
   onscreen "SAPLSMTR_NAVIGATION.0100"
      lFile = [];
      lLink = 'X';
      lName = 'LiquidUI_Web_Link_';
      set("V[tmpLink]","https://www.liquid-ui.com/");      //Set the link (URL) you want to open
      lFile.push([tmpLink,'LiquidUI_Web_Link']);
      reenter({'process':I_INITIAL_SCREEN_INFORMATION,'using':{'l_filename':lFile,'l_name':lName,'l_link':lLink}});
}


function I_INITIAL_SCREEN_INFORMATION(param){
   // SAP Easy Access
   enter('?');
   onscreen '*'
      var arrFiles = param.l_filename;
      var arrf1N = [];
      set('V[t1]',param.l_filename);
      
      set("V[t2]", 'Link');
      set("V[f1N]", '&V[Z_PATH_LINK]&V[t1]');
      for(var i=0;i<arrFiles.length;i++) {
         if(param.l_link == 'X') {
            set("V[f1N]", arrFiles[0]);
         } else {
            if(isBlank(param.l_type)) {
               set("V[f1N]", '&V[Z_PATH_LINK]'+arrFiles[0]);
            } else if(param.l_type == 'MACRO') {
               set("V[f1N]", '&V[Z_PATH_MACRO]'+arrFiles[0]);
            }
         }
         arrf1N.push([f1N,arrFiles[1]]);
      }
      fileURLName = param.l_name;
      fileURL = generateDynamicViewFileLinkV2(arrf1N,fileURLName+'VIEW.htm',param.l_link);
      
      title('Opening &V[t2] Please Wait...');
      strType = "MB_OK";
      strTitle = "View Link";
      aryMessage = [];
      aryMessage.push("Click to Open Link");
      reenter({"process":procLUIMessageBox, "using":{"l_type":strType, "l_title":strTitle, "l_message":aryMessage,'l_viewheight':arrFiles.length}});   
}


function generateDynamicViewFileLinkV2(arrInpFile,viewSuffix,strLink) {
   var fileName = Z_PATH_LINK+viewSuffix;
   removefile(fileName);
   var textString = "<html><head><body bgcolor='#FFFFFF'>";
   copytext({'tofile':'&V[fileName]','fromstring':'textString','appendline':true});

   for(var i=0;i<arrInpFile.length;i++) {
      if(strLink == 'X') {
         var textString1 = "<a href=\"";
      } else {
         var textString1 = "<a href=\"file:///";
      }
      var textString2 = arrInpFile[0];
      if(strLink == 'X') {
         var textString3 = "\" target=\"_blank\"><B><I><U>"+arrInpFile[1]+"</U></I></B>[/url]</BR>";
      } else {
         if(arrInpFile[0].toString().indexOf('.')>-1) {
            var textString3 = "\"><B><I><U>"+arrInpFile[1]+"</U></I></B>[/url]</BR>";
         } else {
            var textString3 = "\" target=\"_explorer.exe\"><B><I><U>"+arrInpFile[1]+"</U></I></B>[/url]</BR>";
         }
      }
      var textString = textString1+textString2+textString3;
      copytext({'tofile':'&V[fileName]','fromstring':'textString','appendline':true});
   }
   var textString = "</body></head></html>";
   copytext({'tofile':'&V[fileName]','fromstring':'textString','appendline':true});
   closefile(fileName)
   return fileName;
}


See attachments for code samples!
Pages: [1] 2 3 ... 10