‎2007 Apr 27 8:19 AM
can any one please tell how this fm can be used in the pgm
input/opt fileds and all
CONVERT_TO_LOCAL_CURRENCY
CONVERT_TO_FOREIGN_CURRENCY
‎2007 Apr 27 8:21 AM
Hi arun
<b>
The best way to know about the function module and its parameters is just go to SE37 and display these FMs and find its Documentation ,,
These two has the Documentation you can find the best explanation about the function modules and its parameters with examples also ......</b>
check these examples
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
date = sy-datum
foreign_amount = XXXX "enter the amount which is to be converted
foreign_currency = YYY "enter the currency of the amount to be converted
local_currency = ZZZ "enter the to currenct
* RATE = 0
TYPE_OF_RATE = 'M' "enter the type of the rate
READ_TCURR = 'X' "check this is you want to take the data from table tcurr
IMPORTING
EXCHANGE_RATE =
* FOREIGN_FACTOR =
LOCAL_AMOUNT = amt "this is your result
* 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
Check this example
DATA: v_amount TYPE p DECIMALS 2.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
date = sy-datum
foreign_currency = 'INR'
local_amount = '1.00'
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.
.
Regards Rk
Message was edited by:
Rk Pasupuleti
‎2007 Apr 27 8:23 AM
Hi Arun,
<b>Try this code.</b>
data: IV_EXCH_RATE_DATE TYPE CNVT_EXCH_RATE_DATE,
IV_EXCH_RATE_TYPE TYPE CNVT_EXCH_RATE_TYPE,
IV_EXCH_RATE TYPE CNVT_EXCH_RATE,
IV_FOREIGN_CURRENCY TYPE CNVT_FOREIGN_CURRENCY_UNIT,
IV_LOCAL_CURRENCY TYPE CNVT_LOCAL_CURRENCY_UNIT,
IV_AMOUNT TYPE CNVT_CURRENCY_AMOUNT.
perform check_convert_to_local using iv_exch_rate_date
iv_exch_rate_type
iv_exch_rate
iv_amount
iv_foreign_currency
iv_local_currency.
&----
*& Form check_convert_to_local
&----
text
----
form check_convert_to_local
using uv_exch_date type cnvt_exch_rate_date
uv_exch_type type cnvt_exch_rate_type
uv_exch_rate type cnvt_exch_rate
uv_foreign_amount type cnvt_foreign_currency_amount
uv_foreign_currency type cnvt_foreign_currency_unit
uv_local_currency type cnvt_local_currency_unit.
variables for ABAP call
data: lv_local_amount_abap type cnvt_foreign_currency_amount,
lv_local_amount_abap2(16) type p decimals 3,
lv_local_amount_java type cnvt_local_currency_amount.
write: / text-101 color 7.
write: / text-009,
uv_foreign_amount,
text-010,
text-013,
uv_foreign_currency,
text-011,
text-012,
uv_local_currency.
call ABAP
call function 'CONVERT_TO_LOCAL_CURRENCY'
exporting
CLIENT = SY-MANDT
date = uv_exch_date
foreign_amount = uv_foreign_amount
foreign_currency = uv_foreign_currency
local_currency = uv_local_currency
rate = uv_exch_rate
type_of_rate = uv_exch_type
READ_TCURR = 'X'
importing
exchange_rate = lv_erate
FOREIGN_FACTOR =
local_amount = lv_local_amount_abap
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
into gv_message.
write: / gv_message.
endif.
lv_local_amount_abap2 = lv_local_amount_abap. "rounding
endform. "check_convert_to_local
<b>Reward points if it solves ur query or answer is helpful</b>
Thanks
Chinmay
‎2007 Apr 27 8:24 AM
hi
if you want do currency conversion,goto transaction SE37 just use CONVERT_TO_LOCAL_CURRENCY,and fill all required fields in that function module.
use CONVERT_TO_FOREIGN_CURRENCY as similar to above
please reward my answer.
‎2007 Apr 27 8:27 AM
hi,
Translate foreign currency amount to local currency
An amount in local currency is calculated from a specified foreign
currency amount. For this, you may either specify the translation rate
manually (Parameter RATE) or have the system determine it from table
TCURR on the basis of the rate type, date and currency key. Because the
ratios for the units of the currencies involved in the translation are
significant for this translation, table TCURF is always read by the
program, and there must be a valid entry there for the data specified.
IF exchange rate fixing is defined for the exchange rate type
TYPE_OF_RATE or an alternative exchange rate is defined for the currency
pair, this information is transferred to the calling program.
When table TCURR is read, the foreign currency key is always taken as
the first part of the key and the local currency as the second part.
Sample call-up:
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING DATE = BKPF-WWERT
FOREIGN_CURRENCY = BKPF-WAERS
LOCAL_CURRENCY = T001-WAERS
FOREIGN_AMOUNT = BSEG-WRBTR
FOREIGN_AMOUNT = BSEG-WRBTR
RATE = BKPF-KURSF
TYPE_OF_RATE = 'M'
IMPORTING EXCHANGE_RATE = KURS
LOCAL_AMOUNT = BSEG-DMBTR
FOREIGN_FACTOR = FAKTOR-F
LOCAL_FACTOR = FAKTOR-L
FIXED_RATE = FIXKURS
EXCEPTIONS NO_RATE_FOUND = 4
NO_FACTORS_FOUND = 8.
Parameters
CLIENT
DATE
FOREIGN_AMOUNT
FOREIGN_CURRENCY
LOCAL_CURRENCY
RATE
TYPE_OF_RATE
READ_TCURR
EXCHANGE_RATE
FOREIGN_FACTOR
LOCAL_AMOUNT
LOCAL_FACTOR
EXCHANGE_RATEX
FIXED_RATE EXCHANGE_RATEX
FIXED_RATE
DERIVED_RATE_TYPE
xceptions
NO_RATE_FOUND
OVERFLOW
NO_FACTORS_FOUND
NO_SPREAD_FOUND
DERIVED_2_TIMES
unction Group
SCUN
u can also check this from TC se37:- go to that FM and click on FM Documentation.
Reward points if helpful.
Regards
Nilesh