!--a11y-->
Conversion Routines in SAP BW 
Conversion routines are used in SAP BW so that the characteristic values (key) of an InfoObject can be displayed or used in a different format to how they are stored in the database. They can also be stored in the database in a different format to how they are in their original form, and supposedly different values can be consolidated into one.
Conversion routines that are often implemented in SAP BW are now described.
In SAP BW, conversion routines essentially serve to simplify the input of characteristic values for a query runtime. For example with cost center 1000, the long value with left-hand zeros 0000001000 (from the database) is not to be entered, but just 1000. Conversion routines are therefore linked to characteristics (InfoObjects) and can be used by them.
Conversion routines can also be set with data loading. Although it is important to note that conversion routine are often already defined for DataSource fields (particularly from SAP source systems). The properties of the replicated DataSource fields are displayed in the transfer structure or DataSource maintenance.
In many cases it is desirable to store the conversion routines of these fields in the corresponding InfoObject on the BW side too. It is therefore necessary, when defining transfer rules, to consider the connection between the conversion routine of the InfoObject in the communication structure and the conversion routine of the transfer structure field.
When loading data you now have to consider that when extracting from SAP source systems the data is already in the internal format and is not converted. When loading flat files and when loading using a BAPI or DB Connect, the conversion routine displayed signifies that an INPUT conversion is executed before writing to the PSA. For example, the date field is delivered from a flat file in the external format‚10.04.2003’. If a conversion routine has been specified in the transfer structure maintenance, this field can be converted to the internal format ‘20030410’ in the transfer rules, according to that conversion routine.
Conversion routines ALPHA, NUMCV, and GJAHR check whether data exists in the correct internal format before it is updated. For more on this see the extensive documentation in the BW system in the transaction for converting to conforming internal values (transaction RSMDCNVEXIT). If the data is not in the correct internal form an error message is issued. These three conversion routines can be set in Transfer Rule Maintenance so that a check is not executed but an INPUT conversion is. Make this setting using the Optional Conversion flag in transfer rules maintenance. Both the check and the conversion are executed in the transfer rules for the target field.
Business Content objects are delivered with conversion routines if they are also used by the DataSource in the source system. The external presentation is then the same in both systems. The conversion routines used for the R/3 DataSource fields are then transferred to the BW system when the DataSources from the SAP source systems are replicated.
A conversion occurs according to the data type of the field when changing the content of a field from the display format into the SAP-internal format and vice versa, as well as for output using the ABAP WRITE instruction. The same is true for output using a SAP BW query.
If this standard conversion is unsuitable you can override it by specifying a conversion routine in the underlying domains. You do this in SAP BW by specifying a conversion routine in InfoObject maintenance in the General Tab Page.
See Defining Conversion Routines for more technical details.
