10-01-2012 1:58 PM
Hi all.
I'm using FM CONVERT_TO_LOCAL_CURRENCY in a program, but it doesn't work. My code is:
DATA: aux(200).
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
* CLIENT = SY-MANDT
date = sy-datum
foreign_amount = p_zovh_overhead
foreign_currency = zovh-twaer
local_currency = 'EUR'
RATE = 0
TYPE_OF_RATE = 'M'
READ_TCURR = 'X'
IMPORTING
* EXCHANGE_RATE =
* FOREIGN_FACTOR =
LOCAL_AMOUNT = AUX
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
In variable AUX any value is get. I have tested this FM in sm37 and it doesn't work.
Can you help me? Thanks a lot.
Marta.
10-01-2012 2:55 PM
Hi,
Please change the type of AUG to the same type of
p_zovh_overhead.
I used in the following way:
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
date = sy-datum
foreign_amount = ekpo-brtwr
foreign_currency = eine-waers
local_currency = 'EUR'
IMPORTING
local_amount = ekpo-brtwr
EXCEPTIONS
no_rate_found = 1
overflow = 2
no_factors_found = 3
no_spread_found = 4
OTHERS = 5.
IF sy-subrc NE 0.
CLEAR ekpo-brtwr.
ENDIF.
10-01-2012 2:55 PM
Hi,
Please change the type of AUG to the same type of
p_zovh_overhead.
I used in the following way:
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
date = sy-datum
foreign_amount = ekpo-brtwr
foreign_currency = eine-waers
local_currency = 'EUR'
IMPORTING
local_amount = ekpo-brtwr
EXCEPTIONS
no_rate_found = 1
overflow = 2
no_factors_found = 3
no_spread_found = 4
OTHERS = 5.
IF sy-subrc NE 0.
CLEAR ekpo-brtwr.
ENDIF.
10-01-2012 2:57 PM
It is used in the standard code and in customer developments all over the world, so it does work, provided the input is correct and conversion rates are maintained.
Since many of the parameters are not typed, you'll have to scroll your screen all the way to the right in SE37 testing in order the see the returned values.
Any reason why you declare AUX as character length 200 instead of a proper amount field?
Thomas
10-01-2012 6:06 PM
hi marta,
parameter lc_amount type p decimal 2.
DATA: v_amount TYPE p DECIMALS 2.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
date = sy-datum
foreign_currency = 'INR'
local_amount = lc_amount
local_currency = 'USD'
IMPORTING
foreign_amount = v_amount
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.
WRITE: / 'US dollar to Indian rupees - ', v_amount.
ENDIF.
Hope this will work
Thanks
Anshul
10-02-2012 6:52 AM
Hi all.
Thanks a lot. The problem was type of AUX variable. FM works in the program. I don't know why FM doesn`t work when I executed it from sm37, but program works and it is good.
Thanks again.