Datasource Enhancement
Datasource Enhancement
Applies to:
SAP BW 3.x and SAP BI 7.x Source Systems (e.g.: ECC). For more information, visit the EDW homepage
Summary
This document gives the Step by step procedure to enhance Standard Business content extractors (both master data and transactional data) using RSU5_SAPI_BADI. Author: Venkata Nagarjuna Reddy
Author Bio
Venkata Nagarjuna Reddy is a Technology Lead working in Infosys Limited, Nagarjuna Joined Infosys Limited in Sep 2008 and worked on various SAP BI Projects.
Table of Contents
Introduction ......................................................................................................................................................... 3 Scenario .............................................................................................................................................................. 3 Procedure ........................................................................................................................................................... 3 Enhancing Extract Structure ........................................................................................................................... 3 Filling Data to the Enhanced field ................................................................................................................... 5 Implementation of created BADI ..................................................................................................................... 7 Testing through RSA3 ..................................................................................................................................... 7 Related Content .................................................................................................................................................. 8 Disclaimer and Liability Notice ............................................................................................................................ 9
Introduction
Generally SAP user exit RSAP001 is used to add any additional fields to the Standard BW Extractors whcih includes both Master Data and Transcation Data extractors. But as per SAPs recommendation BADIs are more effecient way to enhance the standard extractors than using the exit RSAP001 Enhacing a Standard DataSource using BADI has the following advantage over using the exit RSAP001: BADI can have mulitple implementations (only if Multiple use flag is set for the Badi) so several developers can work simultaneously on different implementions and different logics. RSU5_SAPI_BADI is used to enhance the standard BI DataSources
Scenario
In this document the Standard Master Data Source 0PROFIT_CTR_ATTR is appended with the field BUKRS Company Code. The data for this field is filled from CEPC - BUKRS
Procedure
Enhancing Extract Structure 1. Go to T-Code RSA6 (Post Process DataSource and Hierarchy) and slect the DataSource 0PROFIT_CTR_ATTR
3. Now click on Append Structure and create append structure and then add the required field BUKRS (if there is an append structure already available, you can use the same append structure or can create a new append structure. Here I have added the field to the already available append structure) to the append structure and activate the Extract Structure BWEC_MD_PROFIT_CTR.
4. Now actiavte the DataSource and make sure the newly added filed is available in the DataSource.
Filling Data to the Enhanced field 1. Go to SE24 and create a class ZCL_IM_ZBW_0PROFIT_ATTR and in the Interfaces tab of the class enter IF_EX_RSU5_SAPI_BADI.
2. Now 2 methods DATA_TRANSFORM and HIER_TRANSFORM will be available in the Method tab.
3. Write the code in the method IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM as below to fill the data to the Enhanced field and actiavte the class.
Code:
method IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM. CHECK i_datasource = '0PROFIT_CTR_ATTR'. DATA: lt_data TYPE TABLE OF BWEC_MD_PROFIT_CTR. FIELD-SYMBOLS: <ls_data> TYPE BWEC_MD_PROFIT_CTR. *----------------------------------------------------------------* * Internal table for CEPC_BUKRS *----------------------------------------------------------------* TYPES: BEGIN OF ty_profitctr, PRCTR TYPE BWEC_MD_PROFIT_CTR-PRCTR, BUKRS TYPE BWEC_MD_PROFIT_CTR-BUKRS, END OF ty_profitctr.
DATA: lt_profitctr type standard table of ty_profitctr, ls_profitctr type ty_profitctr. lt_data[] = c_t_data[]. *----------------------------------------------------------------* * Read data into internal memory *----------------------------------------------------------------* select prctr bukrs from cepc_bukrs into table lt_profitctr for all entries in lt_data where prctr eq lt_data-prctr. LOOP AT lt_data ASSIGNING <ls_data>. read table lt_profitctr into ls_profitctr with key prctr = <ls_data>-PRCTR . if sy-subrc eq 0. <ls_data>-BUKRS = ls_profitctr-BUKRS. MODIFY lt_data FROM <ls_data>. endif. ENDLOOP. REFRESH c_t_data. c_t_data[] = lt_data[]. endmethod.
Implementation of created BADI 1. Go to BADI Definition RSU5_SAPI_BADI using Tcode SE18 and create implementation ZBW_0PROF_ATTR.
2. Go to the Interface tab and enter the created class ZCL_IM_ZBW_0PROFIT_ATTR in the Implementing class name field and activate
Testing through RSA3 Go to RSA3 and execute the DataSource 0PROFIT_CTR_ATTR and check the extracted data to see the data to the enhanced field is filled.
Related Content
Note 691154 - SAPI with BADI: User exits in SAPI with BADI interfaces Enhancing DataSources For more information, visit the EDW homepage