11-13-2007 7:37 AM
i have to fetch belnr from bkpf table, and tax amount(fwste) from bset table.
if for a particular belnr suppose if this belnr 1700000000 has 5 line items in bset table than i need tax amount for all those 5 line items it means i need addition of that tax amount in output
for eg in bset table
belnr fwste lifnr curr
17000000000 0.00 0002300000 usd
2.00
0.00
4.00
in ouput i should get only subtotal has
1700000000 6.00 00023000000 usd
please help how to do its urgent
thanks in advance
11-13-2007 7:42 AM
Hi,
First get the whole data with line item details into internal table.
loop through that internal table
use COLLECT statement within the loop.
Reward if it helps,
Satish
Message was edited by:
Satish Panakala
11-13-2007 7:44 AM
u nee to two internal tables, one table for bkpf and another for bset
From bset u have to retry the information.
loop at it_bset.
at new belnr
total = 0.
endat.
total = total +amount.
at end of belnr
append total value to bkpf table based on belnr.
endat
11-13-2007 7:44 AM
Hi,
Try like this
loop at itab.
at end of belnr.
sum.
endat.
or use COLLECT statement within the loop
endloop.
Regards,
nagaraj
11-13-2007 7:48 AM
I think collect will not be useful for ur case.....
proceed as follows.....
data : begin of itab occurs 0,
belnr...
fwste...
end of itab.
if ur main internal table is itab1...
sort itab1 by belnr.
loop at itab1.
at end of belnr.
itab-belnr = itab1-belnr.
sum.
itab-fwste = itab1-fwste.
append itab.
clear itab.
endat.
endloop.
delete adjacent duplicates from itab1 comparing belnr.
loop at itab1.
read table itab with key belnr = itab1-belnr.
if sy-subrc = 0.
itab1-belnr = itab-belnr.
modify itab1 index sy-tabix.
endif.
endloop.
Regards
Vasu