2007 Nov 13 9:06 PM
Hi Guys,
I am having an Internal table with G/L account number and Amount in Local Currency .so in this we will have some g/l account number's repeated with different amount.I need to add all the Amounts in the amount column with same G/L account number and make it into a single entry.so how to do this ?
Thanks,
Gopi.
2007 Nov 13 9:08 PM
COLLECT will do it easily.
DO like this:
LOOP AT ITAB.
IT_SUM-GL_ACC = ITAB-GL_ACC.
IT_SUM-AMOUNT = ITAB-AMOUNT.
COLLECT IT_SUM.
CLEAR IT_SUM.
ENDLOOP.
Regards,
Naimesh Patel
2007 Nov 13 9:08 PM
COLLECT will do it easily.
DO like this:
LOOP AT ITAB.
IT_SUM-GL_ACC = ITAB-GL_ACC.
IT_SUM-AMOUNT = ITAB-AMOUNT.
COLLECT IT_SUM.
CLEAR IT_SUM.
ENDLOOP.
Regards,
Naimesh Patel
2007 Nov 13 9:14 PM
Hi Gopi,
declare another wa1 same as wa.
declare final_tab same as itab.
clear wa1.
sort itab by accno.
loop at itab into wa.
if wa-accno = wa1-accno.
wa-amt = wa-amt + wa1-amt.
modify final_tab from wa transporting amt.
else.
append wa to final_tab.
endif.
wa1 = wa
endloop.
Reward if it helps,
Satish
2023 Apr 14 8:06 AM