Recent Posts

Pages: [1] 2 3 ... 10
1
Purpose: The purpose of this script is to demonstrate how to automate the process of importing data into a Liquid UI table and efficiently clearing the table when required. It Dynamically populating the table with material data, including material numbers and descriptions. Clearing the entire table with a single action, resetting all fields for fresh input. Automatically updating and displaying the count of non-empty rows for better visibility and control.

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

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

// Create a table with Material and Description columns
table([1,1],[18,27],{"name":"z_table","title":"Material Table","rows":15});
column('Material',{"table":"z_table","name":"z_mat","position":1,"size":7});
column('Description',{"table":"z_table","name":"z_desc","position":2,"size":15});

// Add push buttons for importing and clearing data
pushbutton([0,35],"Import Data", {"process":fnImportData});
pushbutton([1,35],"Clear Table", {"process":fnClearTable});

// Add an input field to display the row count
inputfield( [0,1], "Row Count", [0,13],{ "name":"z_rowcount", "size":2});

// Function to import data into the table
function fnImportData(){
    var matData = [];
    for(i=1; i<=15; i++){
        matData.push({key:'232'+i, value:'Testing '+i});
    }

    // Populate the table with data
    for(i=0; i<matData.length; i++){
         z_table.z_mat = matData.key;
         z_table.z_desc = matData.value;
    }
    message("S: Data Imported successfully.");

    // Count non-empty rows
    var nonEmptyRows = 0;
    for (var k = 0; k < matData.length; k++){
          if (z_table.z_mat[k] && z_table.z_mat[k].trim() !== ""){
               nonEmptyRows++;
         }
    }

    // Update the row count in the input field
    println('\n\n\n\n No of row count is :'+nonEmptyRows+':');
    set('V[z_rowcount]','&V[nonEmptyRows]');
}

// Function to clear the table
function fnClearTable() {
     for (var i = 1; i <= 15; i++) {
         set("cell[Material Table,Material," + i + "]", "");
         set("cell[Material Table,Description," + i + "]", "");
    }

    // Reset the row count
    set("V[z_rowcount]", "0");
    message("S: Table cleared successfully.");
}
2
Pre-Requisites
+++++++++++++++++++++++++++++++++++++++++++++++++
SAP Secure Login Client must be installed on the Liquid UI Server
Liquid UI Server must run under a AD Domain Admin account
SAP PSE certificate must be exported and installed on Liquid UI Server

sapproxy.ini  Proxy configuration as per below
+++++++++++++++++++++++++++++++++++++++++++++++++
[Proxy1]
ListenPort = 3297
TargetServer = HELIOS
TargetServerPort = 3200
GuiXT = 10
snc_lib=C:\Program Files\SAP\FrontEnd\SecureLogin\lib\sapcrypto.dll
sncname = CN=SAPSNCID7, OU=IT, OU=SYNACTIVE, O=SYNACTIVE C=US
SNCMode=3
SNCSSO=0

Connectivity Details
1. SAPGUI to Liquid UI Server will be SAP username and password based logon - without encryption
2. iOS/Android Liquid UI Clients can be connected to Liquid UI Server via TLS1.3 and can be encrypted



Download attached document (include screenshots)
3
Purpose: Displaying object data into Liquid UI table
This involves retrieving data from a given object and displaying it in a structured table format in Liquid UI. The table should show relevant information for each event entry, including fields such as Timestamp, Device ID, Temperature, and Alert status.

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLSMTR_NAVIGATION.E0100.sjs
-----------------------------------------------------------------------------------------------------------------------------------------------------------

Liquid UI Code:

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

// Instruction to perform the operation.
comment([0,55], "Click the Pushbutton to retrieve data.");

// Calling the retrievedata function through a pushbutton
pushbutton([1,65],"@CF@Extract Data",{"process":retrievedata});

// Creating a LiquidUI table and adding columns to display the object data.
table([1,1],[9,60],{"name":"taskTable","title":"Data Retrieve Table","rows":10,"rowselection":true});
column("Timestamp", {"table":"taskTable","size":20,"name":"z_timestamp",'readonly':true});
column("Device ID", {"table":"taskTable","size":25,"name":"z_deviceId",'readonly':true});
column("Temperature", {"table":"taskTable","size":5,"name":"z_temperature",'readonly':true});
column("Alert", {"table":"taskTable","size":5,"name":"z_alert",'readonly':true});

