Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
tkbisoyi9118
Participant

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

  1. The PAN Card number should be only 10 characters long.
  2. First five characters should be alphabeting ranges from [A-Z]
  3. From 6th to 9th places should be numeric values ranges from [0-9]
  4. Last digit should be alphabetic values within [A-Z]

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.

  1. First five characters should be alphabeting ranges from [A-Z].

tkbisoyi9118_0-1713528643323.png

 

  1. From 6th to 9th places should be numeric values ranges from [0-9]

tkbisoyi9118_1-1713528643329.png

 

  1. Last digit should be alphabetic values within [A-Z]

tkbisoyi9118_2-1713528643334.png

 

  1. The PAN Card number should be only 10 characters long.

tkbisoyi9118_3-1713528643336.png

 

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.

tkbisoyi9118_4-1713528643339.png

 

tkbisoyi9118_5-1713528643344.png

 

tkbisoyi9118_6-1713528643349.png

 

 

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.

tkbisoyi9118_7-1713528643351.png

 

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.

tkbisoyi9118_8-1713528643357.png

 

tkbisoyi9118_9-1713528643362.png

 

tkbisoyi9118_10-1713528643366.png

 

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

  1. The Passport number should be only 8 characters long.
  2. First one character should be alphabeting ranges from [A-Z].
  3. For 2nd position, it should be numeric value within range 1 to 9.
  4. For 3rd position, it should be numeric value within range 0 to 9.
  5. From position 4th to 7th position, digits should be numeric value within range 0 to 9.
  6. For the last one digit, it should be numeric value within range 1-9.

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.

  1. First one character should be alphabeting ranges from [A-Z].

tkbisoyi9118_11-1713528643372.png

 

  1. For 2nd position, it should be numeric value within range 1 to 9.

tkbisoyi9118_12-1713528643376.png

 

  1. For3rd position, it should be numeric value within range 0 to 9.

tkbisoyi9118_13-1713528643380.png

 

 

  1. From position 4th to 7th position, digits should be numeric value within range 0 to 9.

tkbisoyi9118_14-1713528643384.png

 

  1. For the last one digit, it should be numeric value within range 1-9.

tkbisoyi9118_15-1713528643388.png

 

  1. The Passport number should be only 8 characters long.

tkbisoyi9118_16-1713528643392.png

 

 

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.

tkbisoyi9118_17-1713528643397.png

 

tkbisoyi9118_18-1713528643402.png

 

tkbisoyi9118_19-1713528643406.png

 

Conclusion: -

This solution can help customers to restrict unauthorized entry of identity card numbers.

2 Comments
Labels in this area