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

field length.

Former Member
0 Likes
578

i have written program to take input file name from user. input file must have object_id field of length 10. but sometimes user enter 8 or 9 digits so in that case i want to write a code which will check wheter user has correctly given object id in input file of length 10.

how to do this through abap program ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
491

Hi Santhosh,

Check the length of that field by using the Strlen and store the length in one variable and check if it is less that 10 then display error message as per your requirement.

Syntax for finding string length:

INT = STRLEN( WORD1 ).

The above works only for string datatype. If your field is some other data type then declare another dummy string variable and store the object_id in that string variable then check find the length and check the condition(less than 10).

Regards,

Raghu

2 REPLIES 2
Read only

Former Member
0 Likes
492

Hi Santhosh,

Check the length of that field by using the Strlen and store the length in one variable and check if it is less that 10 then display error message as per your requirement.

Syntax for finding string length:

INT = STRLEN( WORD1 ).

The above works only for string datatype. If your field is some other data type then declare another dummy string variable and store the object_id in that string variable then check find the length and check the condition(less than 10).

Regards,

Raghu

Read only

Former Member
0 Likes
491

Hi,

You can find the length of the parameter using DESCRBE FIELD syntax.

Example: DESCRIBE FIELD: date1 OUTPUT-LENGTH olen1,

date2 OUTPUT-LENGTH olen2.

here olen1 and olen2 stores the length of date1 and date2 repsectively.

Reward if useful

Thanks,

Anil