Application Development 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: 

Validation for Parameter

Former Member
0 Kudos

Hi friends,

I am having a Parameter P_STATUS which will refer the Ztable and Zdataelement.

P_STATUS holds only 3 values like ' ALL' , 'ACT', 'INV' .

For validation of P_STATUS how should i worte the code like this but it is not working correctly.

IF P_STATUS IS INITIAL..

IF P_STATUS NE ' ALL' or

P_STATUS NE 'ACT' or

P_STATUS NE 'INV' .

error message

ENDIF.

ENDIF.

other than 3 any value should be error.

  • Reward is sure.

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

U just try this code, I think it will work fine.

AT SELECTION-SCREEN.

    • VALIDATION FOR Major brand status

IF NOT p_status IS INITIAL.

IF p_status NE 'ALL' AND

p_status NE 'ACT' AND

p_status NE 'INV'.

SET CURSOR FIELD 'P_STATUS'.

MESSAGE e398 WITH

'No Records exist for this Major brand status'(e42).

else.

MESSAGE s398 WITH

'Success Records exist for this Major brand status'(e49).

ENDIF.

ENDIF.

**Reward if this helps

Thanks,

Anil.

17 REPLIES 17

Former Member
0 Kudos

at selection-screen on p_status

iF P_STATUS NE ' ALL' and

P_STATUS NE 'ACT' and

P_STATUS NE 'INV' .

error message

ENDIF.

former_member181962
Active Contributor
0 Kudos

if p_status not in ('ALL' , 'ACT' , 'INV').

  • Error

endif.

Former Member
0 Kudos

Use the below code


At selection-screen on P_STATUS.
IF P_STATUS NE ' ALL' or
P_STATUS NE 'ACT' or
P_STATUS NE 'INV' .
error message
ENDIF.

Former Member
0 Kudos

you have to code

at selection-screen.

IF P_STATUS NE ' ALL' or

P_STATUS NE 'ACT' or

P_STATUS NE 'INV' .

error message

ENDIF.

regards

shiba dutta

Message was edited by:

SHIBA DUTTA

null

Former Member
0 Kudos

try this..

IF NOT P_STATUS EQ 'ALL' or
NOT P_STATUS  EQ 'ACT' or
NOT P_STATUS  EQ 'INV' .
error message
ENDIF.
ENDIF.

Message was edited by:

Chandrasekhar Jagarlamudi

Former Member
0 Kudos

hi,

U need to make a small change to your code check below.

IF not P_STATUS IS INITIAL..

IF P_STATUS NE 'ALL' and

P_STATUS NE 'ACT' and

P_STATUS NE 'INV' .

write:/ 'invalid'.

ENDIF.

ENDIF.

regards,

Navneeth.K

Message was edited by:

Navneeth Bothra

Message was edited by:

Navneeth Bothra

Former Member
0 Kudos

Hi,

Please use the below code for your validation.

at selection-screen.

  • Validate Status

if p_status ne 'ALL' and

p_status ne 'ACT' and

p_status ne 'INV' .

  • Message 'Invalid Status'.

message e000(zz) with 'Invalid Status'.

endif.

thanks,

sksingh

Former Member
0 Kudos

hi

i think u should write like

IF P_STATUS IS INITIAL..

IF P_STATUS NE ' ALL' <b>and</b>

P_STATUS NE 'ACT' <b>and</b>

P_STATUS NE 'INV' .

error message

ENDIF.

ENDIF.

regards

gaurav

<b>reward points if useful</b>

Chaitanyat
Participant
0 Kudos

hi,

Just remove the outer if condition in your code and it should work fine. Or else just make it IF NOT p_status IS INITIAL.

regards,

chaitanya

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

at selection-screen on p_status.

if p_status ne 'ALL' and p_status ne 'ACT' and p_status ne 'INV'.

message.

leave list-processing.

endif.

Former Member
0 Kudos

IF P_STATUS IS not INITIAL..

IF P_STATUS <> 'ALL' and

P_STATUS <> 'ACT' and

P_STATUS <> 'INV' .

message s000(at) with 'error'.

ENDIF.

ENDIF.

Former Member
0 Kudos

Hi Friends,

Here if i put AND operator all the conditions should satisfy, which is not correct.

My case any one among these 3 is valid one.

  • Reward is sure.

Thanks.

Former Member
0 Kudos

Try this out,

at selection-screen on p_status

iF P_STATUS NE ' ALL' and

P_STATUS NE 'ACT' and

P_STATUS NE 'INV' .

message

ENDIF.

0 Kudos

hi,

Ur initial reqmt was if any other value is given other than those 3 a error should be displayed

so the below code

parameters p_status(3).

IF not P_STATUS IS INITIAL..

IF P_STATUS NE 'ALL' and

P_STATUS NE 'ACT' and

P_STATUS NE 'INV' .

write:/ 'invalid'.

ENDIF.

ENDIF.

should work perfectly. It checks incase the value is not the one of three u wanted.

regards,

Navneeth.K

Former Member
0 Kudos

hi,

just replace IF P_STATUS IS INITIAL. with IF P_STATUS IS not INITIAL.

remaing same.

IF P_STATUS IS not INITIAL.

IF P_STATUS NE ' ALL' or

P_STATUS NE 'ACT' or

P_STATUS NE 'INV' .

error message

ENDIF.

ENDIF.

Former Member
0 Kudos

Hi,

U just try this code, I think it will work fine.

AT SELECTION-SCREEN.

    • VALIDATION FOR Major brand status

IF NOT p_status IS INITIAL.

IF p_status NE 'ALL' AND

p_status NE 'ACT' AND

p_status NE 'INV'.

SET CURSOR FIELD 'P_STATUS'.

MESSAGE e398 WITH

'No Records exist for this Major brand status'(e42).

else.

MESSAGE s398 WITH

'Success Records exist for this Major brand status'(e49).

ENDIF.

ENDIF.

**Reward if this helps

Thanks,

Anil.

Former Member
0 Kudos

Thanks Anil.

Now it is working fine as per my requirement.