Application Development 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: 

Numeric OR Non-numeric???!!!

Former Member
0 Kudos

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

Former Member
0 Kudos

if var co '0123456789'

write ; / 'Numeric'.

endif.

regards

shiba dutta

6 REPLIES 6

Former Member
0 Kudos

if var co '0123456789'

write ; / 'Numeric'.

endif.

regards

shiba dutta

Former Member
0 Kudos

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

former_member2382
Active Participant
0 Kudos

Hi,

See the below code.

If string ca '0123456789'.

write: 'Numeric'.

else.

if string ca sy-abcde.

write : 'Non-Numeric'.

endif.

Former Member
0 Kudos

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.

former_member2382
Active Participant
0 Kudos

Hi,

See the below code.

If string co '0123456789'.

write: 'Numeric'.

elseif string co sy-abcde.

write : 'Non-Numeric'.

endif.

BR,

MD.

Former Member
0 Kudos

Thanks All

Points rewarded!!!