The getfieldattribute command can be used with other screen elements as well as pushbuttons.
The preceding example is specific to pushbuttons. However, getfieldattribute can also be used to return the attributes of other screen elements. In this example, we will get the attributes of the 'Order Type' field on the initial VA01 screen.
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);
}
printInfo();
Change the code for the toolbar pushbutton as shown below:
pushbutton([TOOLBAR], "Get Field Attribute", {"process":printInfo);
Save the file and refresh the SAP screen.
The resulting information will display in the Console.