Enhancing Data Sources With BAdI RSU5 - SAPI - BADI
Enhancing Data Sources With BAdI RSU5 - SAPI - BADI
Enhancing Data Sources With BAdI RSU5 - SAPI - BADI
Applies to:
As of SAP_BASIS 6.20 and PI_BASIS 2004_1 (R/3 Release 4.6C).
Summary
This white paper explains in details how to enhance DataSources with the new featured BAdI
RSU5_SAPI_BADI.
It is shown how to implement each enhancement on a separated method of the BABI class, making the code
more organized and clear, then in the formerly user exit’s EXIT_SAPLRSAP_00X.
Author Bio
© 2007 SAP AG 1
Enhancing DataSources with BAdI RSU5_SAPI_BADI
Table of Contents
© 2007 SAP AG 2
Enhancing DataSources with BAdI RSU5_SAPI_BADI
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-Ins (BAdIs) rather than user exits.
The technical name of this BAdI is RSU5_SAPI_BADI, detailed on the SAP Note 691154.
Each enhancement will be implemented in a separated method of the BABI class, then the code will be more
organized and clear.
Below, I describe in details, how it can be done, just following a simple few steps.
Before we begin, there are some pre conditions, that must be filled:
I will assume that the process of creating and enhancing extraction structures of a given datasource is know
by the reader.
If you have doubts about the creation and enhancement of data sources, consult the documentation on SDN.
On transaction SE19
• Type
• Click on
© 2007 SAP AG 3
Enhancing DataSources with BAdI RSU5_SAPI_BADI
Click to confirm.
Result: You have created the implementation of the BADI, that will used to create the datasource
enhancements.
© 2007 SAP AG 4
Enhancing DataSources with BAdI RSU5_SAPI_BADI
© 2007 SAP AG 5
Enhancing DataSources with BAdI RSU5_SAPI_BADI
method IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM.
**********************************************************
* To implement an exit for a
* datasource create your own method by copying the
* method _TEMPLATE_DATASOURCE and rename it to the name
* of your datasource. In case you enhance a Business
* Content datasource skip the 0 at the beginning (e.g.
* Datasource 0FI_AR_3 -> Method FI_AR_3
* The method is then called by the Exit Framework
*********************************************************
* check BW system
check _check_bw_system( ) = 'X'.
IF sy-subrc <> 0.
© 2007 SAP AG 6
Enhancing DataSources with BAdI RSU5_SAPI_BADI
EXIT.
ENDIF.
IF lv_method(1) = '0' or
lv_method(1) = '2'.
* shift by one character as methods can't start with a number
SHIFT lv_method.
ENDIF.
endmethod.
© 2007 SAP AG 7
Enhancing DataSources with BAdI RSU5_SAPI_BADI
method _TEMPLATE_DATASOURCE.
* Data Definition
* DATA: lth_vbak type hashed table of vbak
* with unique key vbeln,
* ls_vbak type vbak .
* Init
* Perform always a mass select into an internal table
* SELECT * FROM VBAK INTO TABLE lth_vbak
* FOR ALL ENTRIES IN C_T_DATA
* WHERE VBELN = C_T_DATA_VBELN.
endmethod.
© 2007 SAP AG 8
Enhancing DataSources with BAdI RSU5_SAPI_BADI
At this point you have created the implementation class for the BADI RSU5_SAPI_BADI. That can be used
for any extractor, standard or custom, to populate enhanced fields. And you have a template to build new
enhancements for DataSources.
Result: You have created the methods needed to make enhancements of the datasources.
© 2007 SAP AG 9
Enhancing DataSources with BAdI RSU5_SAPI_BADI
ie.
As you see in the picture, the Extract Structure of the data source 2LIS_18_I0TASK is MC18I00TSK.
© 2007 SAP AG 10
Enhancing DataSources with BAdI RSU5_SAPI_BADI
Declare:
During the execution of the extraction process, when this method is called, the structure C_T_DATA will be
populated with packages of 100 records each time. So a loop must be declared to process these data
packages, as you see on the code examples bellow.
Here a simple way to populate the fields of the structure straight from the select:
method DS_FICA_VIEW_ZVDSFICACI.
ENDLOOP.
endmethod.
And here a slight more complex example, using some functions inside the code:
METHOD lis_18_i0task.
*************************************************************************
* FIELD-SYMBOLS *
*************************************************************************
© 2007 SAP AG 11
Enhancing DataSources with BAdI RSU5_SAPI_BADI
*************************************************************************
* CONSTANTS *
*************************************************************************
CONSTANTS:
C_SPRAS TYPE SY-LANGU VALUE 'PT'.
IF sy-subrc = 0.
<l_s_data>-zstssis = l_line.
<l_s_data>-ZSTSUSU = L_USER_LINE(4).
IF sy-subrc = 0.
<l_s_data>-zflanu = 'ANUL'.
ENDIF.
© 2007 SAP AG 12
Enhancing DataSources with BAdI RSU5_SAPI_BADI
ENDIF.
ENDLOOP.
ENDMETHOD.
© 2007 SAP AG 13
Enhancing DataSources with BAdI RSU5_SAPI_BADI
Conclusion:
With this new method of creating enhancements, SAP makes available a more clear and effitient way to
enhance datasources.
I hope this article be useful to help you to enhance standard, or develop this own datasources, using this
new feature.
Flávio A. Peres
BW Senior Consultant.
[email protected]
[email protected]
© 2007 SAP AG 14
Enhancing DataSources with BAdI RSU5_SAPI_BADI
Related Content
• Note 691154 - SAPI with BADI: User exits in SAPI with BADI-interfaces
• How to... Create a Generic Data Extractor
© 2007 SAP AG 15
Enhancing DataSources with BAdI RSU5_SAPI_BADI
© 2007 SAP AG 16