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

Validation for Parameter

Former Member
0 Likes
2,072

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
Read only

Former Member
0 Likes
1,802

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
Read only

Former Member
0 Likes
1,802

at selection-screen on p_status

iF P_STATUS NE ' ALL' and

P_STATUS NE 'ACT' and

P_STATUS NE 'INV' .

error message

ENDIF.

Read only

Former Member
0 Likes
1,802

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

  • Error

endif.

Read only

Former Member
0 Likes
1,802

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.

Read only

Former Member
0 Likes
1,802

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

Read only

Former Member
0 Likes
1,802

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

Read only

Former Member
0 Likes
1,802

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

Read only

Former Member
0 Likes
1,802

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

Read only

Former Member
0 Likes
1,802

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>

Read only

Chaitanyat
Participant
0 Likes
1,802

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

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,802

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.

Read only

Former Member
0 Likes
1,802

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.

Read only

Former Member
0 Likes
1,802

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.

Read only

Former Member
0 Likes
1,802

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.

Read only

0 Likes
1,802

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

Read only

Former Member
0 Likes
1,802

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.

Read only

Former Member
0 Likes
1,803

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.

Read only

Former Member
0 Likes
1,802

Thanks Anil.

Now it is working fine as per my requirement.