//Function to retrieve data from a Data Object
function retrievedata(){
   var arrData = [];
   
   for (var i = 0; i < objTaskEventList.results.length; i++) {
      var g_timestamp = objTaskEventList.results.event.timestamp;
      var g_deviceId = objTaskEventList.results.event.deviceId;
      var g_temperature = objTaskEventList.results.decode.temperature.sample;
      var g_alert = objTaskEventList.results.decode.temperature.alert;      
      
      var arrRow = [g_timestamp,g_deviceId,g_temperature,g_alert];
      arrData.push(arrRow);
        }
   for(var idx = 0; idx < arrData.length; idx++){
      taskTable.z_timestamp[idx]=arrData[idx][0];
      taskTable.z_deviceId[idx]=arrData[idx][1];
      taskTable.z_temperature[idx]=arrData[idx][2];
      taskTable.z_alert[idx]=arrData[idx][3];
   }
}

//Data Object
var objTaskEventList =
{
    "results": [               
        {                     
            "type": "beacon",
            "event": {
                "id": "a308c3f0-bf50-4180-a315-6f5f91a5decc",
                "timestamp": "2024-10-25T15:39:21Z",
                "deviceId": "59b0e8c2-87c4-4109-9b4c-bead14ed1f97",
                "data": {
                    "format": "beacon",
                    "id": "DLN233301440",
                    "rssi": -46,
                    "value": "17.59"
                }
            },
            "analytics": {
                "tenant": "f9339f76a7f1143dc30f587a46e09a6e",
                "recordedTimestamp": "2024-10-25T15:39:37.618Z",
                "resourceId": "db8597cd-6176-415c-bff4-90583a77f9a6",
                "timestamp": "2024-10-25T15:39:21Z",
                "meta": {
                    "data": {
                        "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                        "task_alarm": false,
                        "notes": "",
                        "assetIds": []
                    }
                },
                "coordinates": {
                    "global": {
                        "lat": 37.522003,
                        "lng": -121.953835
                    }
                }
            },
            "decode": {
                "temperature": {
                    "sample": 17.59,
                    "deviation": 0.0,
                    "format": "celsius",
                    "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                    "alert": false
                }
            }
        },
        {                     
            "type": "beacon",
            "event": {
                "id": "b32a6d08-cffc-4fd3-b1bb-06a3218a1c2c",
                "timestamp": "2024-10-25T15:38:51Z",
                "deviceId": "59b0e8c2-87c4-4109-9b4c-bead14ed1f97",
                "data": {
                    "format": "beacon",
                    "id": "DLN233301440",
                    "rssi": -46,
                    "value": "17.59"
                }
            },
            "analytics": {
                "tenant": "f9339f76a7f1143dc30f587a46e09a6e",
                "recordedTimestamp": "2024-10-25T15:39:37.618Z",
                "resourceId": "db8597cd-6176-415c-bff4-90583a77f9a6",
                "timestamp": "2024-10-25T15:38:51Z",
                "meta": {
                    "data": {
                        "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                        "task_alarm": false,
                        "notes": "",
                        "assetIds": []
                    }
                },
                "coordinates": {
                    "global": {
                        "lat": 37.522003,
                        "lng": -121.953835
                    }
                }
            },
            "decode": {
                "temperature": {
                    "sample": 17.59,
                    "deviation": 0.0,
                    "format": "celsius",
                    "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                    "alert": false
                }
            }
        },
        {                           
            "type": "beacon",
            "event": {
                "id": "4d0357c7-5e57-49c8-b819-f22ba3210405",
                "timestamp": "2024-10-25T15:38:21Z",
                "deviceId": "59b0e8c2-87c4-4109-9b4c-bead14ed1f97",
                "data": {
                    "format": "beacon",
                    "id": "DLN233301440",
                    "rssi": -46,
                    "value": "17.59"
                }
            },
            "analytics": {
                "tenant": "f9339f76a7f1143dc30f587a46e09a6e",
                "recordedTimestamp": "2024-10-25T15:39:37.618Z",
                "resourceId": "db8597cd-6176-415c-bff4-90583a77f9a6",
                "timestamp": "2024-10-25T15:38:21Z",
                "meta": {
                    "data": {
                        "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                        "task_alarm": false,
                        "notes": "",
                        "assetIds": []
                    }
                },
                "coordinates": {
                    "global": {
                        "lat": 37.522003,
                        "lng": -121.953835
                    }
                }
            },
            "decode": {
                "temperature": {
                    "sample": 17.59,
                    "deviation": 0.0,
                    "format": "celsius",
                    "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                    "alert": false
                }
            }
        },
        {                     
            "type": "beacon",
            "event": {
                "id": "3c0cf20f-9c6e-4e4b-95d1-d3b0b8b60cc4",
                "timestamp": "2024-10-25T15:37:51Z",
                "deviceId": "59b0e8c2-87c4-4109-9b4c-bead14ed1f97",
                "data": {
                    "format": "beacon",
                    "id": "DLN233301440",
                    "rssi": -46,
                    "value": "17.59"
                }
            },
            "analytics": {
                "tenant": "f9339f76a7f1143dc30f587a46e09a6e",
                "recordedTimestamp": "2024-10-25T15:39:37.618Z",
                "resourceId": "db8597cd-6176-415c-bff4-90583a77f9a6",
                "timestamp": "2024-10-25T15:37:51Z",
                "meta": {
                    "data": {
                        "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                        "task_alarm": false,
                        "notes": "",
                        "assetIds": []
                    }
                },
                "coordinates": {
                    "global": {
                        "lat": 37.522003,
                        "lng": -121.953835
                    }
                }
            },
            "decode": {
                "temperature": {
                    "sample": 17.59,
                    "deviation": 0.0,
                    "format": "celsius",
                    "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                    "alert": false
                }
            }
        }
    ]
}
4
Purpose: Displaying Object Data into Liquid UI Table:

