Create custom code list restriction
This blog is about creating custom code list restriction. SAP ships standard code list for certain role codes such as parties e.g. customer, ship to, bill to, owner, payer, etc.
Now there are certain scenarios, wherein a special type of restriction is required. For such cases SAP ships code list restrictions for such role code fields. This is available in Administrator > General work center view. An admin user can configure restrictions for all standard code lists of business objects that are shipped by SAP. In case a specific code list is not available in code list restriction, user needs to connect to SAP support requesting for the same or build a custom solution with the help of SAP partners.
Instead of this, customers – specifically admin users can create a custom code list restriction by making use of the validation option available in the adapt mode of the UI against the role code field.
Going forward I will be demonstrating how to achieve the same. But before we start lets consider the following business scenario for better understanding.
In registered product master data, we have an option of adding involved parties for that registered product. This involved party can be a customer, a service technician, a ship to party, a bill to party, etc. Now a certain customer might face a situation where in they need to allow creation of all involved parties from an integration scenario but have to restrict use of some role code say owner party role code when doing the same via manually, i.e. adding an involved party from Cloud for Customer UI.
Now having explained the business scenario let me show you the steps to achieve the same.
- Go to the registered product work center view and open any registered product and navigate to the involved parties facet.
- Open the Add Involved Partied quick create in adapt mode.
- Select the role for which you want to apply restriction as shown in the above image.
- Open the add validation window once you are in adapt mode.
- Click on new in the validation creation dialog window to open the model validation dialog.
- Enter Validation Name, Description and select the Severity in the Overview tab of the modal validation dialog.
- Next in the editor tab create the rule to check for the role code value. Here if no value is there in the drop down then use the create button to enter a new name for the rule.
- Enter the description and construct the restriction code in this case by selecting the field name available from the LHS column and appropriate operator from the RHS Operators column and provide a value for restriction as shown below.
Also, instead of operators, SAP standard functions can also be used. Explore the functions available and use them in suitable cases.
- Next move to the message tab and add an explanatory message in the required language(s) to support the restriction constructed.
Once the message is in place click on Apply to save the validation. Once this is done the validation should appear in active state in the create validation dialog.
Click on done to close this dialog.
- Now whenever a user tries to add a owner party in the involved parties facet of registered product the action will be halted with the error message that had been constructed during the creation of the validation.
This is how a custom code list restriction can be built if no standard code list restriction exists for a specific code list field in the application.
Note: If a specific party role code is not required or rather is not to be used then you can remove the active check from the fine tuning activity provided for managing involved parties for registered products and installation points.