Liquid UI - WS Reference Library

Assign values into SAP table from Liquid UI table


Purpose:

In this scenario, you can see how values form Liquid UI table created on easy access screen are passed to “All Items” table of VA01 transaction using Liquid UI function.


User Interface

  1. On the SAP Easy Access screen, enter the values into the Liquid UI table.
  2. Click on Assign values to SAP table pushbutton.
  3. You can see values from Liquid UI table assigned to “All Items” table of “VA01” transaction.
     


Liquid UI Script:

del("X[IMAGE_CONTAINER]"); // deletes image
pushbutton( [TOOLBAR], "Assign to SAP Table","?",{  "process":z_AssigntoSAPTbale,"size":[2,23]}); // pushbutton to call function

//creating table
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});

//function to assign values to All Items table
function z_AssigntoSAPTbale(){
   i = 0; //declaring variables and arrays
   temp_items=[];
   temp_material=[];
   temp_quantity=[];
   
        // code to fetch data from Liquid table to arrays
   STARTLABEL:   
   z_temp1 = va01_AllItems.z_va01_item;   
   z_temp2 = va01_AllItems.z_va01_material;  
   z_temp3 = va01_AllItems.z_va01_Orderquantity;
   
   if(isBlank(z_temp1) && isBlank(z_temp2) && isBlank(z_temp3)){
      goto ENDLOOP;
   }
   
   temp_items.push(z_temp1);
   temp_material.push(z_temp2);
   temp_quantity.push(z_temp3);
   i=i+1;
   goto STARTLABEL;
   
   ENDLOOP:
   enter('/nva01');

// Create Standard Order: Overview
onscreen 'SAPMV45A.0101'
   set('F[Order Type]', 'OR');
   enter();

// Create Standard Order: Overview
onscreen 'SAPMV45A.4001'
   set('F[Sold-to party]', '1460');
   enter();

// Logic to assign array values to All item table
onscreen 'SAPMV45A.4001'
   gettableattribute("T[All items]", {"lastvisiblerow":"LVisRow"}) // gets lastvisible row
   var z=1;
   for(j=0;j<LVisRow;j++){  // assign values to visible rows in table
      z_item_temp = temp_items[j];
      z_item_material = temp_material[j];
      z_item_quantity = temp_quantity[j];    
      set("cell[All items,Item,&V[z]]" , "&V[z_item_temp]");   
      set("cell[All items,Material,&V[z]]" , "&V[z_item_material]");
      set("cell[All items,Order Quantity,&V[z]]" , "&V[z_item_quantity]");
      z=z+1;
   }

   // on enter cursor moves to next row in table
   START:
   enter();

// logic assign values to rows after scrolling table using enter()
onscreen 'SAPMV45A.4001'   
   z_item_temp = temp_items[j];
   z_item_material = temp_material[j];
   z_item_quantity = temp_quantity[j];
   set("cell[All items,Item,&V[LVisRow]]" , "&V[z_item_temp]");
   set("cell[All items,Material,&V[LVisRow]]" , "&V[z_item_material]");
   set("cell[All items,Order Quantity,&V[LVisRow]]" ,  "&V[z_item_quantity]");
   j=j+1;

   if(j<=i){ // loops until all liquid ui table values are assigned to sap table
      goto START;
   }
   enter();
}

Was this information helpful? Send Feedback