‎2008 Mar 20 4:59 AM
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 ?
‎2008 Mar 20 5:10 AM
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
‎2008 Mar 20 5:10 AM
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
‎2008 Mar 20 5:14 AM
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