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

TEXT field / numeric field

Former Member
0 Likes
471

Hi abappers,

I need to check whether the content of a text field is numeric type or of character type? please any body can tell me how to do this?

Regards

Naren

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
418

hi,

CATS_NUMERIC_INPUT_CHECK

or

You can use the Function Module:

numeric_check.

Usage:

CALL FUNCTION 'NUMERIC_CHECK'

EXPORTING

STRING_IN = X

IMPORTING

STRING_OUT = X

HTYPE = H_TYPE.

if h_type = 'CHAR'.

WRITE:/ 'NOt Numeric'.

else.

write:/ 'Numeric'.

ENDIF

********without FM*********

If field CO '1234567890'.

  • Then its number.

else.

  • then character.

Endif.

rgds

anver

if hlped pls mark points

<i>hi narendran did it work</i>

2 REPLIES 2
Read only

anversha_s
Active Contributor
0 Likes
419

hi,

CATS_NUMERIC_INPUT_CHECK

or

You can use the Function Module:

numeric_check.

Usage:

CALL FUNCTION 'NUMERIC_CHECK'

EXPORTING

STRING_IN = X

IMPORTING

STRING_OUT = X

HTYPE = H_TYPE.

if h_type = 'CHAR'.

WRITE:/ 'NOt Numeric'.

else.

write:/ 'Numeric'.

ENDIF

********without FM*********

If field CO '1234567890'.

  • Then its number.

else.

  • then character.

Endif.

rgds

anver

if hlped pls mark points

<i>hi narendran did it work</i>

Read only

Former Member
0 Likes
418

hi,

You can even use <b>CATS_NUMERIC_INPUT_CHECK</b>

* Check for Numeric Value

call function 'CATS_NUMERIC_INPUT_CHECK'
 exporting
   input = t_return-fieldval
 exceptions
   no_numeric = 1
   others = 2.

if sy-subrc = 0.
read table t_f4_table index t_return-fieldval.
endif.