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: 

Currency difference can't be summarized

former_member844813
Participant
0 Kudos

Hi Experts!

in WRBTR field come out values with different currency which as u can see it's separated. is there a way to make the value with USD convert it to IDR so it can be summarized ?

Thank you.

4 REPLIES 4

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

demaauliansyah

Yes, it is possible to convert the WRBTR field values with different currency to IDR. You can use the function CURRENCY_CONVERSION which performs a currency conversion for the value passed to the formal parameter amount. The result has the data type CURR with the same technical attributes as the actual parameter passed to amount. The value passed is rounded to two decimal places before it is converted1.

Here is an example code snippet that you can use:

DATA: l_wrbtr TYPE wrbtr,
      l_idr   TYPE wrbtr.

l_wrbtr = 1000.00.
CALL FUNCTION 'CURRENCY_CONVERSION'
  EXPORTING
    amount         = l_wrbtr
    source_currency = 'USD'
    target_currency = 'IDR'
  IMPORTING
    converted_amount = l_idr.
Copy

I hope this helps! Let me know if you have any other questions.

0 Kudos

is the l_wrbtr used to change that specific value ?

xiswanto
Active Participant
0 Kudos

simply put, you need to change the data in your itab and convert them into the currency you wanted ( in this case USD -> IDR ) using function module such as above ( providing the import export parameter), or coding the conversion logic by yourself.

VXLozano
Active Contributor
0 Kudos

I think the new SQL (or via CDS) allow currency conversion. But if your system doesn't, or you don't know how to call those things, or you don't want to (or cannot to), then, before the ALV calling thing, convert your field to IDR (as yogananda.muthaiah suggested).

You can do with something like:

loop at itab assigning field-symbol(<line>).
<line>-wrtbr = your_class=>convert_to_idr( <line>-wrtbr ). "if you are using a local class, you can PERFORM CHANGING it
endloop.