Making a custom SAP field required:
- We will use the following standardized functions to check to see if the field is empty. Place these wherever you are loading your functions.
function isBlank(jvar){
return(jvar == 'undefined' || jvar == null || jvar == "" || jvar == void 0);
}
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
- In Designer select the field to become required. Right-click -> Properties.
- Click the "Required" checkbox. This will display required to the user on SAP.
- Use the trim method to remove any whitespace from the variable as follows:
z_iw51_description = z_iw51_description.trim(); - Use the isBlank function to check if the variable is empty. Use a return statement to stop the process and to alert the user. This goes at the very beginning of your function:
if (isBlank(z_iw51_description)){
return("E:Description is required");
}
- Repeat steps 2-5 for each variable you want to make required.
- Save in Designer and all the changes will appear in SAP.