ZamaCode: SAP BI

Code never lies, comments sometimes do [Ron Jeffries]

Visitors Map

Follow on Twitter

@ZammaCode
Powered by Blogger.

Showing posts with label SAP BI. Show all posts
Showing posts with label SAP BI. Show all posts

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

Monday, December 23, 2013

Loading Data from ECC System (Standard DataSources)




§  BI Content defines 60% of BI system
§  For flat files we were creating our custom data sources
§  Data sources defined by SAP is called Standard data sources
§  Standard data sources exists in ECC system
§  We will need to get this standard data source from ECC system to our BI system
§  Once that available in BI system then we can create an InfoPackage and extract data to standard data sources

·      Non Logistics DataSources /General DataSources
§  Non-LOs DataSources name start with 0App_Area like 0FI

·      Logistics DataSources
§  LOs DataSources name start with 2lis

§  To use standard DataSources you need to activate it

Non Logistics DataSources
In Non-LO DataSources the flow is Base Table ---> InfoPackage ---> DataSource
RSA2 (Check DataSource Structure) --->RSA5 (Activation of DataSource) --->RSA6 (Post Processing) ---> RSA3 (Extract Checker) ---> Replicate Application Component (in BW system)
1)      Logon to ECC system
a)      To activate general DataSource go to RSA5
                                 i.            Expend SAP/R3, expend FI application component, expend FI-AP, FI-AP-I0 is a transactional data source
                               ii.            To check properties of the data source copy its name go to RSA2, provide name of DataSource it shows this DataSource is based on functional module
Data sources can be made by three ways:
§  Tables or View
§  Queries or InfoSets
§  Functional Module / ABAP Code, which will create an interface b/w DataSource and base table
Verify the fields if it suits your need, Data comes to standard DataSource from the tables of ECC called Base tables, Functional consultants load data to the tables of ECC. The job of BI consultant is to extract data from all these base tables to DataSource and from DataSources to the BW system
                              iii.            Select FA-AP-I0 in the RSA5 and click the Activate DataSources button from application toolbar
b)      To verify is it activated successfully go to RSA6, expend SAP-R/3, then FI, then expend FI-AP, if you find your DataSource here its mean its activated
c)       To check validity of the general DataSource go to RSA3, give DataSource name, click Extraction button, then select List button to check data

2)      Logon to BW system to get the structure of activated Non-LO DataSource
a)      In DWW go to Source System, expend SAP, double click on your ECC system
b)      Find your application component, right click Financial Accounting Vendors and select Replicate Metadata
3)      To load data from source system to our DataSource, create InfoPackage and Execute it

Logistics DataSources
In LO DataSources the flow is Base Table ---> Setup Table ---> InfoPackage ---> DataSource
RSA2 (Check DataSource Structure) --->RSA5 (Activation of DataSource) --->RSA6 (Post Processing) ---> LBWG (Empty Setup tables) ---> LBWE (LO Cockpit) ---> SBIW (Fill Setup tables) --->RSA3 (Extract Checker) ---> Replicate Application Component (in BW system)

1)      Logon to ECC System
a)      To activate LO DataSource go to RSA5
                                 i.            Expend SAP-R/3, expend MM then MM-I0, note logistics can be from MM, SD most of the times, select 2LIS_02_ITM
                               ii.            To check properties of the data source copy its name go to RSA2, provide name of DataSource
                              iii.            In the RSA5 and click the Activate DataSources button from application toolbar
