Skip to Content
0
Former Member
Dec 28, 2007 at 02:46 AM

Currency conversion

121 Views

Hi All,

I would like to convert the billing document value into a reference value

eg: Billing value is 5500RS, convert to EUR (i.e. Reference Currency=EUR), Ref_Value = 100 EUR.

I am trying the below code, where if the date is not entered in the selection screen, it calculates based on the exchange rate prevailing on the date of billing document, but if a date is mentioned, then the exchange rate as on the date entered is selected.

I am facing 2 errors:

1. The conversion is not taking place.

2. The currency displayed next to the ref value is same as the billing document currency & is not displaying the reference currency

Note:

1.The exchange rate maintained in TCURR table is not on a daily basis i.e. the value of exchange if entered on Monday will hold good till the next update.

2.The values for Y_KURST, Y_WAERS & Y_DATE is eneted by the user in the query selection screen.

DATA Y_UKURS TYPE TCURR-UKURS.

CLEAR: Y_UKURS, Y_VALUE.

IF Y_DATE EQ SPACE.

SELECT SINGLE UKURS FROM TCURR INTO Y_UKURS

WHERE KURST EQ Y_KURST

AND FCURR EQ VBRK-WAERK

AND TCURR EQ Y_WAERS

AND GDATU LE VBRK-FKDAT.

Y_VALUE = VBRK-NETWR * Y_UKURS.

ELSE.

SELECT SINGLE UKURS FROM TCURR INTO Y_UKURS

WHERE KURST EQ Y_KURST

AND FCURR EQ VBRK-WAERK

AND TCURR EQ Y_WAERS

AND GDATU EQ Y_DATE.

Y_VALUE = VBRK-NETWR * Y_UKURS.

ENDIF.

Await inputs.

Vivek