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

parameter problem

Former Member
0 Likes
1,171

Hi,

Am having parameter field name p_1 of charater type 50.

ill be giving value as 1,2,3 or 30,80,900,600 numbers with comma separation.

if other than numbers or comm i need display an error message how to do.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,149

Refer this code.

Data: a type string.

IF a CA '01234,56789'.

...Do something..

ELSE.

Messsage 'Characters other than comma and numerals are not allowed' TYPE 'I'.

ENDIF.

Thanks

Nitesh

8 REPLIES 8
Read only

Former Member
0 Likes
1,149

Hi,

You can use CA statement for this.

Thanks

Read only

0 Likes
1,149

tried with ca not wrking.

when i give 1,2 its not wrking.

if p_key2 ca '123456789,' .

else.

message e000 with 'Table2 Enter numbers and comma only'.

endif.

Read only

Former Member
0 Likes
1,151

Refer this code.

Data: a type string.

IF a CA '01234,56789'.

...Do something..

ELSE.

Messsage 'Characters other than comma and numerals are not allowed' TYPE 'I'.

ENDIF.

Thanks

Nitesh

Read only

0 Likes
1,149

Hi Nitesh,

but here my combination may be in 1,2 or 40,50 or 50,45,85 etc

Read only

0 Likes
1,149

Hi,

Try like this.

PARAMETERS: P1 TYPE CHAR50.

AT SELECTION-SCREEN.

DATA: LV_VAR TYPE N,

LV_VAR1 TYPE N.

LV_VAR1 = STRLEN( P1 ).

DO LV_VAR1 TIMES.

IF P1+LV_VAR(1) NA '0123456789,'.

MESSAGE 'message' TYPE 'E'.

ENDIF.

LV_VAR = LV_VAR + 1.

ENDDO.

Regards,

Suresh

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
1,149

hi ,

you may try like this.

AT SELECTION-SCREEN.
  IF p_1 CA sy-abcde OR p_1 CA '~!@#$%^&*()_-=+/'.
    MESSAGE 'message' TYPE 'E'.
  ENDIF.

Thanks & REgards

Edited by: Always Learner on Dec 5, 2008 1:53 PM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,149

Hello Mark,

I think you should use CO & not CA.

BR,

Suhas

Read only

former_member209217
Active Contributor
0 Likes
1,149

Hi Martin,

U can NA(Contains Not any) also to check .

Regards,

lakshman.

Edited by: Lakshman N on Dec 5, 2008 1:47 PM