This is useful for displaying object data (e.g., in JSON format) that can be read and shown directly in a Liquid UI table, making it easier to visualize structured data such as event logs, device information, and analytics data.

Please follow the below steps:

Step-1: Open the Script file "SAPLSTMTR_NAVIGATION.E0100.sjs" or Create it if it is not present in the WS Directory as configured in the "guixt.sjs" file.

Step-2: Add the below Code Snippet and Save it.

//Deleting the Screen Controls
//Liquid UI Code:
del("X[IMAGE_CONTAINER]");

//Design Screen
if(z_flag==1){
   title("Event Data  - Screen Modified using Liquid UI");
   text([8,1],"Total Count: &V[totalRows]");

    // Create a new table with the appropriate number of rows based on results length
    table([1, 1], [4, 96], { "name": "event_table", "title": "Event Data", "rows":totalRows,"rowselection":true,"columnselection":true});

    // Add columns to the table
    column("Sl.No", { "size": 5, "name": "slno_column" });
    column("Timestamp", { "size": 25, "name": "timestamp_column" });
    column("Device ID", { "size": 25, "name": "deviceid_column" });
    column("Temperature (Sample)", { "size": 18, "name": "temperature_column" });
    column("Temperature (Alert)", { "size": 15, "name": "alert_column" });

   // Populating the Liquid UI table with the extracted data
    for(var j=0;j<totalRows;j++){
      event_table.slno_column[j] = Eventdata[j][0];
      event_table.timestamp_column[j] = Eventdata[j][1];
      event_table.deviceid_column[j] = Eventdata[j][2];
      event_table.temperature_column[j] = Eventdata[j][3];
      event_table.alert_column[j] = Eventdata[j][4];
   }
}


