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

logical error

Former Member
0 Likes
1,073

Hello experts

in the select options material type is select option

it should take only two fields LH and ZV

if we give other values it should throw error.

i wrote code as

IF s_mt <> ca_lh or s_mt <> ca_zv .

MESSAGE e010(zcn_mm_msgclass).

ENDIF.

but if i enter any value even LH and ZV also it is throwing error

pls help me in this

9 REPLIES 9
Read only

Former Member
0 Likes
1,012

I think it should be


IF s_mt NE ca_lh OR s_mt NE ca_zv .

    MESSAGE e010(zcn_mm_msgclass).

ENDIF.

Read only

0 Likes
1,012

it is not making any difference

same error iam getting

Read only

0 Likes
1,012

Hello

IF not ca_lh in s_mt or not ca_zv in s_mt .

MESSAGE e010(zcn_mm_msgclass).

ENDIF.

Read only

GauthamV
Active Contributor
0 Likes
1,012

hi,

check this sample code.

select-options : s_massn for pa0000-massn no intervals.

at selection-screen.

loop at s_massn.

if ( s_massn-option = 'EQ' and ( s_massn-low = '10' or s_massn-low = '18' or s_massn-low = '19'

or s_massn-low = '20' or s_massn-low = '28' ) ).

else.

refresh s_massn.

clear s_massn.

message e002(zmsg).

endif.

endloop.

Read only

Former Member
0 Likes
1,012

s_mt is an internal table...so you should loop at it and check value in s_mt-low

~Piyush

Read only

KK07
Contributor
0 Likes
1,012

Hi,

i am bit confused by ur logic.

in ur code u have written message for both the values thats y u r getting the meesage.

check by giving the other values.

Read only

Former Member
0 Likes
1,012

i think ca refers to contain any



IF s_mt  ne lh or s_mt ne zv .
MESSAGE e010(zcn_mm_msgclass).
ENDIF.

Read only

Former Member
0 Likes
1,012

Hi

I think you have put wrong if statement

IF s_mt ca_lh or s_mt ca_zv .

MESSAGE e010(zcn_mm_msgclass).

ENDIF

You need to use 'AND' instead of 'OR' and you need to check for 'NE' condition

Is it select option or parameter ?

If it is select option, you need to loop and check

If it is parameter, you can directly check.

Regards

MD

Regards

MD

Read only

Former Member
0 Likes
1,012

hi,

Try this

Loop at s_mat .

if s_mat-low = 'LH' or s_mat-low = 'ZV'.

continue.

else.

<Raise Error message>

endif.

endloop.