Liquid UI - Documentation - 19.25 Get attributes of a table

19.25 Get attributes of a table


Prerequisites


Purpose

To explain displaying the properties of a table using the gettableattribute command, you can retrieve the first visible row number, last visible row number, last row, and selected rows of a table, and we will walk you through the following steps.

  1. Add a toolbar push button to retrieve table attributes
  2. Add a function to display table attributes
  3. Check the console window for table attributes


User Interface

//Create this file inside your script folder for customizing the SAP Easy Access screen, SAPLSMTR_NAVIGATION.E0100.sjs

//Now, let's add the Liquid UI script to the above file and save it.


Customization

  1. Add a push button labeled Get Table Attribute, which displays the table attributes on click.
     
    //Create Get table attributes toolbar push button to trigger the action 
    pushbutton([TOOLBAR],"Get Table Attribute", {"process":test_loop});
    
     
     
  2. Add a table titled BOM Details with 100 rows and five columns named Item, Document, Type, Part, and Version.
     
    //Creates a Liquid UI table titled BOM Details with 100 rows and 5 columns. 
    columns. table([3,2], [15,50], {"name":"z_table", "title":"BOM Detail", "rows":100});
    column("Item", {"table":"z_table", "name":"item_no", "position":1, "size":4, "numerical":true});
    column("Document", {"table":"z_table", "name":"doc_no", "position":2, "size":25, "uppercase":true});
    column("Type", {"table":"z_table", "name":"doc_type", "position":3, "size":3, "uppercase":true});
    column("Part", {"table":"z_table", "name":"doc_part", "position":4, "size":3, "uppercase":true});
    column("Version", {"table":"z_table", "name":"doc_version", "position":5, "size":2, "uppercase":true});
    
     
     
  3. Add a function to retrieve the table attributes.
     
    //Function to get table attribute
     function test_loop(){
    		set("F[Order]" , "5455");
    	enter();
    	onscreen 'SAPMV45A.4001'
    		gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow","lastvisiblerow":"LVisRow","lastrow":"LRow","selectedrows":"Srows"});
    		println(" ---- First visible row is " + FVisRow);
    		println(" ---- Last visible row is  " + LVisRow);
    		println(" ---- Last row is " + LRow);
    // Displays X if the row is preselected
    		println(" ---- Selected rows        " + Srows);
    }
    
     

SAP Process

  1. Refresh the SAP screen and click the Get Table Attribute push button to retrieve and display attributes of the BOM Details table on the console window.
     
     


Next Steps

Execute functions dynamically
Learn how to navigate to required transaction based on the value entered in the inputfield.

10 min.

This article is part of the Invoking functions tutorial.


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