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

SAP COMMAND

Former Member
0 Likes
594

Hi all,

is there an SAP Command, or an SAP Fonction that check if a caractere is numeric?

Thank's

Bob.

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
0 Likes
559

hi Bob,

IF character CO '0123456789'.

==> numeric

ELSE.

==> not numeric

ENDIF.

ec

5 REPLIES 5
Read only

JozsefSzikszai
Active Contributor
0 Likes
560

hi Bob,

IF character CO '0123456789'.

==> numeric

ELSE.

==> not numeric

ENDIF.

ec

Read only

0 Likes
559

Thank's ec,

but l used 'CA' instead of 'CO'.

Bob

Read only

0 Likes
559

Beware:

IF string CA/CO '0123456789'.

CA ==> contains any, this will true if there is at least one number in the string

CO ==> contains only, this will true if only numers are in the string

Read only

Former Member
0 Likes
559

HI,

use this.

<b>describe filed</b> functionality

<b>example:</b>

data:fld1(10),fld2(5) type n.

data:typ.

describe field fld1 type typ.

write:/ typ.

describe field fld2 type typ.

write:/ typ.

rgds,

bharat.

Read only

Former Member
0 Likes
559

DATA: chr(10) TYPE c,

num TYPE p DECIMALS 2,

itype TYPE c.

***TO GET THE FIELD TYPE

DESCRIBE FIELD chr TYPE itype.

chr = 'ASDASDA'.

****TO CHECK THE FIELD VALUE

CATCH SYSTEM-EXCEPTIONS convt_no_number = 1.

MOVE chr TO num.

ENDCATCH.

IF sy-subrc NE '0'.

WRITE 😕 'ERROR'.

ENDIF.