Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

conversion_to_local_currency

Former Member
0 Likes
1,432

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

date = sy-datum

foreign_amount = itab_line-net_value

foreign_currency = itab_line-waers

local_currency = itab_line-currencyh.

where itab_line is the internal table for my table control.

i get the following message:

enter rate INR/$ rate type M for 26.02.2008 in the system settings.

what is 2 be done?

thanks in advance.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

date = sy-datum

foreign_amount = itab_line-net_value

foreign_currency = itab_line-waers

local_currency = itab_line-currencyh.

where itab_line is the internal table for my table control.

i get the following message:

enter rate INR/$ rate type M for 26.02.2008 in the system settings.

what is 2 be done?

thanks in advance.

8 REPLIES 8
Read only

Former Member
0 Likes
1,388

Hi,

Check whether an entry is maintained for INR and USD in database table TCURR.

If not maintain an entry and maintain the exchange rate.

Hi, also, it looks like you are passing target currency as '$' dont do that, pass USD.

Cheers.

Edited by: Aditya Laud on Feb 26, 2008 12:31 AM

Read only

Former Member
0 Likes
1,388

hi,

check this it may help you......

codeCALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

CLIENT = 001

DATE = sy-datum

FOREIGN_CURRENCY = wa1-WAERS " here you need to declare your foreign currency i.e USD

LOCAL_CURRENCY = TCURR-FCURR

FOREIGN_AMOUNT = wa1-DMBTR " here you need to declare your amount field.

RATE = tcurr-ukurs

TYPE_OF_RATE = 'M' " check this also the average rate

READ_TCURR = 'X'

IMPORTING

EXCHANGE_RATE = tcurr-UKURS

FOREIGN_FACTOR =

LOCAL_AMOUNT = wa1-TOTAL " this is the field where the converted amt has to be displayed.

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.[/code]

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.

chk these links,

hope this helps u,

Regards,

Arunsri

hope this helps you.

Read only

Former Member
0 Likes
1,388

Hi,

The reason you are getting the error message is you are not passing the exchange rate type. You need to pass the exchange rate as M or any other as per your requirment.

Basing on the exchnage rate the amount will be converted.

Thanks,

Sriram Ponna.

Read only

0 Likes
1,388

thanks for the response.

i m still facing problems.Here is my code.

itab_line-net_value = itab_line-menge * itab_line-netpr.

itab_line-currencyh = currency.

*

IF itab_line-currency <> itab_line-currencyh.

*here i want to convert currency to currencyh.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

CLIENT = SY-MANDT

date = SY-DATUM

foreign_amount = itab_line-net_value

foreign_currency = itab_line-currency

local_currency = itab_line-currencyh

RATE = 40

TYPE_OF_RATE = 'M'

READ_TCURR = 'X'

IMPORTING

  • EXCHANGE_RATE = TCURR-UKURS

    • FOREIGN_FACTOR =

LOCAL_AMOUNT = itab_line-net_value.

    • LOCAL_FACTOR =

  • EXCHANGE_RATEX = 40.

    • 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.

endif.

because of this module my netpr is becoming 0.

when i comment this module then net_value is coming out 2 be the product.cant figure out whats happening.

Read only

0 Likes
1,388

well the FM convert_to_local_currency reads the table TCURR.

if you do not have any valid records for a certain conversion, it will not work, even if you give him the conversion rate he still trys to read TCURR and whines once he doesnt find anything.

if you have a conversion rate i´d advice you to use FM CONVERT_CURRENCY_BY_RATE instead of convert_to_local_currency.

Read only

0 Likes
1,388

what date shud i put?in the tcurr table i dont have ne date corresponding to sy-dats and when i give 01.01.1998 i get a dump.what shud i do in this case?

Read only

Former Member
0 Likes
1,388

Hi,

Check the following link:

http://sapdev.co.uk/country/country_curr.htm

Regards,

Bhaskar

Read only

Former Member
0 Likes
1,388

Hi pranjal

Go to Tr.OB08 ask ur FI collegue to maintain exchange rate type M and enter factor like say 1 USd to 50 INR .

and set valid from date earlier too which ur transaction runs .

hope this helps

regards

Mandar