//Defining the Eventdata Array and Processing Results
function GetEventData(){
   // Task Event Data
   var objTaskEventList = {
    "results": [
        {
            "type": "beacon",
            "event": {
                "id": "a308c3f0-bf50-4180-a315-6f5f91a5decc",
                "timestamp": "2024-10-25T15:39:21Z",
                "deviceId": "59b0e8c2-87c4-4109-9b4c-bead14ed1f97",
                "data": {
                    "format": "beacon",
                    "id": "DLN233301440",
                    "rssi": -46,
                    "value": "17.59"
                }
            },
            "analytics": {
                "tenant": "f9339f76a7f1143dc30f587a46e09a6e",
                "recordedTimestamp": "2024-10-25T15:39:37.618Z",
                "resourceId": "db8597cd-6176-415c-bff4-90583a77f9a6",
                "timestamp": "2024-10-25T15:39:21Z",
                "meta": {
                    "data": {
                        "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                        "task_alarm": false,
                        "notes": "",
                        "assetIds": []
                    }
                },
                "coordinates": {
                    "global": {
                        "lat": 37.522003,
                        "lng": -121.953835
                    }
                }
            },
            "decode": {
                "temperature": {
                    "sample": 17.59,
                    "deviation": 0.0,
                    "format": "celsius",
                    "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                    "alert": false
                }
            }
        },
        {
            "type": "beacon",
            "event": {
                "id": "b32a6d08-cffc-4fd3-b1bb-06a3218a1c2c",
                "timestamp": "2024-10-25T15:38:51Z",
                "deviceId": "59b0e8c2-87c4-4109-9b4c-bead14ed1f97",
                "data": {
                    "format": "beacon",
                    "id": "DLN233301440",
                    "rssi": -46,
                    "value": "17.59"
                }
            },
            "analytics": {
                "tenant": "f9339f76a7f1143dc30f587a46e09a6e",
                "recordedTimestamp": "2024-10-25T15:39:37.618Z",
                "resourceId": "db8597cd-6176-415c-bff4-90583a77f9a6",
                "timestamp": "2024-10-25T15:38:51Z",
                "meta": {
                    "data": {
                        "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                        "task_alarm": false,
                        "notes": "",
                        "assetIds": []
                    }
                },
                "coordinates": {
                    "global": {
                        "lat": 37.522003,
                        "lng": -121.953835
                    }
                }
            },
            "decode": {
                "temperature": {
                    "sample": 17.59,
                    "deviation": 0.0,
                    "format": "celsius",
                    "taskId": "3aabc8ea-00f1-4780-9256-817f024d0bd3",
                    "alert": false
                }
            }
        }
    ]
};
   Eventdata = [];
   totalRows = objTaskEventList.results.length;

   // Values Containing all relevant data for each record
   for (var j=0,idx=1;j<totalRows;j++,idx++) {
      var result = objTaskEventList.results[j];
      var Values = [
         idx,  // Sl.No
         result.event.timestamp, // Timestamp
         result.event.deviceId,   // Device ID
         result.decode.temperature.sample,  // Temperature (Sample)
         result.decode.temperature.alert    // Temperature (Alert)
      ];
      Eventdata.push(Values);
   }
   set("V[z_flag]","1");
}

// Calling the function to display the event data
pushbutton([TOOLBAR],"@6S@Get Event Data","?",{"process":GetEventData});

Refer to the Attachment for clarity....
5
WS aka Web Scripts (Attended RPA for SAP) / Opening Select File Dialog/Popup
« Last post by Ashfaq Ahmed on October 07, 2024, 03:33:42 PM »
Purpose: Opening Select File Pop-up:

When working with the File Dialog/Select File Pop-up in Liquid UI, errors like "primitive undefined" or "ActiveX Object class not registered" might occur. This article helps resolve these issues and demonstrates a simple, effective way to open the native Windows Select File Pop-up/Dialog in SAP.

Please follow the below steps:

Step-1: Open the Script file "SAPLSTMTR_NAVIGATION.E0100.sjs" or Create it if it is not present in the WS Directory as configured in the "guixt.sjs" file.

Step-2: Add the below Code Snippet and Save it.

//Deleting the Screen Controls
//Liquid UI Code:
del("X[IMAGE_CONTAINER]");

//Loading the Generic Functions
//This can also be placed in ESESSION.sjs file
load("FUNCTIONS_STRING.sjs");
load("FUNCTIONS_SECURITY.sjs"); 

//Function that will trigger the Select File Pop-up/Dialog
function fileopenfunc(){
   var dialog = new system.CommonDialog();
   dialog.ShowOpen();
   var ret = dialog.FileName;
   dialog = void 0;
   if(hasValue(ret)){
      message("S: File Selected = ",ret);
   }
   else{
      message("E: File Not Selected");
   }
}

