cancel
Showing results for 
Search instead for 
Did you mean: 

exhange rate calculations in SAPScript

yurika_seko
Explorer
0 Kudos

Hi,

I am trying to calculate the total invoice amount for different currencies in a SAPScript. I am running into a couple of problems.

1: I cannot seem to find the exchange rate ( KURRF ) in KOMK/VBDKA or VBDKR, do you know where else the exhange rate would be populated?

2: I cannot seem to use the commands: /: DEFINE &my_variable&

/: &my_variable& = &KOMK-FKWRT& * &KOMK-KURRF& (pretend KURRF is populated)

is it even possible to do that sort of calculations in SAPScripts? if not, what is an easy way to accompolish this?

I only need to calculate this once.

thank you.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Yurika,

if u want to calculate exchange rate which is maintained in tcode-OB08,

all the data will be stored in Table-TCURR.

since ur saying that u do not want to change the driver program,

then go for Subroutine

perform all ur calculations in the subroutine and then pass them to form.

In script, you have this logic:

PERFORM <formname> program <progname>

using

changing

endperform

for example

/: PERFORM F_CALCULA IN PROGRAM ZCALCULATE

/: USING &KOMK-FKWRT&

/: USING &TCURR-KURSF&

/: CHANGING &CURR&

/: ENDPERFORM

Hope its helpul to you

Answers (1)

Answers (1)

former_member156446
Active Contributor
0 Kudos

u can use FM to get the value in print program..and pass them to the sap script...

The conversion rate is stored in TCURR table...

CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
        EXPORTING
          date             = <fs_komv>-kdatu "<<date of convertion
          foreign_currency = komk-waerk 
          local_amount     = wa_komp_o-netwr "<<value to convert
          local_currency   = <fs_komv>-waers
        IMPORTING
          foreign_amount   = <fs_komv>-kwert  "<<Converted value
        EXCEPTIONS
          no_rate_found    = 1
          overflow         = 2
          no_factors_found = 3
          no_spread_found  = 4
          derived_2_times  = 5
          OTHERS           = 6.

yurika_seko
Explorer
0 Kudos

Thank you for your reply. I am looking for a way to accomplish this without changing the driver program if possible.