Showing posts with label Enhancement. Show all posts
Showing posts with label Enhancement. Show all posts

SAP BW Data Source Enhancement

Added By: Venkata Chalapathi Challapalli, R. Prem Kumar, Vikas Agarwal, Seema John and Tapan Kumar Jain.

1. Introduction
As we can read from http://help.sap.com SAP Business Information Warehouse provided preconfigured objects under collective term “Business Content” (BC). Business Content includes DataSources, InfoObjects, data targets, and InfoSources that support the entire flow of data within BW. It provides a rapid starting point when modeling key business information requirements, and it is also intended to cover most of the traditional reporting requirements that companies face. However, Business Content will not solve all your data information needs.


Now the spontaneous question is: what’s happen if a standard Business Content DataSource as provided in standard (ready-to-use) configuration doesn’t completely meet our data model requirements?

The Answer is : DataSource Enhancement

Below links shows the ways to do the Datasource Enhancement.

SAP BW Data Source Enhancement


Data Source Enhancement using User Exit


Enhancing LO Datasource Step by Step


Data Extraction & DS Enhancement in SAP BI - Step by Step

Best Practice for Data Source Enhancement

Added by MAYURI SINHA

Data Extractor Enhancement - Overview of Approach
Following are the steps for data source enhancements:

The flowchart explains the step we need to follow while enhancing a standard LIS extractor.
Determine the fields with which the extractor is to enhanced. Recheck if these fields are not the ones which are already provided by SAP. As if they are already provided, we need not enhance them. As a next check we need to check the LBWE pool where we have some extra fields which we can easily add to our datasource.
If these fields do not exist in the LBWE pool either, we need to enhance the data source.
Above flowchart would give an overview of the same, but here we would go through each of those steps in detail. The approach which we are going to discuss here is the Function Module approach of data source enhancement.
Steps of Data Source Enhancement -Function Module approach
Step 1: Go to T Code CMOD and choose the project you are working on.
Step 2: Choose the exit which is called when the data is extracted. 
Step 3: This is the step where we have a difference from the normal approach.

Normal Approach: CMOD Code

Code Sample:

    WHEN '2LIS_05_Q0ACTY'.

-------
Note: This is just a sample code. Logic will vary according to the requirements.In this normal approach, which is followed in most of the BW instances, we write ABAP CASE/WHEN conditions.
Function Module Approach: CMOD Code
*&---------------------------------------------------------------------*
*&  Include           ZXRSAU01                                         *
*&---------------------------------------------------------------------*
DATA: L_FNAME  TYPE RS38L_FNAM,
      L_EXP_FNAME type rs38l_fnam,
      L_EXP_ACTIVE TYPE RS38L_GLOB,
      L_ACTIVE TYPE RS38L_GLOB,
      L_S_SELECT TYPE RSSELECT.
SELECT SINGLE FUNC
         INTO L_FNAME

         FROM ZTEST

        WHERE DSNAM  = I_DATASOURCE.
*&---------------------------------------------------------------------*
* Cehck to see if a local versio of the extractor exists
*&---------------------------------------------------------------------*
IF L_FNAME IS NOT INITIAL.
  CALL FUNCTION 'RS_FUNCTION_ACTIVE_CHECK'
    EXPORTING
      FUNCNAME  = L_FNAME
    IMPORTING
      ACTIVE    = L_ACTIVE
    EXCEPTIONS
      NOT_FOUND = 1
      OTHERS    = 2.
  IF SY-SUBRC EQ 0 AND L_ACTIVE IS NOT INITIAL.
    CALL FUNCTION L_FNAME
      EXPORTING
        I_DATASOURCE             = I_DATASOURCE
        I_ISOURCE                = I_ISOURCE
        I_UPDMODE                = I_UPDMODE
      TABLES
        I_T_SELECT               = I_T_SELECT
        I_T_FIELDS               = I_T_FIELDS
        C_T_DATA                 = C_T_DATA
        C_T_MESSAGES             = C_T_MESSAGES
      EXCEPTIONS
        RSAP_CUSTOMER_EXIT_ERROR = 1.
  ENDIF.                               " IF SY-SUBRC EQ 0...
ELSE.
  CLEAR L_FNAME.
  CONCATENATE 'ZTEST_' I_DATASOURCE INTO L_FNAME.
  CALL FUNCTION 'RS_FUNCTION_ACTIVE_CHECK'
    EXPORTING
      FUNCNAME  = L_FNAME
    IMPORTING
      ACTIVE    = L_ACTIVE
    EXCEPTIONS
      NOT_FOUND = 1
      OTHERS    = 2.
  IF SY-SUBRC = 0 AND L_ACTIVE = 'X'.
    CALL FUNCTION L_FNAME
      EXPORTING
        I_DATASOURCE             = I_DATASOURCE
        I_ISOURCE                = I_ISOURCE
        I_UPDMODE                = I_UPDMODE
      TABLES
        I_T_SELECT               = I_T_SELECT
        I_T_FIELDS               = I_T_FIELDS
        C_T_DATA                 = C_T_DATA
        C_T_MESSAGES             = C_T_MESSAGES
      EXCEPTIONS
        RSAP_CUSTOMER_EXIT_ERROR = 1.
  ENDIF.                               " IF SY-SUBRC = 0...
ENDIF.                                 " IF L_FNAME IS NOT INITIAL.
Note: This is a reusable code. Here ZTEST is a table which maintains the data source name and the function module corresponding to that data source.

Step 4: Here in this step we create a function module for each data source. We create a new FM (Function Module in SE37)
Data Extractor Enhancement - Best Practice/Benefits
  This is the best practice of data source enhancement. This has the following benefits:

1.       No more locking of CMOD code by 1 developer stopping others to enhance other extractors.

2.       Testing of an extractor becomes more independent than others.

3.       Faster and a more robust Approach