Skip to Content

Standardization is a key aspect of SAP BW Layered, Scalable Architecture (LSA), SAP’s best practice in Enterprise Data Warehousing. One of the ways to realize standardization in the data staging process is developing generic, reusable ABAP building blocks with a comprehensive interface.

In every data flow we have to deal with the first inbound mapping of DataSource fields to InfoObjects within the transformation. Therefore, it makes sense to identify this process as a modeling pattern and use such a building block to facilitate the process. Let’s call it Mapping Services.

This document describes how the ABAP Objects classes for Mapping Services were developed, including all necessary ABAP Workbench objects.

Please refer to my blog Mapping Services – Inbound Mapping of DataSource Fields to InfoObjects for a conceptual overview and more information on maintaining the mapping control table and calling Mapping Services in the context of the transformation.

Please have a look here to download the attachments.

Mapping Services Class

The class YCL_BW_MAPPING is a reusable building block and facilitates the mapping from DataSource fields to InfoObjects during the first inbound transformation, i.e. in the Data Acquisition Layer the transformation from DataSource to Outbound InfoSource. This chapter describes how the class is developed.

Use the Class Builder to create the class YCL_BW_MAPPING. Go here via t/code SE24 or SAP menu path:

Tools > ABAP Workbench > Development > Class Builder

Source Code of the Implementing Class

Please refer to the attached text document for the source code of the class YCL_BW_MAPPING.

You can easily copy and paste the source code in the Class Builder. Switch from the “Form-Based” to the “Source Code-Based” maintenance.

Overview of the Attributes

The following attributes are defined:

  • P_DATASOURCEDataSource (OSOA/OSOD);
  • P_R_EXCEPTIONSBW Mapping Exception Class;
  • P_R_REQUESTInterface Between IPRO Admin Tab and Request;
  • P_SOURCEOBJECTSource Object for a DTP;
  • P_SOURCESYSTEMSource System for DataSource;
  • P_SOURCETYPEType of Source Object for a DTP;
  • P_TH_MAPPINGMapping Table.

Overview of the Methods

The following methods are implemented:

  • EXECUTEExecute Mapping Services (Expert Routine);
  • CHECK_MAPPINGCheck if Mapping can be Executed;
  • GET_SOURCEOBJECTDetermine Source Object (DataSource);
  • MAIN_PROCEDUREMain Procedure to Execute Mapping;
  • READ_BW_CONTROL_FROM_DBRead BW Control Table from Database.

Exception Class

The class YCX_BW_MAPPING is created to facilitate exception handling using the “class-based exception” concept. Most of the implementation is carried out automatically. Below you can find an overview of all necessary additions to the generated proposal.

Use the Class Builder to create the exception class YCX_BW_MAPPING. Go here via t/code SE24 or SAP menu path:

Tools > ABAP Workbench > Development > Class Builder

Please note to create the exception class with the option “with message class”.

 

Figure_01_Create_Exception_Class_Initial_Screen.jpg

Figure 1: Create Exception Class – Initial Screen

Properties

The Properties should look as follows. Make sure that message class YBWMAP is specified.

 

Figure_02_Exception_Class_Properties.jpg

Figure 2: Exception Class – Properties

Interfaces

The Interfaces should look as follows. Make sure that IF_T100_MESSAGE is present since it’s crucialfor maintaining the T100 messages. If it’s missing, you can add it manually.

 

Figure_03_Exception_Class_Interfaces.jpg

Figure 3: Exception Class – Interfaces

Attributes

Please find below an overview of all attributes which have to be added manually. The automatically generated attributes are not described.

 

Attribute Level Visibility Read only Typing Associated type Description
DATASOURCE Instance Attribute Public Yes Type ROOSOURCER DataSource (OSOA/OSOD)
DSFIELDNAME Instance Attribute Public Yes Type RSFIELDNM DataSource Field name
SOURCESYSTEM Instance Attribute Public Yes Type RSDLOGSYS Source System for DataSource
TGTFIELDNAME Instance Attribute Public Yes Type RSFIELDNM Target Field name

Table 1: Attributes

Texts

