Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

help in exchange currency

HI,

i need to buield simple progarm that the input

<b>input</b>

orignal currency code (what i wont to exchange)

destination currency code (exchange to)

period (month and year)

<b>output</b>

type of measure exchange

maybe some one can help with fields from table that i can use

or function?

Regards

<b>i reward</b>

Tags:
Former Member
Former Member replied

Hi Tal,

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 = 'CAD'
LOCAL_CURRENCY = 'USD'
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.

Thanks,

Reward If Helpful.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question