Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Parameter Input Data Validation Formatting

Former Member
0 Likes
722

I'm unsure of how to validate an input parameter that has this format: xxxx-xxxxxx-xxxxx where 'x' are numbers with the first 'x' being the number 3. So the user has to input '3' first followed by any numbers while '-'s are included in their respective placement in the format in order for my program to accept the data input.

3 REPLIES 3
Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
569

You will have to extract each character and validate it. You can use a DO_WHILE loop inside which you can use offsets to get each character.

Read only

Former Member
0 Likes
569

Hi mark...
if am correct you are askin how to validate every input user enters..am not clear about my answer but you could go a try..
make a feild for every 'X'
for eg:
field1 field2 field3 field4 for "XXXX"

NOW,WHEN EVER THE USER ENTER THE VALUE,IN THE PAI CHECK FOR THE VALUE WITH YOU WANT.

EG:

if Field1 = 3.

if sy-subrc = 0.

if field2 = 4
etc.

Read only

amy_king
Active Contributor
0 Likes
569

Hi Mark,

You could do this in a number of different ways. One possibility is to check that...

input(1) = '3'.

and that...

input+5(1) = '-' and input+12(1) = '-'.

Then you could remove these two '-' characters from input and check that all that is left are digits.

input CO '0123456789'.

Or if you wanted to get fancy, you could use a regular expression to validation the string.

Cheers,

Amy