Conversion routine in #SAP #BW
For internal purposes and storage of the data SAP BW uses a “internal format”. That determines for example that fiscalyear/period is stored as yyyyppp or a costcenter always has leading zeros. The external format is often different and therefore a conversion is required either from internal to external or vice versa.
A ProfitCenter entered in the format of 1000 will be converted to the char10 value of 0000001000. To ensure a consistent conversion BW uses conversion routines which are part of the InfoObject definition. Most of the InfoObjects use a conversionroutine ALPHA. (Which often causes problems as seen in scn posts)
If there isn’t a conversion routine definied with an InfoObject the external format is also transfered to the internal format. Meaning a customer number can be stored as 4711 or 00004711.
For each conversionroutine there is two function modules
used for the conversion from the external to the internal format
used for the conversion from the internal to the external format
The function modules are named CONVERSION_EXIT_”conversionroutine”_OUTPUT or CONVERSION_EXIT_”conversionroutine”_INPUT.
Conversion routines are used to convert users input in reporting into the internal format. (e.g. 009/2013 into 2013009) Modelling staging and extraction of data which isn’t in the internal format has to be taken care of and turned into the internal format. An exception is NUMCV, GJAHR and obviously ALPHA. Before posting data into targets BW tests for those characteristics if the internal format is fullfilled. If it isn’t fullfilled the load is stopped.
For that specific reason BW provides input conversion routines to ensure the conformity for NUMCV, GJHAR and ALPHA.
If the conversion routines NUMCV, GJAHR and ALPHA are added to an InfoObject which already holds master data the posted values have to be transfered into the new internal format.
To add the conversion in this case the the transaction RSMDEXITON can be used.
Normally BW doesn’t check fieldvalues for their internal conformitiy which usually causes issues if data has already moved half way though data stageing and get rejected at a later stage. One excpetion was the above listed conversion routines which get checked throughout the process. A consistent check on fieldvalues and conversionroutines is only provided as of BW 7.x with input conversion. The input conversion already happens at the transfer of data to PSA level and allows maximum security against non compliant field values.
If input conversion is used or not is defined in the colum of the datasource structure and if the format is set to internal BW also assumes data in provided in the internal format. Those values get posted to datatargets without any further checks.
Especially if data is transfered from ECC the assumption can be made that data is delivered in the internal format as both sides use conversion routines.
This is not the case though if a generic datasources and/or user exits are used and a conversion can be necessary.
This can lead to issues as the “trusted internal format” is not validated datatargets can contain wrong values. To avoid this the column format can be switch to “check”. The system still assumes data is delivered in the internal format but will validate it. The data load gets cancelled should the check fail.
If data is retrived from other source systems than SAP the assumption can be made data is provided in the external format and has to be converted with the conversion routine. In this case the conversion has to be named in the column conversion.
Input conversion and validating against the internal format does have a performance impact and should not be applied in general to all fields.