Skip to Content
0
Former Member
May 15, 2008 at 06:22 AM

Vofm routine query

210 Views

Hi,

I found this code within a vofm routine formala, could someone please let me know why is the currency being changed frm foreign to local and local to foreign again.

  • P-Variant Discounts

form frm_kondi_wert_019.

data: xkbetr like xkomv-kbetr.

  • take into account active conditions only

check xkomv-kinak eq space.

  • set net price with 4 decimals

if nettopreis is initial.

nettopreis = ykbetr * 100. "in currency YWAERS

endif.

  • prepare local XKBETR

xkbetr = xkomv-kbetr. "here XKBETR is in currency XKOMV-WAERS

  • convert XKBETR from XKOMV-WAERS to YWAERS in two steps

if xkomv-krech na percental and xkomv-waers ne ywaers.

  • first step: convert XKBETR from XKOMV-WAERS to KOMK-HWAER

if xkomv-waers ne komk-hwaer.

call function 'CONVERT_TO_LOCAL_CURRENCY'

exporting

date = xkomv-kdatu

foreign_amount = xkbetr

foreign_currency = xkomv-waers

local_currency = komk-hwaer

rate = xkomv-kkurs

type_of_rate = kurstyp

importing

exchange_rate = xkomv-kkurs

local_amount = xkbetr

exceptions

others = 4.

endif.

  • second step: convert XKBETR from KOMK-HWAER to YWAERS

if ywaers ne komk-hwaer.

call function 'CONVERT_TO_FOREIGN_CURRENCY'

exporting

date = ykdatu

local_amount = xkbetr

foreign_currency = ywaers

local_currency = komk-hwaer

rate = ykkurs

type_of_rate = kurstyp

importing

foreign_amount = xkbetr

exceptions

others = 4.

endif.

endif. "now XKBETR is in currency KOMK-WAERK

if xkomv-krech = 'A'.

  • percentages

  • actual net price

nettopreis = nettopreis

+ ( xkbetr * ykbetr ) / 1000.

  • quantity dependant

  • actual net price

elseif xkomv-krech = 'C'.

nettopreis = nettopreis

+ ( xkbetr * ykpein * ykumza * xkomv-kumne * 100 )

/ xkomv-kumza / xkomv-kpein / ykumne.

elseif xkomv-krech ca 'DEF'.

if komp-mglme ne 0.

nettopreis = nettopreis

+ ( xkbetr * ykpein * ykumza * xkomv-kawrt * 100 )

/ komp-mglme / xkomv-kpein / ykumne.

endif.

else.

xkomv-kinak = 'X'.

komp-prsok = ' '.

endif.

endform.

Points will be rewarded immediately.

Thank you.