Liquid UI - Documentation - 6.12 gettableattribute()

6.12 gettableattribute()


Purpose

With gettableattribute() command, you can attain the attributes from both native SAP or Liquid UI tables. You can display both the attributes and the properties of a selected table using this command.


Syntax

gettableattribute(T[Table_name],{"option":value…});


Properties

  • Table name - Name of the Table.


Available Options

You can use the following options with the gettableattribute:

"firstvisiblerow":".."

"firstvisiblerow ":true - This option specifies the first visible row in a given table.

"lastvisiblerow":".."

"lastvisiblerow":true - This option specifies the last visible row in a given table.

"lastrow":".."

"lastrow":true - This option specifies the last row in a table.

"selectedrows":".."

"selectedrows":true - This option specifies the selected rows in a table.


Option Details

firstvisiblerow

  1. This option specifies the firstvisiblerow number in a table.

  2. gettableattribute("T[All items]",{"firstvisiblerow":"Fvisiblerow"});
    message("\t first visible row is = " + Fvisiblerow);
    

lastvisiblerow

  1. This option specifies the lastvisiblerow number in a table.

  2. gettableattribute("T[All items]",{"lastvisiblerow":"Lvisiblerow"});
    message("\t Last visible row = " + Lvisiblerow);
    

lastrow

  1. This option specifies the last row in a table.

  2. gettableattribute("T[All items]",{"lastrow":"Lrow"});
    message("\t Last Row = " + Lrow);

selectedrows

  1. This option specifies the selectedrows in a table.

  2. gettableattribute("T[All items]",{"selectedrows":"Srows"});
    message("\t Selected rows= " + Srows);
    

Note: These options can only be used with tables.


Example

The following scenario demonstrates the usage of gettableattribute() command to display selected number of rows.

  1. Navigate to VA02 overview screen. Select the required number of rows in the All items table shown below.

  2. Click Selectedrows toolbar pushbutton. You can view the selected rows displayed in the console window.

Note: To display output on the screen, use the message command.


Script Details

//SAPMV45A.E4001

pushbutton( [TOOLBAR],"Selectedrows","?",{"process": print_selectedrows});
function print_selectedrows()
{ gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow","selectedrows":"SelRows"}); //Add some code to trigger the selected rows option. for(i=0;i<LastRow;i++)
{ ROW_NUMBER = i; if(SelRows[ROW_NUMBER]=="X")
{ // adding 1 as SelRows is array which has index begin from 0 selected_row_number = ROW_NUMBER+1; println("Selected row is>> " + selected_row_number); } } }


Usage Details


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