b)      To verify it go to RSA3, you will get 0 records, it doesn’t mean that Base tables of ECC don’t have data, rather we need to fill the Setup tables
c)       To fill Setup tables, go to SBIW, expend Setting for Application Specific DataSources, expend Logistics, expend Managing Extract Structures, then Initialization, to make sure that there is no data in setup tables click Delete the Contents of Setup tables, it will ask for application no
                                 i.            To find application number  go to LBWE, you will find that there is 02 in front of Purchasing, it’s the application number enter it which will delete all the data from purchasing DataSources
                               ii.            In SBIW select Filling in the Setup tables then Application specific setup of statistical data click on execute in front of perform setup-purchasing, give name of run and make sure the termination date is always in future bcz data is in huge volume which takes time to load to avoid losing any records added during load time we specify termination date in future, always execute it back end, so go to Program->Execute in Background from top menu bar, enter default printer name like lp01, select immediately on next window and click save
                              iii.            To monitor this job go to SM37, once the job is complete, you can verify the records from extract checker
d)      To check validity of the LO DataSource go to RSA3, give DataSource name (2LIS_02_ITM), click Extraction button, then select List button to check data
2)      Logon to BW system to get the structure of activated LO DataSource
a.       In DWW go to Source System, expend SAP, double click on your ECC system
b.      Find your application component (MM) , and select Replicate Metadata
3)      To load data from source system to our DataSource, create InfoPackage and Execute it
a.       Right click 2LIS_02_ITM and select Create InfoPackage, provide description and click Save
b.       Update Tab
                                                   i.      Full update will load all the records without setting the marker
                                                 ii.      Initialize of Delta Process will set a marker, which indicate till this record data has been loaded
                                                iii.      Initialization with Data Transfer is used when we are loading data for the very first time and the marker was not set, it is almost similar to full update but it will also set the marker till the records are loaded
                                               iv.      Initialize without Data Transfer will just set marker so that we can use the delta load in the upcoming loads to our InfoProviders, means when in this InfoPackage is executed it won’t  load records to InfoProvider instead it will set the marker for future delta  load, select here this option
c.       Data Selection Tab
                                                   i.      To set the criteria (e.g. purchasing document, purchasing date) for InfoPackage execution i.e. from which the delta will be available, select From Value for  BUDAT (Purchasing Document Date)  like 20.04.2012, then from top menu bar select Scheduler---> Initialization Options for Source System, click Continue in pop up
d.      Schedule Tab
                                                   i.       Start Data Load Immediately and click Start button

Tuesday, December 17, 2013

DataStore Object (DSO)



§  In BI version 3.x  it was known as Operational DataStore (ODS)
§  DSOs act as the staging layer that stores transaction level data and/or stores data received from multiple sources, before sending it onto InfoCubes or other data targets
§  DSOs have two types of fields:
1)      Key Fields; uniquely identify a record in a DSO
2)      Data Fields; contain both characteristic and key figure InfoObjects
§  DSO will overwrite the data when all the key fields are same, While property if an InfoCube is that it aggregates when all the characteristics are same
§  It’s not advised to store master data in DSO, instead we store transaction data at detail level not at aggregated level
§  There are four types of DSOs
1)      Standard DSO
§  Standard DSO consists of three tables
·         Activation Queue (New Data) Table
·         Active Data Table
·         Change Log Table
2)      Write Optimized DSO
§  It consists of only one table; Active data table
3)      Direct-Update DSO
§  It consists of only active data table
§  Data in this type of DSO can’t loaded with standard data staging process; instead, SAP BW supplies APIs
4)      In-Memory/SAP HANA-optimized  DSO
§  The SAP HANA database is essential prerequisite for this DSO

Creating Standard DSO

1)      Create your Standard DSO
a.       In DWW under InfoProvder, select your InfoArea and from context menu of infoarea Select Create DataStore Object
b.      Provide technical name (ZDSO_01) and description (Asghar DataStore Object), and click Create icon
c.       Select Characteristics InfoObject catalog from the toolbar of the center panel, in popup window select your characteristic InfoObject catalog, Drag Product ID, Customer ID from the central panel and drop it over Key Fields in right panel
d.      Drag Customer Name, Product Group from the central panel and drop it over the Data fields in right panel
e.      Now select Key Figure InfoObject catalog from the toolbar of the center panel, in popup select your key figure InfoObjects catalog, Drag Price and Quantity from central panel and drop it over Data fields in the right panel, note key figures will always go to data fields.
f.        Activate your DSO

