Application Development 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: 

using FM CONVERT_TO_LOCAL_CURRENCY

0 Kudos
2,769

Hi everyone!!!

its me again! it's been quite a while since I posted on the forums. I do have another question from a newbie here.

I am using convert to local currency to convert VBRK-NETWR from VBRK-KURRF to the local currency for Poland (PLN).


data: lv_amount type p decimals 2,
         p_vbeln type vbrk-vblen value '90000123,'
         in_netwr type vbrk-netwr,
        in_waerk type vbrk-waerk,
         in_curr type vbrk-kurrf,
         in_fkdat type vbrk-fkdat.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
  EXPORTING
*   CLIENT                  = SY-MANDT
    date                    = in_fkdat
    foreign_amount          = in_netwr
    foreign_currency        = in_waerk
    local_currency          = 'PLN'
   RATE                    = in_curr
*   TYPE_OF_RATE            = 'M'
*   READ_TCURR              = 'X'
 IMPORTING
*   EXCHANGE_RATE           =
*   FOREIGN_FACTOR          =
   LOCAL_AMOUNT            = LV_AMOUNT
*   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
          .
IF sy-subrc = 0.

  WRITE: LV_AMOUNT.
ENDIF.

This code is giving me an error "Enter rate / USD rate type M for 00/00/0000 in the system settings". Do I need to ask BASIS to setup something to fix this?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
282

Hi,

As you are trying to post in two different currencies. follow the below sequence

SAP Customizing Implementation Guide > SAP NetWeaver > General Settings > Currencies > Enter Exchange Rates or TCode OB08.

Thanks & regards.

4 REPLIES 4

Former Member
0 Kudos
283

Hi,

As you are trying to post in two different currencies. follow the below sequence

SAP Customizing Implementation Guide > SAP NetWeaver > General Settings > Currencies > Enter Exchange Rates or TCode OB08.

Thanks & regards.

0 Kudos
282

Yes. I need to show both foreign and local currency amounts. I still need to set the exchange rate even if the rate I am going to use is VBRK-KURRF?

0 Kudos
282

hI,

You can find the rate by using the FM READ_EXCHANGE_RATE

if local_currency = 'MXN' and foreign_currency = 'USD'.

l_rate_type = 'MXNT'.

else.

l_rate_type = 'M'.

endif.

*Call FUNCTION module to get exchange rate

call function 'READ_EXCHANGE_RATE'

exporting

date = sy-datum

foreign_currency = local_currency

local_currency = foreign_currency

type_of_rate = l_rate_type

importing

exchange_rate = l_rate

foreign_factor = l_f_fact

local_factor = l_l_fact

exceptions

no_rate_found = 1

no_factors_found = 2

no_spread_found = 3

derived_2_times = 4

overflow = 5

zero_rate = 6

others = 7

Then use the FM CONVERT_TO_LOCAL_CURRENCY to get the local currency.

call function 'CONVERT_TO_LOCAL_CURRENCY'

exporting

foreign_currency = 'USD'

local_currency = 'MXN'

foreign_amount = wa_rseg-wrbtr

rate = wa_rbkp-kursf

date = sy-datum

importing

local_amount = dmbtr

exceptions

error_message = 1.

as mentioned in a link..

Thanks & regards,

Former Member
0 Kudos
282

Hi Dgrachee ;

Maintain that currency in the OB08 tcode . The currency is blank as displayed in error , that is the problem.

Regards.

Özgün