07-04-2008 12:55 PM
07-04-2008 1:05 PM
Hi Sanjeev,
Welcome to SDN.
Before posting always search for the topic in SDN. If do not get any solution then go for posting a question.
This can be done using the function modules:
CONVERT_TO_LOCAL_CURRENCY .
CONVERT_TO_FOREIGN_CURRENCY.
Try the following example:
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
date = sy-datum
foreign_amount = x_booking-forcuram
foreign_currency = x_booking-forcurkey
local_currency = local_currency
IMPORTING
exchange_rate =
foreign_factor = fremdkurs
local_amount = local_amount
local_factor =
exchange_ratex = faktorsum
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.
Hope this helps you.
Regards,
Chandra Sekhar
07-04-2008 12:57 PM
Hi
U can use the fms CONVERT_TO_FOREIGN_CURRENCY or CONVERT_TO_LOCAL_CURRENCY
Max
07-04-2008 1:00 PM
07-04-2008 2:00 PM
Hi
U should a code like this:
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.
* If GBP is local currency and EUR is foreign currency
LOCAL_CURRENCY = 'GBP'.
FOREIGN_CURRENCY = 'EUR'.
MOVE 1000 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 <> 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.
* If GBP is foreign currency currency and EUR is local currency
FOREIGN_CURRENCY = 'GBP'.
LOCAL_CURRENCY = 'EUR'.
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 <> 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.
Which function module to be used should be decided in order to the company code currency (local currency).
If the currencies you're using aren't the currency of company code u can use the fm u prefer.
Max
07-04-2008 1:00 PM
Hi,
Chk this:
http://www.saptechies.com/how-to-convert-from-one-currency-value-to-other/
Thanks,
Keerthi.
07-04-2008 1:05 PM
Hi Sanjeev,
Welcome to SDN.
Before posting always search for the topic in SDN. If do not get any solution then go for posting a question.
This can be done using the function modules:
CONVERT_TO_LOCAL_CURRENCY .
CONVERT_TO_FOREIGN_CURRENCY.
Try the following example:
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
date = sy-datum
foreign_amount = x_booking-forcuram
foreign_currency = x_booking-forcurkey
local_currency = local_currency
IMPORTING
exchange_rate =
foreign_factor = fremdkurs
local_amount = local_amount
local_factor =
exchange_ratex = faktorsum
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.
Hope this helps you.
Regards,
Chandra Sekhar