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

Range

Former Member
0 Likes
517

Hi,

I have to take sum of MENGE of Materails according to Movement types

I have created a Range ""r_bwart"" which has 101,102,105,106 .... movement types.

Suppose i need to take sum of MENGE of materials which are not in this Range r_bwart can i use the following code below ( Code commended in BOLD and underlined )...

LOOP AT t_mseg INTO w_mseg.

IF ( w_mseg-bwart = c_651 OR w_mseg-bwart = c_652 ).

w_custre = w_custre + w_mseg-menge.

ELSEIF ( w_mseg-bwart = c_101 OR w_mseg-bwart = c_102

OR w_mseg-bwart = c_105 OR w_mseg-bwart = c_106

OR w_mseg-bwart = c_122 OR w_mseg-bwart = c_123

OR w_mseg-bwart = c_301 OR w_mseg-bwart = c_302

OR w_mseg-bwart = c_305 OR w_mseg-bwart = c_306 ) .

w_posto = w_posto + w_mseg-menge.

ELSEIF ( w_mseg-bwart = c_601 OR w_mseg-bwart = c_602 ).

w_so = w_so + w_mseg-menge.

ELSEIF ( w_mseg-bwart = c_641 OR w_mseg-bwart = c_642

OR w_mseg-bwart = c_301 OR w_mseg-bwart = c_302 ).

w_stointm = w_stointm + w_mseg-menge.

<u><b>ELSEIF ( w_mseg-bwart NOT IN r_bwart ).</b></u>

w_otrmo = w_otrmo + w_mseg-menge.

ENDIF.

ENDLOOP.

Regards Avi

5 REPLIES 5
Read only

Former Member
0 Likes
480

Hi,

When you have checked for all conditions(movement Types) with ELSEIF's, then the last ELSE will automatically give the leftout sum of the quantities.

So just place <b>ELSE</b> instead of

<b>ELSEIF ( w_mseg-bwart NOT IN r_bwart ).</b>

Regards,

Anji

Read only

Former Member
0 Likes
480

i think in IF you can not use IN operator only range operator is [not] BETWEEN.

please correct me if i am wrong.

regards

shiba dutta

Read only

Former Member
0 Likes
480

so you can change

if w_mseg-bwart NOT between r_bwart..

regards

shiba dutta

Read only

Former Member
0 Likes
480

HI.

ELSEIF not w_mseg-bwart between r_bwart-low AND r_bwart-High

Regards

Sudheer

Read only

Former Member
0 Likes
480

U have to use as belwo:

<b>ELSEIF NOT w_mseg-bwart IN r_bwart .</b>

This will work. Reward points if this solves.

Try this for sample.

data: test LIKE mara-matnr value '10000002'.
if NOT test in s_test.
write:/ 'test mara'.
elseif NOT test in s_test.
endif.