Using variables with inputfields.
There are two types of variables that can be used with inputfields - global variables and screen variables. As their names imply, screen variables are specific only to a single screen, while global variables can be used throughout a SAP script.
To demonstrate global variables, please do the following:
Open the Easy Access script file (SAPLSMTR_NAVIGATION.E0100.sjs) and enter the following code. Create the script file if it does not already exist.
inputfield([4,5], "Inputfield Test", [4,20], {"name":"inpfld_MaterialNumber","size":14}); set("V[inpfld_MaterialNumber]", "1000");
Save the changes and refresh the SAP screen.
The screen now appears as follows:
Global variables can be used throughout a SAP script, regardless of the screen. Screen variables are applicable only to a specific screen. However, screen variables also can be assigned as inputfield names. To assign a screen variable to an inputfield, add the following line of code to the script file.
var mrp_type = "Material"; inputfield([4,5], "&V[mrp_type]", [4,20], {"name":"inpfld_1","size":14});
The screen now appears as follows: