Application Development and Automation 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 only

Processing internal table

Former Member
0 Likes
409

hi,

I have an internal table which has vendor, amount and currency fields. There are more than one currency exists for each vendor.

For each vendor, I have to add the amount per currency field.

I don't know how many currencies exists.hence I cannot use the statement if waers = 'EUR'.

can u please let me know the logic to do this task?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
391

hi,

sort ur internal table on the basis of vendor and currency.

sort <internal_table> ascending by lifnr waers.

now start a loop in internal table and use at end of waers ,like:

loop at <interbal_table>.

l_lifnr = <internal_table>-lifnr.

l_amount1 = <internal_table>-amount.

l_amount = l_amount1 + l_amount2.

l_waers = <internal_table>-waers.

at end of waers.

move l_lifnr to <iternal_table2>-lifnr.

move l_amount to <iternal_table2>-amount.

move l_waers to <iternal_table2>-waers.

append <internal_table2>.

endat.

l_amount2 = l_amount.

endloop.

now , <internal_table2> contains the sum of amount per curency field for each vendor.

Edited by: siddharth kumar on Dec 15, 2008 9:46 AM

2 REPLIES 2
Read only

Former Member
0 Likes
392

hi,

sort ur internal table on the basis of vendor and currency.

sort <internal_table> ascending by lifnr waers.

now start a loop in internal table and use at end of waers ,like:

loop at <interbal_table>.

l_lifnr = <internal_table>-lifnr.

l_amount1 = <internal_table>-amount.

l_amount = l_amount1 + l_amount2.

l_waers = <internal_table>-waers.

at end of waers.

move l_lifnr to <iternal_table2>-lifnr.

move l_amount to <iternal_table2>-amount.

move l_waers to <iternal_table2>-waers.

append <internal_table2>.

endat.

l_amount2 = l_amount.

endloop.

now , <internal_table2> contains the sum of amount per curency field for each vendor.

Edited by: siddharth kumar on Dec 15, 2008 9:46 AM

Read only

Former Member
0 Likes
391

Hi..

Have the internal table in the format.... Vendor..currency and amount...

Now... use AT END of CURRENCY....and COLLECT statements.... and process these within a loop..... try the F1 help for these statements for accurate syntax.

Regards...