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

Function Module..?

Former Member
0 Likes
482

Hi All,

What is the exact purpose of the below FM?

CONVERT_TO_FOREIGN_CURRENCY

Akshitha.

3 REPLIES 3
Read only

Former Member
0 Likes
454

Hi,

"CONVERT_TO_FOREIGN_CURRENCY" – This translates local currency amount into foreign currency.

An amount in foreign currency is calculated from a specified local currency amount. 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. The ratios for the units of the currencies involved in the translation are significant for this translation, table TCURR is always read by the program and there must be a valid entry for the data specified. If exchange rate fixing is defined for exchange rate type TYPE_OF_RATE, or an alternative exchange rate type 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. If this entry is not in the table, the key is re-read in reverse sequence.

Here’s a sample code:

CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'

EXPORTING DATE = BKPF-WWERT

FOREIGN_CURRENCY = BKPF-WAERS

LOCAL_CURRENCY = T001-WAERS

LOCAL_AMOUNT = BSEG-DMBTR

RATE = BKPF-KURSF

TYPE_OF_RATE = 'M'

IMPORTING EXCHANGE_RATE = KURS

FOREIGN_AMOUNT = BSEG-WRBTR

FOREIGN_FACTOR = FAKTOR-F

LOCAL_FACTOR = FAKTOR-L

EXCEPTIONS NO_RATE_FOUND = 4

NO_FACTORS_FOUND = 8.

Reward if helpful.

Regards,

Ramya

Read only

Former Member
0 Likes
454

Hi Akshitha,

As the name suggests Converts local currency to Foreign., Click on the Function Module Documentation, You'll get all the Info on the FM.

Regards,

Sai

Read only

dhruv_shah3
Active Contributor
0 Likes
454

Hi,

CONVERT_TO_FOREIGN_CURRENCY Convert local currency to foreign currency.

E.g

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.

HTH

Regards,

Dhruv Shah