Liquid UI - Documentation - 13.08 Get data from SAP table using table scrolling logic

13.08 Get data from SAP table using table scrolling logic


Prerequisites


Purpose

In this scenario, you will learn how to get the column values easily from an SAP table using table scrolling logic in the console window. To explain this, we’ll walk you through the following steps.

  • Add a toolbar pushbutton to execute the process on click
  • Adding functionality to the pushbutton, which on click retrieve column values from an SAP table


User Interface

//Create this file inside your script folder for adding functionality to the Change Sales Order Overview screen (VA02): SAPMV45A.E4001.sjs
//Now, let's start adding the Liquid UI script to the above file and save it


Customization

  1. Navigate to the Change Sales Order (VA02) screen, and enter the value for the Order input field; click enter.
     

     
  2. You will navigate to the Change Sales Order Overview screen, and add a toolbar pushbutton with the label Table Scroll.
     
    //Creates a pushbutton on toolbar with label as Table Scroll
    pushbutton([TOOLBAR],'Table Scroll','?',{'process':tableScroll});
     
  3. Add the following Liquid UI script to this file and save it.
     
    // Fetch the table attributes
    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]"}); }

SAP Process

  1. Refresh the SAP screen and click the Table Scroll pushbutton that will execute the function tableScroll and retrieve the values of the Material column from the All items table using table scroll logic and display them in the console window, as shown in the image below.
     
     

Next Steps

Simplified view with table command
Learn how to assign values into an SAP table using a function.

10 min.

This article is part of the 4.0 Take a deep dive into the SAP table and Liquid UI table


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