//Design Screen
box([2,1], [5,33], "");
pushbutton([3,4], "@49@Select File", "?",{ "process":fileopenfunc , "size":[2,26]});


Refer to the Attachment for clarity....
6
Below code demonstrates the use of powershell to execute a file open dialog for selecting an excel spreadsheet


del("X[IMAGE_CONTAINER]");
//pushbutton([23,42], "Select File - UserAccounts  ",{ "process":selectFileUserAccounts, "size":[2,25]});
//pushbutton([7,42], "Select File - Execute PS1 ",{ "process":selectFilePS1, "size":[2,25]});
//pushbutton([11,42], "Select Folder - Shell.Application",{ "process":selectFolder, "size":[2,25]});
//pushbutton([15,42], "Select File - CommonDialog",{ "process":selectFileCommonDialog, "size":[2,25]});

pushbutton([19,42], "Select File - PowerShell  ", '?', { "process":selectFilePowerShell, "size":[2,25]});

function selectFilePowerShell() {
   onscreen '*'
   println('\n\nExecuting ... selectFilePowerShell() .....\n\n');
   variableX = 'undefined';
   
   var tempOutputFile = "C:\\LiquidUI\\Scripts\\output.txt";           // Temporary file to store the output from the batch script

   executeOpenFileDilaogCommand(tempOutputFile, false);
   
   do {
      println('\n\n.... Inside do while .....\n\n');
      sleep(500);
      openfile(tempOutputFile, {"delimiter":"\n"});
      readfile(tempOutputFile, {"variableX":true});
      closefile(tempOutputFile);
      println("===============");
      println("\nvariableX:"+ variableX + ":\n");
      println("===============");
   } while (variableX == 'undefined');
   


   if(variableX != 'undefined') {
      println('\n\nBefore Removing File .... variableX ... : ' + variableX + '....selectFilePowerShell() .....\n\n');
      removefile(tempOutputFile);
   }
   
   enter('?');

   //Continue with rest of the function.....
}


// Import the necessary Liquid UI functions
function getPowerShellFormsExecutionString(fileAbsolutePathWithName) {
   println('\n\nExecuting ... getPowerShellFormsExecutionString() .....\n\n');
   //return "@echo off\nsetlocal\n\nrem Run the PowerShell command and store the result in a variable\nfor /f \"tokens=* delims=\" %%i in ('powershell -Command \"Add-Type -AssemblyName System.Windows.Forms; $openFileDialog = New-Object System.Windows.Forms.OpenFileDialog; $openFileDialog.InitialDirectory = [Environment]::GetFolderPath('Desktop'); $openFileDialog.Filter = 'All files (*.*)|*.*'; $openFileDialog.Multiselect = $true; if ($openFileDialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) { $openFileDialog.FileNames -join '|' }\"') do set \"SelectedFiles=%%i\"Display the selected files\nif defined SelectedFiles (\nrem echo Selected files: %SelectedFiles%\necho %SelectedFiles% > " + fileAbsolutePathWithName + " \n) else (\nrem echo No file selected\necho DISMISSEDDIALOG > " + fileAbsolutePathWithName + " \n)\n";
   return "@echo off\nsetlocal\n\nrem Run the PowerShell command and store the result in a variable\nfor /f \"tokens=* delims=\" %%i in ('powershell -Command \"Add-Type -AssemblyName System.Windows.Forms; $openFileDialog = New-Object System.Windows.Forms.OpenFileDialog; $openFileDialog.InitialDirectory = [Environment]::GetFolderPath('Desktop'); $openFileDialog.Filter = 'Excel Files (*.xls;*.xlsx)|*.xls;*.xlsx'; $openFileDialog.Multiselect = $false; if ($openFileDialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) { $openFileDialog.FileNames -join '|' }\"') do set \"SelectedFiles=%%i\"Display the selected files\nif defined SelectedFiles (\nrem echo Selected files: %SelectedFiles%\necho %SelectedFiles% > " + fileAbsolutePathWithName + " \n) else (\nrem echo No file selected\necho DISMISSEDDIALOG > " + fileAbsolutePathWithName + " \n)\n";

}


