‎2008 Dec 15 8:34 AM
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?
‎2008 Dec 15 8:45 AM
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
‎2008 Dec 15 8:45 AM
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
‎2008 Dec 15 9:04 AM
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...