In my internal table datatab_lst.
i have records like below.
Gsber, seqno, compname ,AMount
011a , 001 , PMBC , 1000
011a , 002 , PMBC1, 2000
011a , 003 , PMBC2, 3000
011a , 004 , PMBC3, 4000
011a , 005 , PMBC4, 5000
130B , 001 , PMBC , 2000
130B , 002 , PMBC1, 2000
130B , 003 , PMBC2, 2000
130B , 004 , PMBC3, 2000
130B , 005 , PMBC4, 2000
two set of records with GSBER(011A,130B)
now i want to merge bothÂ@record groups and
add respective amounts
Can we use COllect statement here..its not working
how to use. below code
loop at datatab_lst.
collect datatab_lst into xtab_lst.
endloop.
not working.
ambichan
Hello,
Have an additional IntTab of fields GSBER and AMOUNT.
Data: Begin of TOT_TAB occurs 0,
GSBER like...
AMT like...
END OF TOT_TAB.
loop at DATATAB_LST.
move-corresponding DATATAB_LST to TOT_TAB.
collect TOT_TAB.
endloop.
The COLLECT statement cumulates the values. In the above case GSBER, SEQNO and COMPNAME being of CHAR Type, is considered as KEY fields.
Hope this helps you.
Regards, Murugesh AS
Add a comment