‎2007 Feb 16 5:54 AM
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
‎2007 Feb 16 5:59 AM
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
‎2007 Feb 16 6:01 AM
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
‎2007 Feb 16 6:02 AM
so you can change
if w_mseg-bwart NOT between r_bwart..
regards
shiba dutta
‎2007 Feb 16 6:10 AM
HI.
ELSEIF not w_mseg-bwart between r_bwart-low AND r_bwart-HighRegards
Sudheer
‎2007 Feb 16 7:36 AM
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.