+++> 5.Conversion Routines in SAP BW

  1. Conversion Routines in BW

    1. ALPHA Conversion Routine
    2. BUCAT Conversion Routine
    3. EAN11 Conversion Routine
    4. GJAHR Conversion Routine
    5. ISOLA Conversion Routine
    6. MATN1 Conversion Routine
    7. NUMCV Conversion Routine
    8. PER15 Conversion Routine
    9. PER16 Conversion Routine
    10. PER17 Conversion Routine
    11. POSID Conversion Routine
    12. PROJ Conversion Routine
    13. REQID Conversion Routine
    14. WBSEL Conversion Routine
    15. SDATE Conversion Routine
    16. IDATE Conversion Routine

    Use
    Conversion routines are used in 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 BW are now described.

    Integration
    In 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 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.

    Functions
    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

    1. ALPHA Conversion Routine
    Use
    The ALPHA conversion is used in the BW system for each presetting for character characteristics. The ALPHA conversion routine is registered automatically when a characteristic is created. If you do not want to use this routine, you have to remove it manually. The ALPHA conversion routine is used, for example, with account numbers or document
    numbers.
    Functions
    When converting from an external into an internal format this checks whether the entry in the INPUT field is wholly numerical, whether it consists of digits only, possibly with blank spaces before and/or after. If yes, the sequence of digits is copied to the OUTPUT field, right-aligned, and the space on the left is filled with zeros (‘0’). Otherwise the sequence of digits is copied to the output field from left to right and the space to the right remains blank. For conversions from an internal to an external format (function module CONVERSION_EXIT_ALPHA_OUTPUT) the process is reversed. Blank characters on the left hand side are omitted from the output.
    Example
    Input and output fields are each 8 characters long. A conversion from an external to an internal format takes place:
    ..1. '1234 ' _ '00001234'
      2. 'ABCD ' _ 'ABCD '
    2. BUCAT Conversion Routine
    Use
    The BUCAT conversion routine converts the internal presentation of the budget type (0BUD_CAT) into the external presentation (0BUD_CAT_EX), using the active entries in the master data table for the budget type InfoObject (0BUD_CAT).
    Example
    Conversion from the external into the internal format:
    '1' _ 'IM000003'

    3. EAN11 Conversion Routine
    Use
    The EAN11 conversion routine is used for European Article Numbers (EAN) and the American Universal Product Code (UPC).
    Functions
    It converts the external presentation, according to settings in transaction W4ES (in the R/3 source system), into the internal SAP presentation. In the SAP system, left-hand zeros are not saved as, according to EAN standards, these are not required. For example, the EAN ‘123’ is the same as the EAN ‘00123’. As such, the left-hand zeros are dispensed with. UPC-E code short forms are converted into the long form. The EAN11 conversion routine formats the internal presentation of each EAN type, according to settings in transaction W4ES, for output. This ensures that the internal presentation does have left-hand zeros, or that UPC codes are converted to the short form.

    4. GJAHR Conversion Routine
    Use
    Conversion routine GJAHR is used when entering the business year in order to allow an abbreviated, two-digit entry. A business year has four digits in the internal format.
    Functions
    When converting from an external into an internal format this checks whether the entry in the INPUT field is wholly numerical, whether it consists of digits only, possibly with blank spaces before and/or after.
    1. If a two-digit sequence of numbers is entered then these are put in the third and fourth spaces of the OUTPUT field. The left-hand spaces are filled with 19 or 20 according to the following rule:
    _ Two-digit sequence < 50. Fill from left with 20.
    _ Two-digit sequence >= 50. Fill from left with 19.
    2. A sequence that does not have two-digits is transferred to the output field from left to right.
    Blank characters are omitted.
    Example
    Conversion from the external into the internal format:
    1. '12' _ '2012'
    2. '51' _ '1951'
    3. '1997' _ '1997'
    4. '991# _ '991#

    5. ISOLA Conversion Routine
    Use
    Conversion routine ISOLA converts the two-digit ISO language abbreviation INPUT into its SAP internal OUTPUT presentation.
    Functions
    These are assigned using the LAISO and SPRAS fields in table T002. An INPUT that cannot be converted (because it is not defined as T002-LAISO) produces an error message and triggers the UNKNOWN_LANGUAGE exception.
    Because they are compatible, single-digit entries are supported in that they are transferred to OUTPUT unchanged. They are not checked against table T002. The difference between upper and lower case letters is irrelevant with two-digit entries however with single-digit entries, upper and lower case letters stand for different languages.

    6. MATN1 Conversion Routine
    Use
    This conversion routine change internal material numbers, stored in the system, into the external material numbers displayed in the interface and vice versa, according to settings in transaction OMSL.With regard to the specific details of the conversion, read the help for the appropriate input field of the transaction.

    7. NUMCV Conversion Routine
    Functions
    When converting from an external into an internal format this checks whether the entry in the INPUT field is wholly numerical, whether it consists of digits only, possibly with blank spaces before and/or after. If yes, the sequence of digits is copied to the OUTPUT field, right-aligned, and the space on the left is filled with zeros (‘0’). Otherwise the blank characters are removed from the sequence of digits, the result is transferred, left-aligned, into the output field, and this is then filled from the right with blank characters. Converting from the internal format into the external format (conversion routine CONVERSION_EXIT_NUMCV_OUTPUT) does not produce any changes. The output field is set
    the same as the input field.
    Example
    Input and output fields are each 8 characters long. A conversion from an external to an internal format takes place:
    1. '1234 ' _ '00001234'
    2. 'ABCD ' _ ‘ABCD’
    3. ' 1234 ' _ '00001234'
    4.’ AB CD’ _ ’ABCD ’



    8. PER15 Conversion Routine
    Use
    The PER15 conversion serves to convert a five-figure calendar quarter in an external format (Q.YYYY, for example) into the internal format (YYYYQ). Y stands for year (here four-digits) and Q for quarter (single-digit: 1, 2, 3, or 4). The separator (‘.’ or ‘/’) has to correspond to the date format in the user settings.
    Functions
    Permitted entries for the date format DD.MM.YYYY are QYY (two digits for year without separator), Q.YY (two digits for year with separator), QYYYY (four digits for year without separator), and Q.YYYY (four digits for year with separator). Permitted entries for the date format YYYY/MM/DD would be YYQ, YY/Q, YYYYQ, YYYY/Q.
    Example
    Examples where the date format in the user settings in DD.MM.YYYY. A conversion from the external to the internal format takes place:
    1. '2.02' _ '20022'
    2. '31999' _ '19993'
    3. '4.2001' _ '20014'

    9. PER16 Conversion Routine
    Use
    Conversion routine PER16 is used with six-digit entries for (business year) periods.
    Functions
    The internal format for six-digit periods is YYYYPP (200206, for example, for period 6 of business year 2002). As the external format is converted to the internal format, this checks whether the entries in the INPUT parameter with external date formatting (separators, order) comply with user settings. The separator (‘.’ or ‘/’) has to correspond to the date format in the user settings. Different abbreviated entries are possible and these will be correctly converted into the internal format.
    Example
    For the external date formatting DD.MM.YYYY in the user settings, the following conversion takes place from external to internal formats:
    1. '12.1999' _ '199912'
    2. '1.1999' _ '199901'
    3. '12.99' _ '199912'
    4. '1.99' _ '199901'

    10. PER17 Conversion Routine
    Use
    Conversion routine PER17 is used with seven-digit entries for (business year) periods.
    Functions
    The internal format for seven-digit periods is YYYYPPP (2002006, for example, for period 006 of business year 2002). As the external format is converted to the internal format, this checks whether the entries in the INPUT parameter with
    external date formatting (separators, order) comply with user settings. The separator (‘.’ or ‘/’) has to correspond to the date format in the user settings. Different abbreviated entries are possible and these are converted correctly into the internal format.
    Example
    For the external date formatting DD.MM.YYYY in the user settings, the following conversion takes place from external to internal formats:
    1. '012.1999' _ '1999012'
    2. '12.1999' _ '1999012'
    3. '1.1999' _ '1999001'
    4. '012.99' _ '1999012'
    5. '12.99' _ '1999012'
    6. '1.99' _ '1999001'

    11. POSID Conversion Routine
    Use
    The POSID conversion routine converts the external presentation of the program position (0PROG_PO_EX) into the internal presentation (0PROG_POS), using the active master data table entries for the program position InfoObject (0PROG_POS).
    Example
    Conversion from the external into the internal format:
    P-2411 _ P24110000

    12. PROJ Conversion Routine
    Use
    There are extensive possibilities in the R/3 system project system for editing the external presentation of the project and PSP elements (project coding, editing mask). These features are included in the R/3 conversion routine. This comprehensive logic cannot be mapped in the BW system. For this reason, the characteristic 0PROJECT_EX exists in the attributes of InfoObject 0PROJECT and the external description is stored there. As the external description is entered on the screen, conversion routine 'CONVERSION_EXIT_PROJ_INPUT' reads the corresponding internal description 0PROJECT and uses this for internal processing. If no master data has been loaded into the BW (master data generated by uploading transaction data), then the internal description has to be input in order to execute a query.
    Example
    Internal format: 0PROJECT: ‘A0001’
    External format: 0PROJECT_EX: 'A / 0001'


    13. REQID Conversion Routine
    Use
    The REQID conversion routine converts the external presentation of the appropriation request (0APPR_REQU) into the internal presentation (0APPR_RE_ED), using the active entries in the master data table for the appropriation request
    InfoObject (0APPR_RE_ED).
    Example
    Conversion from the external into the internal format:
    P-2411-2 _ P24110002

    14. WBSEL Conversion Routine
    Use
    There are extensive possibilities in the R/3 system project system for editing the external presentation of the project and PSP elements (project coding, editing mask). These features are included in the R/3 conversion routine. This comprehensive logic cannot be mapped in the BW system. For this reason, the characteristic 0WBS_ELM_EX exists in the attributes of InfoObject 0WBS_ELEMT and the external description is stored there. As the external description is entered on the screen, conversion routine 'CONVERSION_EXIT_WBSEL_INPUT' reads the corresponding internal description 0WBS_ELEMT and uses this for internal processing. If no master data has been loaded into the BW (master data generated by uploading transaction data), then the internal description has to be input in order to execute a query.
    Example
    Internal Format: 0WBS_ELEMT: 'A0001-1'
    External format: 0WBS_ELM_EX: 'A / 0001-1'

    15. SDATE Conversion Routine
    Use
    This conversion routine assigns the appropriate internal date presentation (YYYYMMDD) to an external date (01.JAN.1994, for example). Call up the test report RSSCA1T0 to be able to better visualize the functionality of
    this routine. This test report contains the complete date conversion with external as well as internal presentations.
    Example
    Date formatting definition in the user master record: DD.MM.YYYY
    Conversion from the external into the internal format:
    '02.JAN.1994' _ '19940102'

    16. IDATE Conversion Routine
    Use
    This conversion routine assigns the appropriate internal date presentation (YYYYMMDD) to an external date (01JAN1994, for example).
    Call up the test report RSSCA1T0 to be able to better visualize the functionality of this routine. This test report contains the complete date conversion with external as well as internal presentations.
    Example
    Conversion from the external into the internal format:

    '02JAN1994' _ '19940102'