function executeOpenFileDilaogCommand(fileName, remove) {
   println('\n\nExecuting ... executeOpenFileDilaogCommand() .....\n\n');
    //var fileName = "C:\\LiquidUI\\tempCommand.txt";
    var batcName = fileName + "_term.bat";
    // Open the file in write mode, which creates it if it does not exist
    openfile(batcName, {"output":true});

    // Write the command string to the file
    name1 = getPowerShellFormsExecutionString(fileName);
    appendfile(batcName, {"name1":true});

    // Close the file
    closefile(batcName);
    system.ShellExecute(batcName, "", "open", 0);
   
    // Optionally read back the content (uncomment if needed)
    // readfile(fileName, {"output":"????"});

    // Remove the file after it has served its purpose
    if(remove) {sleep(2000); removefile(batcName);}
}
7
Liquid UI for Android can be licensed on a per NAMED USER basis or on a per DEVICE basis.

License Type: USER

This type of license will allow 1 (one) named SAP User to be connected to SAP environment.  Over usage of 1 (one) additional named SAP User to be connected to SAP environment is allowed and granted (This can change in future releases).

Effective Version: 4.24.6.0

A maximum for 2 named users will be allowed to login to SAP with this license type to maintain compliance.
A license limitation popup will appear on the UI if additional named user logs into SAP environment, as it are not permitted with this license type.

See document for details on maintaining the usage for this license type

License Type: DEVICE

When there is a need to use multiple named SAP users on a single device, this type of license will be mandatory and required.  This license type allows the customers to use the application across multiple named users and work shifts on a single device.

Please contact sales@guixt.com for additional details and pricing or reach out to your Account Executive at Synactive Inc.


8
WS aka Web Scripts (Attended RPA for SAP) / RFC CALL: BAPI_USER_EXISTENCE_CHECK
« Last post by lakshmi.k on June 19, 2024, 02:23:34 AM »
Purpose:
Below example demonstrates to check the existence of username by calling BAPI_USER_EXISTENCE_CHECK function module on Easy Access Screen.

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
-----------------------------------------------------------------------------------------------------------------------------------------------------
clearscreen();

//User Interface
inputfield([1,0],"User name",[1,10],{"name":"z_user_name","size":15});
pushbutton([3,1],"Check User Exist","?",{"size":[2,20],"process":z_fmCallGetData});



//Functions
// Function trim, 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 z_fmCallGetData() {
   rfcresult = call('BAPI_USER_EXISTENCE_CHECK',{'in.USERNAME':'&V[z_user_name]','out.RETURN':'z_return'});
   if(rfcresult.rfc_rc != 0){
      // Cannot Call RFC for any reason
      // RFC call was *NOT* successful.
      // Display message to user, that rfc cannot be called (you can use the content of rfcresult.rfc_key)
      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_user_exist]',z_return.substring(24,60));
   }
   
   message('S:'+ z_user_exist);
   set('V[z_user_name]','');
   enter("?");
   SCRIPT_END:;
   
}
9
Purpose: Reading List Screen Data: Extracting Material Numbers and Generating a Checkbox List of Materials

This article explains how to generate a list of materials from the List screen, which facilitates the display of material details as needed.

Prequisties:
Liquid UI WS

Please follow the below steps:

Step-1 : Open the Script file "SAPLSTMTR_NAVIGATION.E0100.sjs" or Create it if it is not present in the WS Directory as configured in the "guixt.sjs" file.

Step-2 : Add the below Code Snippet and Save it.

//Deleting the Screen Controls
//Liquid UI Code:
del("X[IMAGE_CONTAINER]");
del([/color][/b]"P[User menu]");
del("P[SAP menu]");
del("P[SAP Business Workplace]");
del("P[Display role menu]");
del("P[Add to Favorites");
del("P[Delete Favorites");
del("P[Delete Favorites");
del("P[Delete Favorites");
del("P[Change Favorites");
del("P[Move Favorites down");
del("P[Move Favorites up");
del("P[Create role");

//Function to set the screen layout.
function fn_navigate(param){
    set("V[z_screen]","");
    set("V[z_layout]","");
}

//Design Screen.
if(z_screen==undefined || z_screen==""){
    pushbutton([3,1], "@12@Generate Material List",{ "process":z_readfromlist});
    inputfield([1,1],"Max Entries",[1,12],{"name":"z_max","size":"11"});
}

