2006 Sep 27 10:48 AM
Hi Friends,
My req is to convert the local currency to usd currency.
For this i have to use fm CONVERT_TO_LOCAL_CURRENCY. Anybody will tell me how to do this with proper example??
Hi Friends,
My req is to convert the local currency to usd currency.
For this i have to use fm CONVERT_TO_LOCAL_CURRENCY. Anybody will tell me how to do this with proper example??
2006 Sep 27 10:50 AM
Hi Please see the FM Below.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = P_DATE
FOREIGN_AMOUNT = P_FVALUE
FOREIGN_CURRENCY = P_FWAERS
LOCAL_CURRENCY = P_HWAERS
RATE = P_KURS
TYPE_OF_RATE = P_KUTY
IMPORTING
EXCHANGE_RATE =
FOREIGN_FACTOR =
LOCAL_AMOUNT = P_HVALUE
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.
2006 Sep 27 10:51 AM
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = P_T_MTAB_BUDAT "date
FOREIGN_AMOUNT = P_T_MTAB_BRTWR "amt
FOREIGN_CURRENCY = P_T_MTAB_WAERS "curr
LOCAL_CURRENCY = P_C_USD
IMPORTING
local_amount = p_w_brtwr
EXCEPTIONS
no_rate_found = 1
overflow = 2
no_factors_found = 3
no_spread_found = 4
derived_2_times = 5.
IF sy-subrc <> 0.
2006 Sep 27 10:52 AM
Check the sample code for CONVERT_TO_LOCAL_CURRENCY
"convert curr - converted to EUR for SEE BV.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
date = w_fbuda "INS ML06
foreign_amount = ckomv-kwert
foreign_currency = cvbrk-waerk
local_currency = 'EUR' "Changed to EUR for SEE BV
IMPORTING
exchange_rate = w_exr "for testing
local_amount = i_sl_acccr-wrbtr
EXCEPTIONS
OTHERS = 6.
Prakash.
2006 Sep 27 10:53 AM
hi salil,
chk this.
it will consider the excahnge rate also.
DATA: gd_fcurr TYPE tcurr-fcurr,
gd_tcurr TYPE tcurr-tcurr,
gd_date TYPE sy-datum,
gd_value TYPE i.
gd_fcurr = 'EUR'.
gd_tcurr = 'GBP'.
gd_date = sy-datum.
gd_value = 10.
PERFORM currency_conversion USING gd_fcurr
gd_tcurr
gd_date
CHANGING gd_value.
Convert value to Currency value
&----
*& Form currency_conversion
&----
text
----
-->P_GD_FCURR text
-->P_GD_TCURR text
-->P_GD_DATE text
<--P_GD_VALUE text
----
FORM currency_conversion USING p_fcurr
p_tcurr
p_date
CHANGING p_value.
DATA: t_er TYPE tcurr-ukurs,
t_ff TYPE tcurr-ffact,
t_lf TYPE tcurr-tfact,
t_vfd TYPE datum,
ld_erate(12) TYPE c.
CALL FUNCTION 'READ_EXCHANGE_RATE'
EXPORTING
CLIENT = SY-MANDT
date = p_date
foreign_currency = p_fcurr
local_currency = p_tcurr
TYPE_OF_RATE = 'M'
EXACT_DATE = ' '
IMPORTING
exchange_rate = t_er
foreign_factor = t_ff
local_factor = t_lf
valid_from_date = t_vfd
DERIVED_RATE_TYPE =
FIXED_RATE =
OLDEST_RATE_FROM =
EXCEPTIONS
no_rate_found = 1
no_factors_found = 2
no_spread_found = 3
derived_2_times = 4
overflow = 5
zero_rate = 6
OTHERS = 7
.
IF sy-subrc EQ 0.
ld_erate = t_er / ( t_ff / t_lf ).
p_value = p_value * ld_erate.
ENDIF.
ENDFORM. " currency_conversion
rgds
anver
if hlped mark points
2006 Sep 27 10:54 AM
&----
*& Form CURRENCY_CHECK *
&----
-->P_T_MTAB_BUDAT text (Posting Date) *
-->P_T_MTAB_BRTWR text (Currency) *
-->P_T_MTAB_WAERS text (Currency Key) *
-->P_C_USD text (value is USD) *
<--P_W_BRTWR text (Convert Currency) *
----
FORM CURRENCY_CHECK USING P_T_MTAB_BUDAT
P_T_MTAB_BRTWR
P_T_MTAB_WAERS
P_C_USD
CHANGING P_W_BRTWR.
clear: w_brtwr.
*Function use for Convert Currency into USD Currency
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = P_T_MTAB_BUDAT
FOREIGN_AMOUNT = P_T_MTAB_BRTWR
FOREIGN_CURRENCY = P_T_MTAB_WAERS
LOCAL_CURRENCY = P_C_USD
IMPORTING
local_amount = p_w_brtwr
EXCEPTIONS
no_rate_found = 1
overflow = 2
no_factors_found = 3
no_spread_found = 4
derived_2_times = 5.
IF sy-subrc <> 0.
ENDIF.
2006 Sep 27 10:54 AM
2006 Sep 27 10:58 AM
I think you would need to use CONVERT_TO_FOREIGN_CURRENCY as you wish to convert the local currency value to USD.
The parameters to pass for the FM are
Date - Translation date.
Foreign Currency - 'USD'
Local_amount - lvalue.
Local_currency - the local currency value.
2006 Sep 27 11:00 AM
hi,
Try this..
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = SYST-DATUM
FOREIGN_AMOUNT = for_amount
FOREIGN_CURRENCY = 'USD'
LOCAL_CURRENCY = 'GPP'
* TYPE_OF_RATE = 'M'
IMPORTING
LOCAL_AMOUNT = loc_ammount
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5.
Regards,
Sailaja
2006 Sep 27 11:28 AM
Hai Salil Singh,
Go through the following Code
Use the following F.M's
CONVERT_TO_FOREIGN_CURRENCY Convert local currency to foreign currency.
CONVERT_TO_LOCAL_CURRENCY Convert from foreign currency to local currency
Check the following Code
PARAMETERS: P_UKURS LIKE TCURR-UKURS.
DATA: BEGIN OF GI_TAB OCCURS 0,
KONWA LIKE KONP-KONWA,
STPRS LIKE MBEW-STPRS,
WAERS LIKE T001-WAERS,
END OF GI_TAB.
DATA: L_STPRS LIKE MBEW-STPRS,
L_RATE LIKE TCURR-UKURS.
IF P_UKURS IS INITIAL.
CLEAR L_RATE.
ELSE.
L_RATE = P_UKURS / 100.
ENDIF.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
DATE = SY-DATUM
FOREIGN_CURRENCY = GI_TAB-KONWA
LOCAL_AMOUNT = GI_TAB-STPRS
LOCAL_CURRENCY = GI_TAB-WAERS
RATE = L_RATE
IMPORTING
FOREIGN_AMOUNT = L_STPRS
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = SY-DATUM
FOREIGN_AMOUNT = L_BELOEB
FOREIGN_CURRENCY = 'USD'
LOCAL_CURRENCY = 'DKK'
RATE = L_RATE
TYPE_OF_RATE = 'M'
IMPORTING
EXCHANGE_RATE = L_RATE
FOREIGN_FACTOR =
LOCAL_AMOUNT = L_BELOEB
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.
Regards
Sreeni
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |