2012 May 02 7:03 AM
currency convertion
i want to convert currency from sap internal currency to deffrent courency (local as per the country)
please can any body help me
Moderator message: FAQ, please search for available information before posting.
Message was edited by: Thomas Zloch
currency convertion
i want to convert currency from sap internal currency to deffrent courency (local as per the country)
please can any body help me
Moderator message: FAQ, please search for available information before posting.
Message was edited by: Thomas Zloch
2012 May 02 7:10 AM
2012 May 02 7:13 AM
Check the following code:
DATA: CHANGE_DATE LIKE SYST-DATUM,
FOREIGN_CURRENCY TYPE WAERS,
LOCAL_CURRENCY TYPE WAERS,
LOCAL_AMOUNT TYPE WRBTR,
FOREIGN_AMOUNT TYPE WRBTR.
* Set the date for the change
CHANGE_DATE = SY-DATUM.
LOCAL_CURRENCY = 'USD'.
FOREIGN_CURRENCY = 'BRL'.
MOVE 20000 TO LOCAL_AMOUNT.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
DATE = CHANGE_DATE
FOREIGN_CURRENCY = FOREIGN_CURRENCY
LOCAL_AMOUNT = LOCAL_AMOUNT
LOCAL_CURRENCY = LOCAL_CURRENCY
IMPORTING
FOREIGN_AMOUNT = FOREIGN_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 ne 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
WRITE: 'Local amount :', LOCAL_AMOUNT CURRENCY LOCAL_CURRENCY,
LOCAL_CURRENCY,
/'Foreign amount:', FOREIGN_AMOUNT CURRENCY FOREIGN_CURRENCY,
FOREIGN_CURRENCY.
ENDIF.
SKIP 2.
FOREIGN_CURRENCY = 'BRL'.
LOCAL_CURRENCY = 'USD'.
MOVE 1000 TO FOREIGN_AMOUNT.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = CHANGE_DATE
FOREIGN_AMOUNT = FOREIGN_AMOUNT
FOREIGN_CURRENCY = FOREIGN_CURRENCY
LOCAL_CURRENCY = LOCAL_CURRENCY
IMPORTING
LOCAL_AMOUNT = LOCAL_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 ne 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
WRITE: 'Foreign amount:', FOREIGN_AMOUNT CURRENCY FOREIGN_CURRENCY,
FOREIGN_CURRENCY,
/'Local amount :', LOCAL_AMOUNT CURRENCY LOCAL_CURRENCY,
LOCAL_CURRENCY.
ENDIF.
2012 May 02 7:26 AM
thanks Krupa Janiji
but if the currency that want to convert is in sap table BSIS-waers
and program should outomaticly converted to local currency whitout Specify the currency ??
so if me in UAE it convert to UAE currency if me in oman it convert to oman currency
hope u understand my point
2012 May 02 8:23 AM
Hi Safiya,
By using T005 table, u can get the currency key for the corresponding country. Then u can assign the currency code to FOREIGN_CURRENCY before calling the FM 'CONVERT_TO_FOREIGN_CURRENCY' .
Thanks.
Dhivya.
2012 May 02 7:21 AM
Hi,
You can use the FM 'CONVERT_TO_LOCAL_CURRENCY'.
regards,
tania.
2012 May 02 7:31 AM
Hi,
FM used is
| CONVERT_TO_FOREIGN_CURRENCY | Convert local currency to foreign currency. |
Pls go through the below link for conversion using BAPI
http://help.sap.com/saphelp_nw04/helpdata/en/a5/3ec9ea4ac011d1894e0000e829fbbd/content.htm
2012 May 02 8:16 AM
HI
still in oman its 3 desimal but the result come 2 decimal
how can solve the problem
2012 May 02 8:30 AM
Hi Safiya,
In table TCURX, for OMAN 3 decimal places is allocated. So only u r getting like that.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |