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.
Note that conversion handling functionality is only available in the OData Channel framework that is part of the SAP Business Suite backend system where IW_BEP is deployed, not on the SAP Gateway hub system.
Conversions for the following operations in inbound and outbound flow are available:
Read entity set
At present, there is no support for conversion of URL parameters.
For example, for a Read operation the Id fields with a conversion exit have to be converted by application coding. If you have an outbound conversion of Id 0100000000 to 100000000 and try out the input conversion by executing /sap/opu/odata/sap/my_test/Id('100000000') then the method GetEntity can not find the instance, because the Id is 100000000 instead of 0100000000. The self link you get in the feed then has the external representation /sap/opu/odata/sap/my_test/Id('100000000'). For this the application has to provide conversion handling.
The following types conversions are covered:
Conversion 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
A conversion exit for currency, currency amount, unit of measurement, and unit amount is supported. The model provider class must call the extended method SET_CONVERSION_EXIT with the necessary parameters. If no conversion exit is registered, the SAP Gateway framework uses the IDOC function modules CURRENCY_AMOUNT_SAP_TO_IDOC and CURRENCY_AMOUNT_IDOC_TO_SAP for amount conversion. However, these function modules only work correctly for amounts with two decimal places. For currency and unit of measure, the SAP Gateway framework always uses the global data type conversions (methods for outbound and inbound flow of CL_GDT_CONVERSION). You can use method DISABLE_CONVERSION of the current property object to disable the property conversion that is otherwise performed automatically by the SAP Gateway framework. You can also use method ENABLE_CONVERSION to enable the conversion at property level. Be aware that you can only enable the conversion if method SET_NO_CONVERSION is not used for the entire model. Once set, the conversion for the affected property is valid for inbound and outbound flow. The conversion of a property must be disabled in the following cases:
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.
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.
For each entity field the following methods are available in the /IWBEP/IF_MGW_ODATA_PROPERTY interface:
Sets the name of conversion exit to be called for the property.
Marks the property as currency code or unit of measurement field.
Sets the relation between the amount field and the field containing currency or unit code.
Enables the conversion for the property.
Disables the conversion for the property.
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.
For general information on conversion functionality see the SAP NetWeaver documentation about Input and Output Conversions.