Prerequisites
- Products: Liquid UI WS, Liquid UI Server or Local DLL, Client Software
- Commands: inputfield(), pushbutton(), set(), setcursor(), message()
Purpose
The article demonstrates how to automatically validate and place the cursor on blank input fields to improve data integrity, based on the SAP Easy Access screen we’ll guide you through the following actions:
- Delete the image container on the SAP Easy Access screen.
- Add input fields to enter the values.
- Add a push button to execute the process.
- Add required functions to validate the input fields.
- Validate the blank input field and set the cursor.
User Interface
//Create the file SAPLSMTR_NAVIGATION.E0100.sjs inside your scripts folder for customizing the SAP Easy Access screen.
//Now, add the Liquid UI script to the above file and save it.
Customization
- Delete the image container on the SAP Easy Access screen using the del().
//Deletes the image container on the SAP screen del("X[IMAGE_CONTAINER]");
- Add three input fields labeled Material, Plant, and Storage Location to enter the values.
//Creates input fields to enter values inputfield( [2,3], "Plant", [2,15],{"name":"z_plant", "size":4, "required":true}); inputfield( [3,3], "Material", [3,15],{"name":"z_material","size":10,"required":true}); inputfield( [4,3], "Stor Loc.", [4,15],{ "name":"z_storloc", "size":4, "required":true});
- Add a push button labeled Set Cursor to execute the setCursor process on click.
//Creates a push button to execute the process pushbutton([6,10], "Set Cursor", {"process":setCursor});
- Add the isBlank function to check if the field value is entered in the input field or not.
//Function to check if the field value is blank or not function isBlank(jvar) { if (jvar== void 0 || jvar==null || jvar=="") { return true; } else { return false; } }
- Add a function to check the value in the cursorPosition and set the cursor on the blank or next input field.
//Function to check if the string value is blank if(!isBlank(cursorPosition)) { setcursor(cursorPosition); cursorPosition = ''; } else { setcursor('V[z_plant]'); }
- Add the setCursor function to check whether the value is entered in the input field, if not display a message to notify the user to enter the values in the respective input field.
//Function to check required entry and setcursor on the appropriate field function setCursor(){ if(isBlank(z_plant)) { message('E: Please enter Plant'); enter('?'); goto END; } if(isBlank(z_material)){ message('E: Please enter Material'); set('V[cursorPosition]','V[z_material]'); enter('?'); goto END; } if(isBlank(z_storloc)) { message('E: Please enter storage location'); set('V[cursorPosition]','V[z_storloc]'); enter('?'); goto END; } END:; }
SAP Process
- Refresh the SAP screen, enter the value in the Plant and Material input fields, and click the Set Cursor push button. Then, you will find the cursor navigated to the next blank input field, and return a message indicating Please enter storage location at the bottom of the SAP screen, as shown in the image below.