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 the Display doc. header deatils pushbutton in the VA01 screen and will return the icon ID, tooltip and label information. Please do the following:
Open the script file for the Easy Access screen (SAPLSMTR_NAVIGATION.E0100.sjs).
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]");
Add an onscreen pushbutton or an enter command to trigger the process. We will use a toolbar pushbutton and the code is as follows:
pushbutton([TOOLBAR], "Get Field Attribute", {"process":printbutton);
Save the file and launch SAP.
Go to the Easy Access screen and press the pushbutton
The following output will display in the Console screen as shown in the following example:
