Liquid UI - WS Reference Library

Get attributes of an inputfield and table


The getfieldattribute() command can be used to return pushbutton attributes.

In the following example, the getfieldattribute() command is used within a function to return the attributes of a given pushbutton. We will use theDisplay doc. header deatilspushbutton in the VA01 screen and will return the icon ID, tooltip and label information. Please do the following:

User Interface

  1. Open the script file for the Easy Access screen (SAPLSMTR_NAVIGATION.E0100.sjs).
  2. Enter the following code:
     function printButton(buttonName){
    	getfieldattribute(fieldName, {"name.icon":"fbuttonicon", 
    "name.tip":"fbuttontip", "name.label":"fbuttontext"});
    	println("\t fbuttonicon = " + fbuttonicon);
    	println("\t fbuttontip = " + fbuttontip);
    	println("\t fbuttontext = " + fbuttontext);
    printButton("P[Display doc.header details]");
  3. Add an onscreen pushbutton or anentercommand to trigger the process. We will use a toolbar pushbutton and the code is as follows:
    pushbutton([TOOLBAR], "Get Field Attribute", {"process":printbutton);
  4. Save the file and launch SAP.
  5. Go to the Easy Access screen and press the pushbutton.

The following output appear on the Console screen, as shown:

Note:To display output on the screen, use themessagecommand.

getfieldattribute-other screen elements

In this example, we will get the attributes of the 'Order Type' field on the initial VA01 screen.

Liquid UI Script

  1. Enter the following code in the Easy Access script file:
    function printInfo(){
    	println("Executing getfieldattribute command");
    	getfieldattribute("F[Order Type]", {"name":"fname", "textrow":"ftextrow", "textcolumn":"ftextcolumn",  
    "row":"frow", "column":"fcol", "techname":"ftechname", "size":"fsize", "isprotected":"fprotected", "header":"fheader",  
    "columnnumber":"fcolumnnumber", "displaycolumnnumber":"fdisplaycolumnnumber", "width":"fwidth"});
    	println("Printing Field attributes!");
    	println("\t fname = " + fname);
    	println("\t ftextrow = " + ftextrow);
    	println("\t ftextcolumn = " + ftextcolumn);
    	println("\t frow = " + frow);
    	println("\t fcol = " + fcol);
    	println("\t ftechname = " + ftechname);
    	println("\t fsize = " + fsize);
    	println("\t isprotected = " + fprotected);
    	println("\t fheader = " + fheader);
    	println("\t fcolumnnumber = " + fcolumnnumber);
    	println("\t fdisplaycolumnnumber = " + fdisplaycolumnnumber);
    	println("\t fwidth = " + fwidth);
  2. Change the code for the toolbar pushbutton as shown below:
     pushbutton([TOOLBAR], "Get Field Attribute", {"process":printInfo);
  3. Save the file and refresh the SAP screen.

The resulting information appears on the console.

gettableattribute-using the selectedrows options

  1. Launch SAP and navigate to the VA01 screen where the All items table resides. Open the script file for the Easy Access screen (SAPLSMTR_NAVIGATION.E0100.sjs).
  2. Enter the following code:
    gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow", "lastvisiblerow":"LVisRow", "lastrow":"LastRow", "selectedrows":"SelRows"});
  3. Add some code to trigger the selected rows option. An example is shown below:
     if(SelRows[ROW_NUMBER]=="X") {
    println("Selected row is>> " + ROW_NUMBER);}

The row number of the selected row appears on the Console.

gettableattribute-using gettableatrtribute in a function

You can use the gettableatribute command within a function to both extract the data from the table and to display it on the scren. In the following example, we will display the attributes of the All items table on the VA02 screen.

  1. Open the Easy Access script file and enter the following code to create a pushbutton:
     pushbutton([TOOLBAR], "Test Loop", {"process":test_loop});
  2. Create a function that will be called when the pushbutton is pressed, as shown:
     function test_loop(){
    	onscreen 'SAPMV45A.0102'
    		set("F[Order]" , "14200");
    	onscreen 'SAPMV45A.4001'
    		gettableattribute("T[All items]", {"firstvisiblerow":"FVisRow","lastvisiblerow":"LVisRow","lastrow":"LRow"});
    		absrow = 1;
    		relrow = 1;
    		if (FVisRow == 1){
    			goto new_row;
    			enter("/scrolltoline=1",{"table":"T[All items]"});
    			goto new_screen
    		onscreen 'SAPMV45A.4001'
    		gettableattribute("T[All items]",{"firstvisiblerow":"FVisRow","lastvisiblerow":"LVisRow","lastrow":"LRow"});
    		relrow =1;
    			if (absrow > LVisRow) {
    				enter("/scrolltoline=&V[absrow]",{"table":"T[All items]"});
    				goto new_screen
    			if (absrow > LRow){
    				goto table_end;
    		set("V[z_temp]" , "&cell[All items, Material,&V[relrow]]");
    		println(absrow + ".----------Material is: " + z_temp);
    	goto new_row;
  3. Save the file and refresh the SAP screen.
  4. Press the pushbutton to display the table attributes on the console.
  5. To display output on the screen, use the message command.

Was this information helpful? Send Feedback