Liquid UI - WS Reference Library

Clear Liquid UI Table


Prerequisites


Runs On

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


Purpose

Clear all or few of the columns of a Liquid UI table.


User Interface

Log into SAP and on the SAP Easy Access Screen click on ‘Retrieve Material Descriptions’ to retrieve Material and Description values.


Click on ‘Clear Descriptions’ to clear only the Description column or ‘Clear Table’ to clear all columns.



Liquid UI Script

//SAPLSMTR_NAVIGATION.E0100.sjs

// 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 to display Material/s on the Liquid UI table
function showMatlData(){
    // Sample Materials and Descriptions
    var matDataArr = [];
    for(i=1;i<=20;i++){
        matDataArr.push({key:'Material '+i+'',value:'Description'+i+''});
    }
    // Populating table with Material numbers
    for(i=0;i<matDataArr.length;i++)
{
        matl_table.z_matl[i] = matDataArr[i].key;
        matl_table.z_matl_desc[i] = matDataArr[i].value;
    }
}
// Function to only clear the Description column
function clearTableDesc(){
    if(typeof matl_table =='object'){
        clear_values(matl_table,["z_matl_desc"],20);
    }    
}
// Function to clear all columns
function clearTable(){
    if(typeof matl_table =='object')
{
        clear_values(matl_table, ["z_matl","z_matl_desc"],20);
    }    
}
// User Interface
clearscreen();
// Liquid UI table and columns
table([1,1],[20,50],{"name":"matl_table","title":"Material Info","rows":20});
column('Material',{"table":"matl_table","name":"z_matl","position":1,"size":15,"readonly":true});
column('Description',{"table":"matl_table","name":"z_matl_desc","position":2,"size":30,"readonly":true});
pushbutton([21,1],"@01@Retrieve Material Descriptions",{"process":showMatlData});
pushbutton([23,1],"@01@Clear Descriptions",{"process":clearTableDesc});
pushbutton([25,1],"@01@Clear Table",{"process":clearTable});