cancel
Showing results for 
Search instead for 
Did you mean: 

Convert to local currency in pricing IPC JAVA

Former Member
0 Kudos
197

Hi Experts,

I am replicating the routines from ECC to CRM through JAVA coding. I just came accross a routine which makes a call to FM 'CONVERT_TO_LOCAL_CURRENCY'. After searching from SAPSTANDARDEXITS, I got an API in JAVA as ConvertTo where some parameters are apssed.

I would really be happy if you guide me to code this FM in JAVA. The FM signature is :

  CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
        EXPORTING
          date                    = sy-datum
          foreign_amount          = xkomv-kwert
          foreign_currency        = tkomk-waerk
          local_currency          = ls_tvko-waers
        IMPORTING
          LOCAL_AMOUNT            = ld_kwert
        EXCEPTIONS
          NO_RATE_FOUND           = 1
          OVERFLOW                = 2
          NO_FACTORS_FOUND        = 3
          NO_SPREAD_FOUND         = 4
          DERIVED_2_TIMES         = 5
          OTHERS                  = 6
                .

However in JAVA I could not proceed with writing the method call or using API convertTo (provided in CashDiscount.java in SAP standard exits). Is this API to be used or is there another API for currency conversion to local currency. Any helps would be highly appreciated.

Regards,

Mayank

View Entire Topic
ARJUN
Explorer
0 Kudos

Hey Mayank,

See if you can make use of the Interface ICurrencyConversionResult which comes in the package com.sap.spe.conversion;

This has two methods

public ICurrencyValue getValue();
     @return        currency value which is the result of currency conversion

public IExchangeRate getExchangeRate();
     @return        the local exchange rate which was used for currency conversion