
Validation for different Identity Cards via ABSL code in SAP C4C
In day–to-day life, the need of unique identification cards are common. So verfifications on identity cards in different sectors are also a basic requirement. Suppose we are working for a client from India and the project is about Sales cloud. In this case, the client wants to maintain every customer’s data like Name, Contact, Address, PAN number, Adhaar number, Passport details etc. Out of those fields PAN number, Adhaar number & Passport number are unique IDs provided to each person in India. So we need to put some validations against them, so that wrong values should not be stored.
We have an option to put the validations on these Identity card numbers is via ABSL validation logic through cloud application studio. Here the steps mentioned below to validate different identity cards.
Identity cards mostly required in customer/Employee work centers. So, we can add the below logics in Event- Validation on Save and Event – After Modify of Customer/Employee BO in SDK.
Case1 – PAN Card number should be alphanumeric and should maintain exact pattern. Also PAN card number should have only 10 characters length.
To validate the length of any field we have the method “.length()”Which we can use for this requirement.
For PAN Card number the format in India as
Using ABSL we have some logic using substring to implement the validation for any mismatch of the above-mentioned format. Added the code snippet for your reference.
Here we will use FindRegex() : This function Searches from left to right and returns the position of a regular expression pattern in a string. If it doesn’t find same pattern then it returns the value “-1” and raises a message as we define.
Result: - After implementing the above ABSL code, when user tried to add wrong values of PAN Card or incorrect length, the error displayed and not allowed to SAVE the data.
Case 2 – Adhaar Card number should be 12 characters length & all digits should be numeric values.
To validate the length of any field we have the method “.length()”Which we can use as of the requirement.
For Adhaar card all the digits should be numeric and length should be 12 characters only. The below ABSL code can restrict any mismatch to the Adhaar card format.
Result: - After implementing the above ABSL code, when user tried to add wrong values of Adhaar Card or incorrect length, the error displayed and not allowed to SAVE the data.
Case3 – Indian Passport number should be alphanumeric and should maintain exact pattern. Also Passport card number should have only 8 characters length.
To validate the length of any field we have the method “.length()”Which we can use as of the requirement.
For Passport number the format in India as
Using ABSL we have some logic using substring to implement the validation for any mismatch of the above-mentioned format. Added the code snippet for your reference.
Here we will use FindRegex() : This function Searches from left to right and returns the position of a regular expression pattern in a string. If it doesn’t find same pattern then it returns the value “-1” and raises a message as we define.
Result: - After implementing the above ABSL code, when user tried to add wrong values of Adhaar Card or incorrect length, the error displayed and not allowed to SAVE the data.
Conclusion: -
This solution can help customers to restrict unauthorized entry of identity card numbers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
9 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 | |
3 |