Function documentationCurrency Conversion Locate this document in the navigation structure

 

You use this function to convert currency amounts in BCV. Currency conversion is possible into a given target currency unit in data records returned by a data provider, with the exchange rate of a given exchange rate type valid at a given conversion date. The exchange rate type specifies which of the different exchange rates (buyer, seller, average, fixed, and so on) the system uses for the conversion.

Prerequisites

BCV allows currency conversions if the following apply:

  • The result data contains at least one currency amount column and a corresponding currency unit column that are linked together.

  • You have specified the target currency unit and, possibly, an exchange rate type, as well as a conversion date.

  • You have specified appropriate exchange rates from the original to the target currency unit.

Note Note

The system triggers currency conversions during query processing. Therefore, each request for a currency conversion requires the re-execution of the query, including a new data retrieval from the data provider.

End of the note.

Note Note

The unit of currency conversion is executed in the system BCV is used in, and not necessarily the system the data is read from. If you have not set up the system landscape (automated update of the conversion factor table) properly, the conversion factors can differ between the different systems.

End of the note.

Features

Linking Quantity-Related Columns of Result Data

This graphic is explained in the accompanying text.

For each column of the result data there is one query field in the definition of the corresponding BCV query (with column ID = field ID). For more information, see Definition of Queries. Columns that contain currency amounts refer to query fields of data type CURR. Columns that contain currency units refer to query fields of data type CUKY. To allow currency conversions, a currency amount column has to be linked to the corresponding currency unit column. You can do this when defining a search connector, or a BCV query, by assigning the respective CUKY field as the reference field to the CURR field and specifying the reference type to Currency Unit. If information about the conversion date (the date on which the exchange rate is defined) is also available in the result data, a link can be created to this information, as well.

Columns that contain conversion dates refer to query fields of data type DATS. To provide the conversion date for currency conversions, you must link the currency unit column to the corresponding conversion date column. You do this when defining a search connector, or a BCV query, by assigning the respective DATS field as reference field to the CUKY field and setting the reference type to Conversion Date. For more information about BCV data types, see Data Types Used in BCV.

Providing the Conversion Target

BCV automatically generates some system-defined input fields for any BCV query that has a least one result field of data type CURR that contains a Currency Unit reference to a result field of data type CUKY. For more information, see Definition of Queries.

Query Input Field ID

Data Type

Description

Example Values

/BCV/CURRENCY_UNIT

CUKY

Target Currency Unit

EUR, USD

/BCV/EXCHANGE_RATE_TYPE

CHAR(4)

Exchange Rate Type

B (bank selling rate), M (average rate)

/BCV/CONVERSION_DATE

DATS

Conversion Date

04.11.2008

The system uses these fields to pass the concrete conversion target on to the BCV query. You can either set them to fixed values when defining a query view (see Definition of Query Views) or fill them from your input at runtime. To fill these fields at runtime, choose   Functions   Change Input   in the view area).

To trigger a currency conversion, you must fill input field /BCV/CURRENCY_UNIT. Input fields /BCV/EXCHANGE_RATE_TYPE and /BCV/CONVERSION_DATE are optional.

Determination of Exchange Rates

BCV uses data from database tables TCURR (Exchange Rates) and TCURF (Conversion Factors) to determine the exchange rate from the current currency unit of the data to the specified target currency unit. For more information about these tables, see SAP Note 783877.

You can maintain exchange rates in Customizing, under   SAP NetWeaver   General Settings   Currencies  . To be able to convert from currency unit A to currency unit B, the system must know either a direct exchange rate from A to B, or an exchange rate from A to C, and from C to B (where C is the base currency unit assigned to the exchange rate type). If no exchange rate exists for the given conversion date, the system uses the next most recent exchange rate.

Caution Caution

BCV is neither responsible for providing the exchange rate data in the BCV system nor for checking the completeness, correctness, and timeliness of this data. Both tasks are the responsibility of the user. Missing or inaccurate data may result in erroneous query results.

End of the caution.
Execution of Currency Conversion

A currency conversion is triggered when you execute a BCV query with a non-initial input field /BCV/CURRENCY_UNIT (target currency unit). If you have not filled input field /BCV/EXCHANGE_RATE_TYPE (exchange rate type), the system uses default exchange rate type M (average rate). If you have not filled input field /BCV/CONVERSION_DATE (conversion date), the system uses either the conversion date it takes from the result data (if a Conversion Date link exists) or the current date.

The system performs currency conversion after the search connector has returned the requested (raw) result data and the system has performed method CHANGE_RAW_DATA of Business Add-In (BAdI) BAdI: Processing of Query Results (/BCV/QRM_QUERY_RESULT). This means that the system performs currency conversion before formula calculations, grouping, aggregation, and sorting of the result data. In the query result data, the system converts the values of all currency amount columns that are linked to a corresponding currency unit column. For more information, see section Specification of Target Currency Unit, Exchange Rate Type, and Conversion Date above. The only exceptions are currency amount columns where you have set the No Conversion checkbox in the corresponding query field.

When the conversion of a value was successful, the system replaces the original value of the currency amount column with the converted value. Furthermore, it replaces the original unit of the corresponding currency unit column with the target unit.

Handling of Conversion Failures

If the conversion of a currency amount fails because of an invalid (unknown) original currency unit, or a missing appropriate exchange rate, the system raises an exception and the query does not return any result data.

Business Add-In (BAdI) 'BAdI: Currency Conversion'

If you want to replace the currency conversion function delivered by SAP, create an implementation of the BAdI BAdI: Currency Conversion (/BCV/FND_CURRENCY_CONV). In Customizing, choose   Cross-Application Components   Processes and Tools for Enterprise Applications   Business Context Viewer   Foundation, Monitoring   Business Add-Ins (BAdIs) for Foundation, Monitoring   BAdI: Currency Conversion  .

The BAdI has the filter APPLICATION defined for the application (PLM, ERP, SCM, and so on) in whose context key the system processes the current query. For more information about the use of the context key, see Context Key. At runtime, the system determines the active implementation of the BAdI whose filter value matches the current application. You can define which context key refers to which application in Customizing, under   Cross-Application Components   Processes and Tools for Enterprise Applications   Business Context Viewer   Foundation, Monitoring   Define Context Key  .

Depending on the source of exchange rates you used in the BAdI implementation, you have to provide appropriate exchange rate information at the respective place. If no active BAdI implementation exists, the system determines exchange rates from database tables TCURR and TCURF. For more information, see section Determination of Exchange Rates above.

Note Note

For each application, a maximum of one active BAdI implementation is allowed to exist in the BCV system.

End of the note.