04-11-2008 7:35 PM
I want to aggregate quantity field(MARD-LABST) based on
werks and lgort. Please explain
me sample example ?
Kindly explain me.
04-11-2008 7:40 PM
Don't have an an eample right now but you should search in this forum for the abap statement COLLECT.
Good luck,
Bert
04-11-2008 7:47 PM
Hi Saritha,
As suggested..you can use collect statements:
Imagine you have a table with 3 fields
werks / lgort / quantity and stored in an internal table
using collect statement all numeric values will be added
so you have values in itab as fillows
WERK1 STORAGE1 001
WERK2 STORAGE1 100
WERK1 STORAGE2 200
WERK1 STORAGE1 100
so first (1) create anither internal table same as itab lets say itab_coll
(2)do a sort statement on itab
WERK1 STORAGE1 001
WERK1 STORAGE1 100
WERK2 STORAGE1 100
WERK1 STORAGE2 200
loop at itab into workarea.
collect workarea to itab_coll.
endloop.
output:
WERK1 STORAGE1 101(adds same werks/lgort quantities)
WERK2 STORAGE1 100
WERK1 STORAGE2 200
so collect does an append + sum if the non-numeric fields are similar..but keep in mind that all numeric fields will be added
Regards
Byju