‎2008 May 21 9:56 AM
Hi Guru's,
my pgm is same mvt against total the qty.
i am using itab and work area.
data declare :
itab,
matnr like mseg-matnr,
bwart like mseg-bwart,
menge like mseg-menge,
menis like mseg-menge
inw (15) type p,
end itab.
loop.
if bwart = '101'.
move itab-menge to itab-inw.
modify itab.
endif.
endloop.
Wanted Result : mvt agianst to move qty in inw, but single qty coming.
Eg:bwart matnr menge
101 A 50
101 A 8
101 B 48
101 B 15
Result to 101 - A - 58
101 - B - 63
plz clear the issue ,what way i am using in collect statement.
thanks,
jay
‎2008 May 21 10:00 AM
‎2008 May 21 10:29 AM
Try this:
declare itab2 = itab1.
loop at itab1 into wa.
...
...
COLLECT wa INTO itab2.
endloop.
‎2008 May 21 11:38 AM
Declare the another internal table it_sum with key bwart and matnr.
Data: it_sum like itab_type with key bwart matnr,
wa_sum like itab_type.
clear wa,it_sum[].
loop at itab into wa.
clear wa_sum.
wa_sum-bwart = wa-bwart.
wa_sum-matnr = wa-matnr.
wa_sum-menge = wa-menge.
collect wa_sum to it_sum.
endloop.
The internal table it_sum will contain the total value of menge with respect to bwart and matnr.
‎2008 May 21 1:24 PM
Hi,
Check the code and do accordingly
Lets say if you have an internal table ITAB which has the fields vbeln, matnr, fkimg and netwr..
Create another internal table with vbeln, fkimg, netwr..
DATA: BEGIN OF ITAB_COLL OCCURS 0,
VBELN LIKE ITAB-VBELN,
FKIMG LIKE ITAB-FKIMG,
NETWR LIKE ITAB-NETWR,
END OF ITAB_COLL.
LOOP AT ITAB.
MOVE-CORRESPONDING ITAB TO ITAB_COLL.
COLLECT ITAB_COLL.
ENDLOOP.
Reward for useful answers.
Regards,
Raj.
‎2008 May 21 3:32 PM
Hi,
try this.
Loop at itab1 into wa_itab1.
itab2-field = wa_itab1-field. (do for all fields)
collect itab2.
endloop.
regards
Sandeep Reddy