Purpose
With getfieldattribute() command, you can attain the attributes of both native SAP or Liquid UI fields.
Syntax
getfieldattribute(Field name,{"option":value…});
Properties
- Field name - Name of the element.
Sub Properties of name option
- name.label - Specifies the onscreen label of a given field or screen element.
- name.icon - Specifies the icon ID of the field element.
- name.tip - Specifies the tooltip of the field element.
Available Options
You can use the following options with the getfieldattribute:
"column":true - This option specifies the column number of a text area for the text field. |
|
"columnnumber":true - This option specifies the ID of a given column in a table. |
|
"displaycolumnnumber":true - This option specifies the screen display number for columns in a table. |
|
"header":SAPColumnName - This option specifies the header, if the element is a table column. |
|
"isprotected":string - This option specifies whether a given screen element is active or not. For edit fields, radiobuttons and checkboxes, '1' equals readonly and '0' equals editable. For pushbuttons, '1' equals inactive and '0' equals active. For all elements, 'null' equals not found. |
|
"name":string - This option specifies the onscreen label for a given screen element. |
|
"row":string - This option specifies the row number of the text area for the given text field. |
|
"size":string - This option specifies the number of characters a text field contain. |
|
"techname":string - This option specifies the technical name of a screen element (Eg. VBKD-BSTKD). |
|
"textcolumn":string - This option specifies the column number of a screen element's label. |
|
"textrow":string - This option specifies the row number of a screen element's label. |
|
"width":string - This option specifies the row number of a screen element's label. |
Option Details
Example
The following scenario demonstrate the usage of getfiedattribute() command.
Note: To display output on the screen, use the message().
Script
Enter the following code in Create Sales Order screen(VA01):
//SAPMV45A.E0101
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);
}
printInfo();
Usage Details
-
Display of sub-properties of a pushbutton using getfieldattribute()
This example explains on how to display icon, tip and label values of a pushbutton using the getfieldattribute(). The properties of the field object can also be used as options in the field name command. For example, the name property has several sub-properties, which are used as follows
getfieldattribute("P[Pushbutton attributes]", {"name.icon":"fbuttonicon", "name.tip":"fbuttontip", "name.label":"fbuttontext"});
Learn more about getfieldattribute() on SAP Screens.