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

comparing 2 character inputs

Former Member
0 Likes
554

i hav a requirement where i get an input (character format) from the interface ans i hav to check if its a 8 char long input or a 9 char long input, according to which i need to select data from diff table. how can i do this? kindly help.......useful answer wil surely be rewarded.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
517

hi

basically u need to check the length of the character..which can be achived by using STRLEN command...

data : a type c value 'ABAP', b(10).

b = strlen( a ).

write b.

output will be 4

if helpful, reward

Sathish. R

4 REPLIES 4
Read only

Former Member
0 Likes
518

hi

basically u need to check the length of the character..which can be achived by using STRLEN command...

data : a type c value 'ABAP', b(10).

b = strlen( a ).

write b.

output will be 4

if helpful, reward

Sathish. R

Read only

0 Likes
517

i two fields are character fields , but they hold numbers only.....

can we use str functions on chars........does it need to be declared as String?

Read only

0 Likes
517

hi

s..it's a command used explicitly to perform on character-type fields

from documentation

STRLEN : Returns the length of a character-type field in characters

if helpful, reward

Sathish. R

Read only

Former Member
0 Likes
517

Hi,

You can do this way:

First declare 2 constants of value 8 and 9.

Then use the STRLEN keyword to get the string length of the input character format and then compare with the consatnts to check if they are 8 or 9 characters in length.

Hope it was useful.

Thanks,

Sandeep.