Validation of format (telephone number)

In this recipe, we will see how to use the back-referencing operator in order to validate telephone numbers. Suppose telephone numbers in a certain city follow the rule: a number must be of exactly eight digits, and the first and second digit must be the same.

For example, the valid numbers of the city may be 44005600, 88008700, and so on. If the number entered starts with a zero or has length less than eight, an error should be displayed. We will see how a short validation program may be written.

How to do it...

For creating the program that checks the validity of a telephone number according to the given criteria, proceed as follows:

  1. Declare a parameter having the name tel_no with eight characters.
  2. We then ...

Get SAP ABAP Advanced Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.