Liquid UI - Documentation - 23.02 Arrays using Key/Value Pairs

23.02 Arrays using Key/Value Pairs


Prerequisites


Purpose

Insert and retrieve values from an array using Key/Value pairs.


User Interface

Log into SAP and on the SAP Easy Access Screen and enter required data.



Liquid UI Script

//SAPLSMTR_NAVIGATION.E0100.sjs

// Retrieve Material Descriptions
function showMatlDescs()
{
    for(i=0;i<matDataArr.length;i++)
{
        matl_table.z_matl_desc[i] = matDataArr[i].value;
    }
    return;
}
// User Interface
clearscreen();
// Liquid UI table and columns
table([1,1],[20,50],{"name":"matl_table","title":"Material Info","rows":20});
column('Material',{"table":"T[Material Info]","name":"z_matl","readonly":true,"position":1,"size":15});
column('Description',{"table":"T[Material Info]","name":"z_matl_desc","position":2,"size":30});
pushbutton([21,1],"@01@Retrieve Material Descriptions",{"process":showMatlDescs});
// 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;
}

Can't find the answers you're looking for?