Code never lies, comments sometimes do [Ron Jeffries]

Visitors Map

Follow on Twitter

@ZammaCode
Powered by Blogger.

Thursday, January 2, 2014

Enhancement of Standard Data Sources




§  Adding additional fields to a standard DataSource or changing its structure is termed as Enhancement
§  For example, if an SAP provides a standard DataSource with 10 fields and my requirement is to add 2 more fields to this DataSource which is not provided by SAP in this DataSource, but these 2 fields must be available at base table level
§  The procedure for both LO and Non-LO DataSources are the same, here we will enhance the LO DataSource as an example

Enhancement of Standard DataSource by Adding Extra Field from Communication Pool

1)      Login to ECC System
                     i.            Before adding field to DataSource, if you have data in your setup table you may get an error like setup table->Long text, go to LBWG enter 02 as Application here 02 is for Purchasing, click Execute, then click Yes
                   ii.            Go to LBWE (LO Cockpit), select DataSource 2LIS_02_SCL, click on Maintenance icon in Structure column, say Continue
                  iii.            In the selection Criteria pop up fields on the left are the fields available in our DataSource, while fields on the right are available in communication pool provided by SAP (The fields in communication pool has attached code to extract data), click the Filter combo to see the base tables, select MCEKKO MEMORY from the right and transfer it to the right section, click Continue, next click Yes
                 iv.            Now you will see that DataSource is turned into Inactive status in Update column, click DataSource name in DataSource column, click Continue in pop ups
                   v.            The fields you added will be in hidden status just uncheck them in Hide Field column, and click Save
                 vi.            Click Inactive in Update column to activate it
2)      Next you can follow the steps from “Loading Data from ECC System” to extract and load data

Enhancement of Standard DataSource by Adding Extra Field not Available in Communication Pool

1)      Login to BI System
As we already know tables related to purchasing are EKKO, EKPO etc.

                     i.            Go to SE11 to find your required field in table EKKO, copy the technical name (EBSTYP) from the Data element column
                   ii.            Go to RSA2, enter DataSource name 2LIS_02_ITM, click Display
                  iii.            On Extraction tab, double click the Extractor which will bring you the ABAP code written by SAP to extract data to this DataSource, we are not allowed to change this code, we will use the Extract Structure for this purpose, so double click the Extract Structure, in Extract Structure we will add the Append structure, from application toolbar click the Append Structure… button
                 iv.            Enter Append Name (usually its same as that of extract structure with z as starting letter), short description
                   v.            Paste ZEBSTYP in component column and EBSTYP in Component type column on Components tab
                 vi.            Activate it, now the field EBSTYP will appear in the Components tab of  Extract Structure window, this newly added field doesn’t have any logic to extract data, if we run the extract checker (RSA3) all fields will have data but this field will don’t have any data

To provide logic to our field for data extraction SAP provides 4 Exit functions which execute after the standard code of extractor is executed by DataSource, these are:
§  EXIT_SAPLRSAP_001              (Used for transactional datasource)
§  EXIT_SAPLRSAP_002              (Used for attribute datasource)
§  EXIT_SAPLRSAP_003              (Used for text datasource)
§  EXIT_SAPLRSAP_004              (Used for hierarchy datasource)

                vii.            Go to SE37, enter the EXIT_SAPLRSAP_001, click Display, double click on INCLUDE in code to open include file, scroll down to case i_datasource, click Insert from the application toolbar and type your code, here you will need a help of the ABAPer
This code will be given you by ABAPer
when ‘2lis_02_itm’.
       
        Types: begin of It_EKKO,
                                EBELN type EBELN,
                                ERNAM type ERNAM,
                        END OF it_EKKO.
        DATA: IT_EKKO TYPE STANDARD TABLE OF IT_EKKO,
                        WA_EKKO TYPE IT_EKKO.
        FIELD-SYMBOLS: <FS> TYPE MC02M_0HDR.
       
DATA: IT_DATA TYPE STANDARD TABLE OF MC02M_0HDR.
            IT_EKKO[] = C_T_DATA[].

        SELECT EBELN ERNAM FROM EKKO INTO TABLE IT_EKKO
        FOR ALL ENTRIES in IT_DATA
        WHERE EBELN = IT_DAT-EBELN.
IF SY-SUBRC = 0.
        LOOP AT C_T_DATA assigning <FS>.
        READ TABLE IT_EKKO INTO WA_EKKO WITH KEY ERNAM = <FS>-EBELN.
        IF SY-SUBRC = 0.
        <FS>-ZERNAM = WA_EKKO-ERNAM.
ENDIF.
ENDLOOP.
ENDIF.
              viii.            Activate it.
2)      Next you can follow the steps from “Loading Data from ECC System” to extract and load data

0 comments:

Post a Comment