2)      Create and Load data to your DataSource
a.       In DWW go to DataSources section, right click your Application component select Create DataSource
b.      Provide name (ZDS_DSO01), select Data Type DataSource as Transaction Data, click Continue
·   General Tab
Short Des:                           DS for DSO01
Medium Des:                      DS for DSO01
Long Des:                           DataSource for DSO01
·   Extraction Tab
File Name:                                       browse for csv file
Header Rows to be ignored:             1
Data Format:                                    Separated with Separator
Data Separator:                                ,
·   Proposal Tab
Click Load Example Data
·   Fields Tab
On Copy changes pop up click Yes
·   Preview Tab
Click Read Example Data
Click Activate button in popup window
c.       Right click your DataSource (ZDS_DSO01) and select Create InfoPackage
·   Provide “IP for DataSource for DSO01” as InfoPackage description, click Save
·   Schedule Tab
Select Start Data Load Immediately
Click Start button
d.      To verify is it successful right click DataSource (ZDS_DSO01) and select Manage, the green icon in 3rd column of the popup depicts that load is successful

3)      Load data to your DSO
a.       In DWW go to InfoProvider section, in your InfoArea, select your DSO (ZDSO_01) and select Transformation
·   In Source of Transformation; select Object Type as DataSource, ZDS_DSO01 in DataSource and flat file name  in source system click Continue
·   Map fields as:
ZDS_DSO01                                    ZDSO_01
Customer ID ------------------------ Customer ID
Product ID    ------------------------ Product ID
Product Grp ------------------------ Product Group
Quantity       ------------------------ Quantity
UOM             ------------------------ Unit
Price             ------------------------ Price
Currency     ------------------------ Currency
·   Activate Transformation
b.      Right click Data Transfer Processes icon and select Create Data Transfer Process, click Continue on next screen
·   Extraction Tab
Extraction Mode:             Delta
·   Update Tab
Error Handling:  Valid Records Update, No Reporting (Request Red)
·   Execute Tab
Activate the DTP from application toolbar to enable Execute button, Click Execute button, click Yes in popup
·   Green status icons in Monitor screen depicts data is loaded successfully, select Administer Data Target from application toolbar, Select your DSO in top section and click Contents button on application toolbar. Click Execute button, you will see there is no data available yet.
·    It is because in standard DSO there are three types of tables (Activation Queue (New Data), Active Data, Change Log), when we execute DTP to load data from DataSource to DSO, it will be saved into Activation Queue table. Data in Activation Queue table is not available for reporting or viewing
·   Activation queue data can be seen as DSO-->Manage-->Contents Tab-->New Data button
·   When you activate the data, it will be moved parallel to active data and change log tables, Report fetch data from active data table, while when we load data from DSO to other target it is loaded from change log table
·   To activate data go to DSO-->Manage-->Requests Tab-->Activate button---Select request in Pop up-->click Start--> close pop up--->Refresh---->Apply Changes
·   To check data in Active Data table, follow path DSO-->Manage-->Contents Tab--> Active Data button

Creating Write-Optimized DSO

·         In Write-optimized DSO there is only active table
·         Data is directly loaded to active table so there is no need to activate the data

1)      Create your Write-Optimized DSO
a.       Follow steps from previous section to create Write-Optimized DSO, You only have to change the type of DSO when creating it
b.      In right panel of window, expend Settings, click on Pencil button in front of Type of DSO. choose Write-Optimized option from popup window
c.       Now you have to add key fields to semantic key and rest of the fields go to Data fields
d.      Activate DSO
2)      Create and Load data to your DataSource
a.       Follow steps from previous section
3)      Load data to your DSO
a.       Follow steps from previous section, but note here we don’t need activation of data