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

How do i know if an string value contains a numeric value??

Former Member
0 Likes
1,009

... it can also contains decimal values....

Anybody can help me??

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
979

Hi Javier,

Do the following:

IF v_string CA '0123456789.'.

ENDIF.

Regards,

Aditya

... it can also contains decimal values....

Anybody can help me??

Thanks in advance.

6 REPLIES 6
Read only

Former Member
0 Likes
979

Hi Javier,

Good!

If you know the numeric value for which you need to search in string you could use CA string operatoin.

Like:

IF string CA '22.10'.

*****

ENDIF.

Thanks,

Sunil

Read only

Former Member
0 Likes
979

Hi,

USe numeric_check function module.

regards,

Santosh Thorat

Read only

Former Member
0 Likes
979

If string CA '1234567890'

Your string has numbers and decimals.

Endif.

Read only

Former Member
0 Likes
979

Hello,

YOu can make use of the FM NUMERIC_CHECK.

Check this sample.

PARAMETERS: CHAR(10).

DATA: TYPE LIKE DD01V-DATATYPE.

CALL FUNCTION 'NUMERIC_CHECK'

EXPORTING

STRING_IN = CHAR

IMPORTING

STRING_OUT = CHAR

HTYPE = TYPE.

WRITE: CHAR , TYPE.

Cheers,

Vasanth

Read only

Former Member
0 Likes
980

Hi Javier,

Do the following:

IF v_string CA '0123456789.'.

ENDIF.

Regards,

Aditya

Read only

Former Member
0 Likes
979

You can check either of these following 2 methods....


DATA : l_str(10) value '345.34'.

IF NOT l_str CA  sy-abcde.
"do something
ENDIF.
*
"OR

IF l_str CA  '.0123456789'.
"do something
ENDIF.