Sie sind auf Seite 1von 8

Step by Step Guide to DataSource

Enhancement BAdI Approach

Applies to:
SAP_BASIS 6.20 and PI_BASIS 2004_1 (R/3 Release 4.6C & above), SAP Netweaver BW 7.x. For more
information, visit the EDW homepage

Summary
As of SAP_BASIS 6.20 and PI_BASIS 2004_1 (R/3 Release 4.6C) is available a more efficient way to
enhance SAP standard content, using Business Add-In (BAdI - RSU5_SAPI_BADI) instead of using the
classical approach of user exits.
Author:

Sohil Shah, Brinto Roy

Company: Deloitte Consulting


Created on: 9 September 2011

Author Bio
Brinto Roy is a SAP BI / BO Consultant with over 4 years of experience. He is currently working at Deloitte
Consulting India Pvt. Ltd.. He also has extensive experience in Business Objects suite of products.
Sohil Shah is working as Senior consultant at Deloitte Consulting India Pvt. Ltd. He has an experience
around 7 years in the field of SAP. He is the technical reviewer of an SAP Press book A Practical Guide to
SAP Netweaver Business Warehouse 7.0

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


1

Step by Step Guide to DataSource Enhancement BAdI Approach

Table of Contents
Business Scenario .............................................................................................................................................. 3
BAdI Implementation Steps ................................................................................................................................ 3
Appendix 1 .......................................................................................................................................................... 5
Related Content .................................................................................................................................................. 7
Disclaimer and Liability Notice ............................................................................................................................ 8

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


2

Step by Step Guide to DataSource Enhancement BAdI Approach

Business Scenario
In a projects with multiple locations within the same region & in the same time zone will face issue, of
multiple use of the Exit, with the conventional method of enhancing DataSources using Customer Exit (Tr.
Code: CMOD). With the introduction of BadI (RSU5_SAPI_BADI), we can enhance as many DataSources as
required at a time across the location.

BAdI Implementation Steps

SAP provides the definition of the BADI (RSU5_SAPI_BADI), and we need to create the
implementation using the Transaction code SE19 as shown in figure 1:

Figure 1: SE19 Transaction screen

On the next pop up screen, we need to define our implementation name as shown in the figure 2. Plz
note to check the checkbox Multiple Use as shown on the Attributes tab.

Figure 2: BAdI Attributes tab

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


3

Step by Step Guide to DataSource Enhancement BAdI Approach

Activate the implementation.


Result: You have created the implementation of the BADI that will be used to create the DataSource
enhancements.

Click on Interface Tab, where we will have information about the Implementing Class & methods.

Figure 3: BAdI Interface tab

Click on link ZCL_IM_ZRSU5_SAPI_BADI to go to Class Builder.

Figure 4: BAdI Interface methods

On the class builder click on the method name: IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM.


Appendix 1 will show the reusable code for the same, only following syntax may require change i.e.
CONCATENATE 'ZBWI_' i_datasource INTO l_prog_name.
Here instead of ZBWI, one can use their own naming convention.

Appendix 2 will show the Generic code for the DataSource enhancement SE38 Report.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


4

Step by Step Guide to DataSource Enhancement BAdI Approach

Appendix 1
DATA: ls_oltpsource TYPE rsaot_s_osource,
lv_data TYPE REF TO data,
lv_method TYPE seocmpname.
FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE.
DATA: l_prog_name TYPE C LENGTH 40.
* check BW system
* check _check_bw_system( ) = 'X'.
* check if any data is extracted
CHECK c_t_data IS NOT INITIAL.
CALL FUNCTION 'RSA1_SINGLE_OLTPSOURCE_GET'
EXPORTING
i_oltpsource
= i_datasource
i_objvers
= 'A'
IMPORTING
e_s_oltpsource = ls_oltpsource
EXCEPTIONS
no_authority
= 1
not_exist
= 2
inconsistent
= 3
OTHERS
= 4.
IF sy-subrc <> 0.
EXIT.
ENDIF.
* Create data for Extract Structure
CREATE DATA lv_data TYPE TABLE OF (ls_oltpsource-exstruct).
ASSIGN lv_data->* TO <lt_data>.
ASSIGN c_t_data TO <lt_data>.
CONCATENATE 'ZBWI_' i_datasource INTO l_prog_name.
PERFORM execute_user_exit IN PROGRAM (l_prog_name)
TABLES I_T_SELECT
I_T_FIELDS
<LT_DATA>
C_T_MESSAGES
IF FOUND.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


5

Step by Step Guide to DataSource Enhancement BAdI Approach

Appendix 2
Create a Program in SE38 specific for each DataSource. For example, if we need to enhance
2LIS_11_VAHDR (Sales Order Header DataSource) then the program ZBWI_2LIS_11_VAHDR needs to be
created for the same.
Note: Naming convention ZBWI_<DataSource name>.

Make sure the Program type Executable Program and status is Customer Production Program.

REPORT zbwi_2lis_11_vahdr.
TYPE-POOLS: sbiwa.
* Data Definition
* DATA: lt_vbak type standard table of vbak,
* ls_vbak type vbak .
* FIELD-SYMBOLS: <L_S_DATA> TYPE <Extract structure name>.
*&---------------------------------------------------------------------*
*&
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 <Extract structure name>
c_t_messages STRUCTURE balmi.
* Perform select
SELECT * FROM VBAK INTO TABLE lth_vbak
FOR ALL ENTRIES IN C_T_DATA
WHERE VBELN = C_T_DATA_VBELN.
* map the data
LOOP AT C_T_DATA ASSIGNING <L_S_DATA>.
READ TABLE lth_vbak into ls_vbak
with table key vbeln = <L_S_DATA>-vbeln.
if sy-subrc is initial.
<L_S_DATA>-VKORG = ls_vbak-vkorg.

Note: MODIFY statement is not required as the field will be populated immediately in the Internal table by using Field
Symbols.
endif.
* ENDLOOP.
ENDFORM.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


6

Step by Step Guide to DataSource Enhancement BAdI Approach

Related Content
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0af763b-066e-2910-a784dc6731660f46?QuickLink=index&overridelayout=true
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0eade6c-692a-2c10-ac8680f6b2157791?QuickLink=index&overridelayout=true
For more information, visit the EDW homepage

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


7

Step by Step Guide to DataSource Enhancement BAdI Approach

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.

SAP COMMUNITY NETWORK


2011 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com


8

Das könnte Ihnen auch gefallen