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: 

Convert_to_local_currency doesn't return a value

walkerist
Participant
0 Kudos
478

I was trying to convert EUR to CHF from a purchase order and I'm currently having a brain fog.

The Exchange rate is 1.08085 as seen in ME23N.However, I'm not sure if I would divide or multiply the EUR with the exchange rate so I'm trying it with the function module CONVERT_TO_LOCAL_CURRENCY. However, no values were returned upon trying in SE37.

         CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
* CLIENT = SY-MANDT
date = sy-datum
foreign_amount = 73.72
foreign_currency = EUR
local_currency = CHF
RATE = 1.08085
* TYPE_OF_RATE = 'M'
* READ_TCURR = 'X'
* IMPORTING
* EXCHANGE_RATE =
* FOREIGN_FACTOR =
* LOCAL_AMOUNT =
* LOCAL_FACTOR =
* EXCHANGE_RATEX =
* FIXED_RATE =
* DERIVED_RATE_TYPE =
* EXCEPTIONS
* NO_RATE_FOUND = 1
* OVERFLOW = 2
* NO_FACTORS_FOUND = 3
* NO_SPREAD_FOUND = 4
* DERIVED_2_TIMES = 5
* OTHERS = 6
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
1 REPLY 1

Sandra_Rossi
Active Contributor
365

Invalid code. You must indicate quotes for decimal number literals (and text literals too, of course), and indicate a variable for the exporting parameters. Did you try only in SE37, or in ABAP program. I advise to always test in ABAP program, especially when SE37 doesn't work.

         CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
           EXPORTING
             date             = sy-datum
             foreign_amount   = '73.72'
             foreign_currency = 'EUR'
             local_currency   = 'CHF'
             RATE             = '1.08085'
             ...
           IMPORTING
             LOCAL_AMOUNT     = local_amount.