Liquid UI - WS Reference Library

Add a column into SAP table


Prerequisites


Runs On

  SAP GUI Android iOS WM Web
Direct Connect          
Liquid UI Server Connect


Purpose

This example shows how to create a Liquid UI column in a SAP Table.


User Interface

Log into SAP and navigate to VA03.
Enter a sales order and continue to the next screen.


The table will display a Liquid UI column labeled Volume, displaying the volume for each item.


The volume values are pulled from each item’s data in the Shipping Tab.

Liquid UI Script

//SAPMV45A.E4001.sjs

if(_transaction == "VA03")
{
 onUIEvents["/n*"] = {"process":va03ClearVar};
 column("Volume", {"table":"All items","size":12,"name":"z_volume","position":4,"readonly":true});
     if(z_run_function == undefined)
{
     z_run_function = true;
  enter("?",{"process":va03FetchVolume});
  }
}
// This function is responsible for retrieving the Volume of each item
function va03FetchVolume(){
    onscreen 'SAPMV45A.4001'
       // Table Scroll through each Item
        absrow = 1;
        relrow = 1;
 // Fetch the table attributes
  gettableattribute("T[All items]",{"firstvisiblerow":"FVisRow","lastvisiblerow":"LVisRow","lastrow":"LastRow"});
new_screen:;
// Scroll to the absolute row
 enter("/ScrollToLine=&V[absrow]", {"table":"T[All items]"});
 onscreen 'SAPMV45A.4001'
 // Refetch table attributes, in case they might of changed
 gettableattribute("T[All items]",{"firstvisiblerow":"FVisRow","lastvisiblerow":"LVisRow","lastrow":"LastRow"});
 // Reset the relevant row
 relrow = 1; // reset the relative row with a new screen
new_row:;
        if(absrow>LVisRow)
{
     // end of the screen?
        goto new_screen;
        }
        if(absrow>LastRow)
{
            // end of the table?
            goto end_of_table;
        }
        // Set the cursor on the row
        setcursor("cell[All items,1,&V[relrow]]");
        // Go into Item Data
        enter("=ITEM");
        onscreen 'SAPMV45A.4003'
        // Navigate to the second tab
        enter("=T\\03");
     onscreen 'SAPMV45A.4003'
        // Set the Volume to our Liquid UI Column
        set("V[temp]","&F[Volume]");
        set("V[z_volume.&V[absrow]]",temp.trim());
        // Go back to Overview Screen
        enter("/3");
        onscreen 'SAPMV45A.4001'
        // Increment out counters
        absrow++;
        relrow++;
        goto new_row;
        end_of_table:;
        // Scroll back to the top of the table
        enter("/ScrollToLine=1",{"table":"T[All items]"});
}
// This function is responsible for clearing all the variables
function va03ClearVar()
{
    // set the column values to a blank string
    set("V[z_*]","");
    // set the function flag to undefined
    z_run_function = void 0;
}
// This is a trim function for strings that will return the original string with
String.prototype.trim = function()
{
    return this.replace(/^\s+|\s+$/g,"");
}

 


Was this information helpful? Send Feedback