Author Topic: Read, Write Data from SAP table using Table Scrolling Logic  (Read 2594 times)

Rahul Gera

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 88
    • View Profile
Read, Write Data from SAP table using Table Scrolling Logic
« on: October 05, 2017, 03:20:57 PM »
SAP Table Scroll

Usage: This example is to create the logic to scroll SAP table to read and write data from the SAP table in VA01 transaction.

Liquid UI Script:
pushbutton([TOOLBAR],'TableScroll','?',{'process':tableScroll});

function tableScroll() {
   onscreen 'SAPMV45A.4001'
      // Table Scroll begins here   
      absrow = 1;
      relrow = 1;

      // Fetch the table attributes
      gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow"});

      if(FVisRow==1) {
       goto new_row;
      }
      // Scroll to the absolute row
      enter("/ScrollToLine=&V[absrow]", {"table":"T[All items]"});
         
   new_screen:;
    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 visible table screen?
         enter("/ScrollToLine=&V[absrow]", {"table":"T[All items]"});
         goto new_screen;
      }
      if(absrow>LastRow){
         // end of the table?
         goto end_of_table;
      }
        set("V[z_va01_mat]","&cell[All items,Material,&V[relrow]]");
      println('0000000000000000000000000000000000 z_va01_mat:'+z_va01_mat+':');
      if(z_va01_mat == 'L-60F') {
         set('cell[All items,Order Quantity,&V[relrow]]','506');
      }
         
      // 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]"});
}
« Last Edit: October 06, 2017, 10:29:13 AM by Rahul Gera »