Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

read table

Former Member
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

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

Former Member
0 Kudos

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

former_member404244
Active Contributor
0 Kudos

Hi,

Try like this

loop at itab.

at end of belnr.

sum.

endat.

or use COLLECT statement within the loop

endloop.

Regards,

nagaraj

Former Member
0 Kudos

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