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

Vofm routine query

Former Member
0 Likes
652

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.

1 REPLY 1
Read only

Former Member
0 Likes
442

Hi Kris,

your post would be more readable if you'd put {code} tags around your code.

I can't really think of a reason why somebody would do what you are describing, but can also not see what happens between the two conversions because of the above.

Greetings,

Gert.