Conversion Handling in OData Channel
Use
OData Channel offers a way for applications to delegate handling of conversion exits, currency, currency amount, unit of measurement, and unit amount conversions to the SAP Gateway framework.
Conversions for the following operations in inbound and outbound flow are available:
-
Create entity
-
Update entity
-
Read entity
-
Read entity set
The following types conversions are covered:
-
Conversions exits (for example, ALPHA)
-
Conversion of currency/unit code between SAP internal and external (ISO) ones
-
Conversion of currency amounts (for example, a currency amount stored internally as 100.00 may de-facto mean 10.000 if it is about Japanese Yen)
- Conversion of unit amounts
- An amount does not have exactly two decimal places. In this case, your data provider is responsible for converting this amount.
- The OData consumer wants to work with SAP unit of measure or currency and not with ISO codes.
API
In the model provider class the programming interfaces are available for the application to specify that an automatic call of conversion routines is desired. Either a direct API or an indirect API can be used.
Direct API
For each entity field the following methods are available in the /IWBEP/IF_MGW_ODATA_PROPERTY interface:
-
SET_CONVERSION_EXIT
Sets the name of conversion exit to be called for the property.
-
SET_SEMANTIC
Marks the property as currency code or unit of measurement field.
-
SET_UNIT
Sets the relation between the amount field and the field containing currency or unit code.
- ENABLE_CONVERSION
Enables the conversion for the property.
- DISABLE_CONVERSION
Disables the conversion for the property.
Indirect API
Alternatively, applications can use method BIND_STRUCTURE either for an entity type or for a complex type ( /IWBEP/IF_MGW_ODATA_CMPLX_TYPE) to tell the framework to take over the conversion information from the corresponding ABAP Dictionary structure. The optional parameter IV_BIND_CONVERSIONS has to be set to X.
More Information
For general information on conversion functionality see Input and Output Conversions.