Please find below an overview of the custom defined exception texts. As you might have noticed, every message is connected to a corresponding T100 message.

 

Exception ID Text T100 Message Attributes
TARGET_FIELD_MISSING Target field name &TGTFIELDNAME& is missing in result package YBWMAP 003 TGTFIELDNAME
DATASOURCE_FIELD_MISSING DataSource field name &DSFIELDNAME& is missing in BW control table YBWMAP 002 DSFIELDNAME
MAPPING_TABLE_NO_RECORDS No suitable records for DataSource &DATASOURCE& &SOURCESYSTEM& in BW control table YBWMAP 001

DATASOURCE

SOURCESYSTEM

SOURCE_OBJECT_FAILED Source object determination failed YBWMAP 000

Table 2: Exception Texts

Methods

Next to the automatically generated methods, one additional method has to be created: CREATE_LOG_REC. This method is used to create a record for log object in the context of the expert routine. Please refer to the attached text document for the source code of method CREATE_LOG_REC.

Other ABAP Workbench Objects

In this chapter, the remaining ABAP workbench objects are discussed. The following objects have to be developed:

  • T100 messages;
  • Search Helps;
  • BW control table.

T100 Messages

A new message class YBWMAP (Mapping Services) has to be created. This message class contains the various messages used in exception class YCX_BW_MAPPING.

To create the message class YBWMAP, use t/code SE91 or SAP menu path:

Tools > ABAP Workbench > Development > Programming Environment > Messages

 

Message Message Short Text Self-expl.
000 Source object determination failed Yes
001 No suitable records for DataSource &1 &2 in BW control table Yes
002 DataSource field name &1 is missing in BW control table Yes
003 Target field name &1 is missing in result package Yes

Table 3: Message Class

Search Helps

Two search helps have to be created:

  • YBW_DSFIELD: Search Help for DataSource Fields;
  • YBW_IOBJFNM: Search Help InfoObject and Field Name.

 

To create the search helps, use t/code SE11 or SAP menu path:

Tools > ABAP Workbench > Development >ABAP Dictionary

 

Figure_04_Search_Help_DataSource_Fields.jpg

Figure 4: Search Help for DataSource Fields

 

Figure_05_Search_Help_InfoObject_Field_Name.jpg

Figure 5: Search Help InfoObject and Field Name

BW Control Table

BW Control Table YBWMAPPING has to be created. The table should be created as “customizing table” and “table maintenance” enabled. A table maintenance dialog can be generated for this table but is not described any further.

To create the table, use t/code SE11 or SAP menu path:

Tools > ABAP Workbench > Development >ABAP Dictionary

The delivery and maintenance settings of the BW Control Table are as follows.

 

Figure_06_Control_Table_Delivery_Maintenance_Settings.jpg

Figure 6: BW Control Table – Delivery and Maintenance Settings

 

Table YBWMAPPING is used by the class YCL_BW_MAPPING. This table stores the mapping rules. The configuration of the table looks as follows.

 

Figure_07_Control_Table_Fields.jpg

Figure 7: BW Control Table – Fields

 

Figure_08_Control_Table_Entry_Help_Check.jpg

Figure 8: BW Control Table – Entry Help/Check

 

The following foreign key relationships have to be maintained.

 

Figure_09_Control_Table_Foreign_Key_1.jpg

Figure 9: BW Control Table – Foreign Key (1)

 

Figure_10_Control_Table_Foreign_Key_2.jpg

Figure 10: BW Control Table – Foreign Key (2)

 

Figure_11_Control_Table_Foreign_Key_3.jpg

Figure 11: BW Control Table – Foreign Key (3)

To report this post you need to login first.

16 Comments