//Function to read the list screen data
function z_readfromlist(){   
    title("Generating Material List....")
    z_material_array  = []; 
    lfvrow = 1;
    onscreen 'SAPLSMTR_NAVIGATION.0100'
        enter("/NSE16");
    onscreen 'SAPLSETB.0230'
        set('F[table Name]', 'MARA');
        enter();
   
    onscreen '/1BCDWB/DBMARA.1000'
        set("F[MAX_SEL]","&V[z_max]");
        enter("/8");
   
    onscreen 'SAPLSETB.0120'
        SCROLL_NEXT:;
        enter("/scrolltoline=&V[lfvrow]");
    onscreen 'SAPLSETB.0120'
        enter("/hscrollto=0");
    if(z_max=="1"){
        goto START;
    }
    if(lfvrow >= _listlastvisiblerow){
        goto END;
    }
    START:;
    lfvrow = _listfirstvisiblerow;
    llvrow = _listlastvisiblerow;
    z_row = 5;

    LOOP:; 
    set("V[z_matval]","&#["+z_row+",20]");   
    z_material_array.push(z_matval);
    lfvrow = lfvrow+1;   
   
    if(lfvrow <= _listlastvisiblerow){   
        z_row = z_row+1;
        goto LOOP;
    }
    if(z_max==1){
        goto END;
    }
    else{
        goto SCROLL_NEXT;
    }   
    END:;

    for(var col = 0; col < z_material_array.length; col++) {
         var objReeb = <"#["+row+","+col+"]">;
        if (objReeb && objReeb.isValid) {
            var trimmedName = objReeb.name.toString().trim();
            if (trimmedName === '5' || trimmedName === '') {
                retString += value + ' ';
                value = "";
            } else if (trimmedName !== lastReebName) {
                value = trimmedName;
                lastReebName = value;
            }
        }
    }

    set("V[z_layout]","1");
    enter("/3");
    onscreen 'SAPLSETB.0120'
        enter("/3");
    onscreen '/1BCDWB/DBMARA.1000'
        enter("/3");
    onscreen 'SAPLSETB.0230'
        enter("/3");
    onscreen 'SAPLSMTR_NAVIGATION.0100'
        enter("?");
    set("V[z_screen]","home");
}
 
//Function to checks the material(s) selection and navigate to MM02
function checkSelection() {
    selected = [];
    for (k=0; k<z_material_array.length;k++) {
        var chkName = "chk"+ (k+1);
        if (eval(chkName) == 'X') {
            selected.push(z_material_array[k]);
        }
    }
    if (selected.length > 1) {
        return("Execute one Material at a Time ");
    }
    if (selected.length == 0) {
        return("No Materials Selected");
    }
    enter("/nmm03")
    onscreen 'SAPLMGMM.0060'
    set("F[Material]",selected[0]);
    enter();
    onscreen 'SAPLMGMM.0070'
        set("cell[Table,0,1]","X");
        set("cell[Table,0,2]","X");
        set("cell[Table,0,3]","X");
        set("cell[Table,0,4]","X");
        set("cell[Table,0,5]","X");
        set("cell[Table,0,6]","X");
        set("cell[Table,0,7]","X");
        set("cell[Table,0,8]","X");
        set("cell[Table,0,9]","X");
        set("cell[Table,0,10]","X");
        set("cell[Table,0,11]","X");
        enter("/6");
    onscreen 'SAPLMGMM.0080'
        enter();
    onscreen 'SAPLMGMM.0080'
        enter();
    onscreen 'SAPMSDYP.0010'
        enter();
}

//Design Screen.
if(z_layout=="1"){
    box([1,0], [z_material_array.length+5,25], "Material List");
    pushbutton([z_material_array.length+3,2], "@16@Display Material",{"process":checkSelection,"size":[2,21]});
    pushbutton([TOOLBAR], "@H9@Home","?",{"process":fn_navigate , "using":{"l_screen":""}});
    for(l=0,m=3;l<z_material_array.length;l++,m++)
    checkbox([m,2], z_material_array[l],{name: "chk"+(l+1)});
}


Refer to the Attachment for clarity....
10
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++;
        }
    }
}
Pages: [1] 2 3 ... 10