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 Fields

Former Member
0 Likes
778

Hi,

I need to give only numeric value in the field.wat validation must be done on it?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
743

hi,

***************************************************************************************

data:

p_fld(10) type c .

......................................

................................

at selection-screen on field p_fld.

if p_fld cn '0123456789'.

message 'enter valid number' type 'E'.

endif.

............................................

............................

regards,

naresh.

5 REPLIES 5
Read only

Former Member
0 Likes
743

declare the field type i.

Read only

Former Member
0 Likes
743

this is my code --

DATA : VA_COND(50) VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&()_+=-/'.

IF SY-UCOMM EQ 'SAVE' OR SY-UCOMM EQ 'ENTER'.

IF NOT SCR_WGT IS INITIAL .

IF SCR_WGT CA VA_COND.

  • IF SY-SUBRC NE 0.

SET CURSOR FIELD 'SCR_WGT'.

CLEAR SCR_WGT.

MESSAGE E100 WITH 'Please enter a numeric value here'.

  • CALL SCREEN 200.

  • ENDIF.

ENDIF.

ENDIF.

ENDIF.

Read only

0 Likes
743

You can can write as below.

DATA : VA_COND(10) VALUE '0123456789'.

IF SY-UCOMM EQ 'SAVE' OR SY-UCOMM EQ 'ENTER'.

IF NOT SCR_WGT IS INITIAL .

IF SCR_WGT CO VA_COND.

ELSE.

  • IF SY-SUBRC NE 0.

SET CURSOR FIELD 'SCR_WGT'.

CLEAR SCR_WGT.

MESSAGE E000(0) WITH 'Please enter a numeric value here'.

  • CALL SCREEN 200.

  • ENDIF.

ENDIF.

ENDIF.

ENDIF.

Read only

Former Member
0 Likes
744

hi,

***************************************************************************************

data:

p_fld(10) type c .

......................................

................................

at selection-screen on field p_fld.

if p_fld cn '0123456789'.

message 'enter valid number' type 'E'.

endif.

............................................

............................

regards,

naresh.

Read only

Laxmana_Appana_
Active Contributor
0 Likes
743

Hi,

Check this, It will work.

if fld1 CO '12345 67890'.
   write 'Numeric'
else.
   write 'Non-Numeric'
endif.

Regards

L Appana