Step by Step SAP ECC Datasource Enhancement Based on Program
Step by Step SAP ECC Datasource Enhancement Based on Program
SAP ECC Datasource Enhancement Based on Program:
Summary
This document will explain about datasource enhancements for Bi extraction in ECC system using Program. It contains Customized code which helps you to use for any Bi datasource enhancement in ECC with minimal changes.
Author : Swamynaidu Chalapareddi
Company : Accenture India Pvt Ltd
Created on: 4th Sep 2013
Author Bio
SwamyNaidu Chalapareddi is a SAP-BI Senior Consultant in Accenture India Pvt LTD, USA (GCP). His Expertise includes SAP BI BO with HANA and ABAP developments.
1. Business Scenario
Data source 0FC_IPL_ITEM_01 is appended with fields AUGST, STAKZ, AUGRS, HVORG AND TVORG. The data for these fields
should be filled from DFKKOP table.
2. Step by Step Solution
Go to T code CMOD. Give the project name then click on Create.
Give the short text and then click on Enhancement assignments
Give the Enhancement Name then click on components
Then click on à EXIT_SAPLRSAP_001
Then click on à INCLUDE ZXRSAU01
Included the code below in the include ZXRSAU01:
Appended Fields to Datasource (0FC_IPL_ITEM_01):AUGST, STAKZ, AUGRS, HVORG AND TVORG in RSA6
Then go to SE38:
What this code does is to look up an SE38 program related to the datasource being executed. In other words, if
you need to enhance your datasource, you will need to create an SE38 program following the naming convention below:
ZBW_Datasource
For example, if we need to enhance the 0FC_IPL_ITEM_01 datasource, we will need create
the SE38 program ZBW_0FC_IPL_ITEM_01.
This allows us to have a clean include in CMOD, and all our datasource specific code will be contained within
each individual SE38 programs, meaning no risk of impacting the code of other datasources.
Go to SE38 and Give the Program name and create then give the Title
Write the code below and save and activate
*&———————————————————————*
*& Report ZBW_0FC_IPL_ITEM_01
*&
*&———————————————————————*
*&
*&
*&———————————————————————*
REPORT ZBW_0FC_IPL_ITEM_01.
TYPE-POOLS: sbiwa, rsap, rsaot.
*&———————————————————————*
*& Form execute_user_exit
*&———————————————————————*
* text
*———————————————————————-*
* –>I_T_SELECT text
* –>I_T_FIELDS text
* –>C_T_DATA text
* –>C_T_MESSAGES text
*———————————————————————-*
FORM execute_user_exit TABLES i_t_select TYPE sbiwa_t_select
i_t_fields TYPE sbiwa_t_fields
c_t_data STRUCTURE FKKIPBW_ITEM
c_t_messages STRUCTURE balmi.
FIELD-SYMBOLS: <l_s_data> TYPE FKKIPBW_ITEM.
TYPES: BEGIN OF t_emma,
V_OPBEL TYPE OPBEL_KK,
V_AUGST TYPE AUGST_KK,
V_STAKZ TYPE STAKZ_KK,
V_AUGRS TYPE AUGRS_KK,
V_HVORG TYPE HVORG_KK,
v_TVORG TYPE TVORG_KK,
END OF t_emma.
* Declare an internal table and work area with above type
DATA: wa_emma TYPE t_emma,
l_t_emma LIKE HASHED TABLE OF wa_emma WITH UNIQUE KEY V_OPBEL,
l_t_data TYPE STANDARD TABLE OF FKKIPBW_ITEM.
*Move content of datasource table to internal table
l_t_data[] = c_t_data[].
IF NOT l_t_data IS INITIAL.
*Select the fields that were enhanced in the datasource
SELECT OPBEL AUGST STAKZ AUGRS HVORG TVORG FROM DFKKOP
INTO TABLE l_t_emma
FOR ALL ENTRIES IN l_t_data
WHERE OPBEL = l_t_data-OPBEL.
*Get each reacord from L_T_DATA and add it to the work area WA_EMMA
LOOP AT l_t_data ASSIGNING <l_s_data>.
CLEAR wa_emma.
READ TABLE l_t_emma
WITH TABLE KEY v_OPBEL = <l_s_data>-OPBEL
INTO wa_emma TRANSPORTING ALL FIELDS.
*Assign the value of the enhanced fields to the internal table L_T_DATA
IF sy-subrc = 0.
<l_s_data>-AUGST = wa_emma-v_AUGST.
<l_s_data>-STAKZ = wa_emma-v_STAKZ.
<l_s_data>-AUGRS = wa_emma-v_AUGRS.
<l_s_data>-HVORG = wa_emma-v_HVORG.
<l_s_data>-TVORG = wa_emma-v_TVORG.
ENDIF.
ENDLOOP.
ENDIF.
*Copy the data back to the datasource table C_T_DATA
c_t_data[] = l_t_data[].
REFRESH: l_t_data,
l_t_emma.
ENDFORM. “execute_user_exit
Nice solution for the exit, maybe the format of the screenshot is not best possible.
Good document
appended fields, Please take the ZZ* fields