You must be Logged on to comment or reply to a post.

  1. vamshikrishna srirangam

    Thank you very much sir for posting such a fantastic blog ,

                                          i am a new bee to BW, Sir i did as you mentioned but i got error and my control table is also not filled can you help me please

    short dump details:

           message i168(rsmpc) with p_rnr

                                     l_s_cubes-infocube

                                     l_dtp_rnr l_dtp_sid.

            continue.

          endif.

        endloop.

        loop at l_t_cubes into l_s_cubes.

          l_idx = sy-tabix.

          select * from rsmonicdp into table l_h_icdp where

                 icube = l_s_cubes-infocube.

          loop at p_t_datapakid into l_s_datapakid.

            read table l_h_icdp into l_s_icdp with table key

                 icube = l_s_cubes-infocube

                 rnr   = p_rnr

                 dp_nr = l_s_datapakid-low.

            if sy-subrc = 0 and

                 l_s_icdp-status(3) = icon_green_light(3) ).

              if l_s_icdp-aufrufer <> ’66’.

                delete l_t_cubes index l_idx.

                exit.

              endif.

            endif.

          endloop.

        endloop.

        break luxm.                                            “#EC NOBREAK

        l_s_minfo-t_infocube[] = l_t_cubes[].

        if l_t_cubes[] is initial and

           l_s_minfo-type = ‘D’.

    >>>>      message x000.

        else.

    *** OSS 935625

          perform fill_reprocess_tables using p_rnr

                                              l_t_cubes[]

                                              l_t_datapakid[].

    ***

          call function ‘RSAR_REQUEST_INTERPRETER_1’

               exporting

                    i_request                   = p_rnr

                  i_t_datapakid                 = p_t_datapakid

    *           I_DATAPAKID                 =

    *           I_IDOC_DOCNUM               =

                    i_s_minfo                   = l_s_minfo

                  i_parallel_procs              = l_par_procs

    *      TABLES

    *           L_T_TABU_TRANS              =

               changing

                    c_t_idocstate               = l_t_idocstate

                    c_subrc                     = l_subrc

    Screen Shot:

    /wp-content/uploads/2014/12/error_616570.jpg

    (1) 
    1. Sander van Willigen Post author

      Hi Vamshi,

      The shortdump shows standard SAP coding but it’s not clear for me what you have done to trigger the shortdump. Is it during the execution of a DTP?

      It’s difficult for me to check what you have done and might have forgotten. Let me give the right order of activities:

      1. Create Search Helps
      2. Create Mapping Control Table
      3. Create Table Maintenance Dialog (optional)
      4. Create Message Class
      5. Create Exception Class
      6. Create Mapping Services Class
      7. Fill the Mapping Control Table with mapping rules for all fields of the respective DataSource (note: all fields have to be filled; please refer to the example in my blog)
      8. Implement the coding as mentioned in my blog (note: you have to use an Expert Routine; please refer to the coding extract in my blog)

      Please check if all development objects are correct and created in the right order. Please also check the guidelines mentioned in my blog Mapping Services – Inbound Mapping of DataSource Fields to InfoObjects.

      Best regards,

      Sander

      (0) 
      1. vamshikrishna srirangam

        yes sir ,

                   i loaded data to PSA when i load data from PSA to info cube i am getting this error. i created transformation in that i added expert routine as you mentioned but i have a doubt that i didn’t map the source columns to target infocube(becoz i used expert routine so i can’t map it ) and you mentioned that it will get the mapping information from control table which i created but i created control table which doesn’t hold any data(ofcourse it’s newly created table).step 7 is missing(so i think i need to fill the control table with source and target columns initiallly then transformation will pick from the control tables but filling for all the data sources is also a time consuming job i guess).instead of that can we fetch the details from RSOSFIELDMAP table( by providing OLTP SOURCE = 2LIS_11_VAITM )and map it to the respective colums and fill the TARGET_PACKAGE.can you please help me?

        (0) 
        1. Sander van Willigen Post author

          Hi Vamshi,

          Step 7 (Fill the Mapping Control Table with mapping rules) is essential. The program will dynamically map source fields (i.e. DataSource fields) with target fields (e.g. InfoSource) based on the information found in the Mapping Control Table. If your DataSource is 2LIS_11_VAITM, then you should create mapping rules for all source fields (many fields in this case, around 300 fields if I remember correctly).

          The maintenance of the Mapping Control Table can be time-consuming. That’s why I came up with the idea of so-called Data Warehouse InfoObjects. Please see my blog Introducing Data Warehouse InfoObjects – Part 1: Conceptual Overview for the concept. In addtion to that, I created another add-on to generate those Data Warehouse InfoObjects in an automated way. Please refer to my blog Generating Data Warehouse InfoObjects – Part 1: Introduction. As a bonus, it will also fill the Mapping Control Table in an automated way.

          Bottom-line is that both add-ons are complementary. You do not have to use them together but it certainly pays off and can lead to a significant efficiency improvement in populating your Data Warehouse layer.

          Best regards,

          Sander

          (0) 
          1. vamshikrishna srirangam

            Hi Sir ,

                     I Created all the components on BI as well as ECC side and only one error i am getting i checked and even added type groups in class RSD,RSSB even still i am getting the error like below.

            /wp-content/uploads/2015/01/error_624818.jpg

            (0) 
            1. Sander van Willigen Post author

              Hi Vamshi,

              I wonder on what BW release (and SP level) you are working. It might be lower than release 7.3. In my system (BW 7.31 SP 10) I can find the constant in Type Group RSD. It looks as follows:

              CONSTANTS:
              BEGIN OF rsd_c_bexfl,
              false     
              TYPE rsdbexfl VALUE ‘ ‘,
              reporting 
              TYPE rsdbexfl VALUE ‘ ‘,
              true      
              TYPE rsdbexfl VALUE ‘X’,
              activation
              TYPE rsdbexfl VALUE ‘X’,
              never     
              TYPE rsdbexfl VALUE ‘N’,
              END   OF rsd_c_bexfl.

              If in your system the above coding cannot be found in Type Group RSD, then I suggest as a work-around to write similar coding in the Class.

              Best regards,

              Sander

              (0) 
  2. Sander van Willigen Post author

    Hi Vamshi,

    Re. your questions of Jan 15, 2015 I would like to react as follows.

    Q: Now everything working fine, last question can i move this to production or not?

    A: Please make sure that everything is complete and working fine. Solve any error messages you find in the logs. Use the Transport Connection to collect all objects and create appropriate transport requests.

    For the records in the control table (e.g. YBWMAPPING), it depends how to transport them. If you created a Table Maintenance view using t/code SE54 with a “transportable” setting, then a transport request is automatically proposed. Otherwise you have to create a transport request manually (R3TR TABU).

    Q: My Unit Key figure catalog is not filling

    A: I expect that your Unit InfoObject Catalog is not created in a proper way. The system probably has stored the Units in the “not assigned” InfoObject Catalog 0UNINOTASSIGNED.

    You cannot create a Unit InfoObject Catalog the normal way (only Characteristic and Key Figure are allowed). Please use a work-around the copy function using t/code SE16. Table RSDIOBC. Make a copy of InfoObject Catalog 0UNINOTASSIGNED and choose an appropriate name and InfoArea. Go back to t/code RSA1, Modeling view > InfoObjects and activate the InfoObject Catalog from here. Please make sure to update the corresponding parameter in table YBWADMIN accordingly.

    Q: … this is my application log details

    A: Please have a close look at the error messages and solve them. Please refer to my blog Generating Data Warehouse InfoObjects – Part 4: Optimizing Results for some common cases.

    Q: even after activating DSO and creating transformation from DSO to Info cube it is not providing mapping for relevant fields automatically.why?

    A: Please solve first all errors and make sure your transport requests are complete (do not forget to also transport the table contents of the Mapping Table).

    Please note that you have to write a small piece of coding in the Expert Routine as explained in my blog Mapping Services – Inbound Mapping of DataSource Fields to InfoObjects.

    Last but not least, please try to post questions in the appropriate blog or document. Although there is a relation between the various Add-ons, it is becoming a bit hard to follow. Alternatively and maybe even a better approach, create a new Discussion in SAP Business Warehouse. Thanks in advance.

    Best regards,

    Sander

    (0) 
  3. Dirk Meyer

    Hi Sander,

    are the attachments available only for a limited time.
    I also did not found the IOBJ generation codes.

    Are there any other sources that might provide a backup or could you send me a copy.

    Thanks Dirk 

    (1) 

Leave a Reply