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

Numeric OR Non-numeric???!!!

Former Member
0 Likes
771

Hi All,

From a string, i retrieve the last character sucessfully...

Need to find, whether the retrieved character is a numeric or non numeric...

and based on that need to check some further conditions...!

Is there any way, to identify whether the retrieved character is a numeric or non numeric????

Kindly, help to throw some lights!!!

Thanks!!!

Cheers,

Sundar.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
714

if var co '0123456789'

write ; / 'Numeric'.

endif.

regards

shiba dutta

6 REPLIES 6
Read only

Former Member
0 Likes
715

if var co '0123456789'

write ; / 'Numeric'.

endif.

regards

shiba dutta

Read only

Former Member
0 Likes
714

Hello,

U can check like this.

If string ca '0123456789'.
write: 'Numeric'.
else.
write: 'Non Numeric'.
endif.

U can use the FM <b>NUMERIC_CHECK</b> also.-

Regards,

Vasanth

Read only

former_member2382
Active Participant
0 Likes
714

Hi,

See the below code.

If string ca '0123456789'.

write: 'Numeric'.

else.

if string ca sy-abcde.

write : 'Non-Numeric'.

endif.

Read only

Former Member
0 Likes
714

Hi

You can do something like this.

report zrich_0001.

data: str type string.

data: valid_characters type string.

concatenate '0123456789' sy-abcde into valid_characters.

str = '123ABC'.

if str co valid_characters.

else.

message e001(00) with 'You have a problem'.

endif.

Read only

former_member2382
Active Participant
0 Likes
714

Hi,

See the below code.

If string co '0123456789'.

write: 'Numeric'.

elseif string co sy-abcde.

write : 'Non-Numeric'.

endif.

BR,

MD.

Read only

Former Member
0 Likes
714

Thanks All

Points rewarded!!!