SlideShare a Scribd company logo
1 of 16
Download to read offline
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 1
Enhancing DataSources 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(s): Flávio Peres
Company: NetSoft Sistemas
Created on: 02 febuary 2007
Author Bio
Flávio Peres is a SAP-BW Senior Consultant in NetSoft, São Paulo, Brasil.
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 2
Table of Contents
Enhancing DataSources with BAdI RSU5_SAPI_BADI .................................................................. 3
Implementing the BADI.................................................................................................................... 3
On transaction SE19.................................................................................................................... 3
Define a implementation name for your class.............................................................................. 4
Then paste the following code: .................................................................................................... 6
Create a new method and name it: _TEMPLATE_DATASOURCE. ........................................... 8
Define the properties of this method as static and public ............................................................ 8
Creating a enhancemente of a datasource. .................................................................................. 10
Declare on the code the structure to populate........................................................................... 10
Bellow you have too examples of how to code your enhancement:.......................................... 11
Here a simple way to populate the fields of the structure straight from the select:................ 11
And here a slight more complex example, using some functions inside the code:................ 11
Conclusion: .................................................................................................................................... 14
Related Content............................................................................................................................. 15
Disclaimer and Liability Notice....................................................................................................... 16
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 3
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:
• SAP_BASIS 6.20 and PI_BASIS 2004_1 must be installed on your system.
• The BADI-definition RSU5_SAPI_BADI (SE18) must exists in your system.
Once the pre conditions ware verified, it’s time to go.
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.
Implementing the BADI.
SAP make available the definition of the BADI, the implementation must be created for us, as follows:
On transaction SE19
• Type
• Click on
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 4
Define a implementation name for your class.
Click to confirm.
Click on to activate de implementation.
Result: You have created the implementation of the BADI, that will used to create the datasource
enhancements.
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 5
Click on the TAB
Click on the link
You go to the class builder
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 6
On the class builder click on the method name:
Then paste the following code:
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
*********************************************************
DATA: ls_oltpsource TYPE rsaot_s_osource,
lv_data TYPE REF TO data,
lv_method TYPE seocmpname.
FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE.
* 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.
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 7
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>.
* get method name for datasource
lv_method = i_datasource.
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.
* check method is implemented
CHECK _check_method_exists( lv_method ) = 'X'.
CALL METHOD (lv_method)
EXPORTING
i_updmode = i_updmode
i_t_select = i_t_select
i_t_fields = i_t_fields
CHANGING
c_t_data = <lt_data>
c_t_messages = c_t_messages.
endmethod.
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 8
Create a new method and name it: _TEMPLATE_DATASOURCE.
Then click over the name of the new method and paste the following code:
method _TEMPLATE_DATASOURCE.
* Data Definition
* DATA: lth_vbak type hashed table of vbak
* with unique key vbeln,
* ls_vbak type vbak .
* FIELD-SYMBOLS: <L_S_DATA> TYPE <Extract structure name>.
* 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.
* 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 eq 0.
* <L_S_DATA>-VKORG = ls_vbak-vkorg.
* !!! No MODIFY necessary as the field is changed immediatly in the
* internal table by using Field Symbols
* endif.
* ENDLOOP.
endmethod.
Define the properties of this method as static and public
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 9
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.
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 10
Creating a enhancemente of a datasource.
I will assume that you have enhanced the structure of the data source, and need to code to populate the
enhanced fields of the structure.
Copy the method _TEMPLATE_DATASOURCE and rename it, with the same name of the datasource you
want to enhance. In case of standard datasource, omit the first character of the name (‘0’ or ‘2’).
ie. DataSource 2LIS_18_IOTASK Method name: LIS_18_IOTASK
ie.
Declare on the code the structure to populate.
On the code, you have to declare the structure <L_S_DATA> of the type of the enhancement sctructure of
your data source, ie:
Trans: RSA6
As you see in the picture, the Extract Structure of the data source 2LIS_18_I0TASK is MC18I00TSK.
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 11
Declare:
FIELD-SYMBOLS: <l_s_data> TYPE MC18I00TSK .
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.
Bellow you have too examples of how to code your enhancement:
Here a simple way to populate the fields of the structure straight from the select:
method DS_FICA_VIEW_ZVDSFICACI.
FIELD-SYMBOLS: <L_S_DATA> TYPE ZOXBND0152.
* map the data
LOOP AT C_T_DATA ASSIGNING <L_S_DATA>.
SELECT SINGLE BETRH BETRW INTO (<L_S_DATA>-BETRH, <L_S_DATA>-BETRW)
FROM DFKKOP WHERE OPBEL = <L_S_DATA>-OPBEL AND
OPUPW = <L_S_DATA>-OPUPW AND
OPUPK = <L_S_DATA>-OPUPK AND
OPUPZ = <L_S_DATA>-OPUPZ.
ENDLOOP.
endmethod.
And here a slight more complex example, using some functions inside the code:
METHOD lis_18_i0task.
DATA: l_anw_stat_existing TYPE xfeld,
l_e_stsma TYPE jsto-stsma,
l_line TYPE bsvx-sttxt,
l_user_line TYPE bsvx-sttxt,
l_stonr TYPE tj30-stonr.
*************************************************************************
* FIELD-SYMBOLS *
*************************************************************************
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 12
FIELD-SYMBOLS: <l_s_data> TYPE MC18I00TSK .
*************************************************************************
* CONSTANTS *
*************************************************************************
CONSTANTS:
C_SPRAS TYPE SY-LANGU VALUE 'PT'.
*** Get the measures status, record by record
*** The DataSource loads a package of 100 records each time, then
*** we have to have a loop to process then.
LOOP AT c_t_data ASSIGNING <l_s_data>.
*** Function measure status
CALL FUNCTION 'STATUS_TEXT_EDIT'
EXPORTING
client = sy-mandt
flg_user_stat = 'X'
objnr = <l_s_data>-objnr
only_active = 'X'
spras = c_spras
bypass_buffer = ' '
IMPORTING
anw_stat_existing = l_anw_stat_existing
e_stsma = l_e_stsma
line = l_line
user_line = l_user_line
stonr = l_stonr
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
<l_s_data>-zstssis = l_line.
<l_s_data>-ZSTSUSU = L_USER_LINE(4).
*** SEARCH THE STRING 'ANUL'
search l_user_line for 'ANUL'.
IF sy-subrc = 0.
<l_s_data>-zflanu = 'ANUL'.
ENDIF.
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 13
ENDIF.
ENDLOOP.
ENDMETHOD.
Go to the transaction RSA3 and test your data source.
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 14
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.
flavio.amoedo@gmail.com
flavio_amoedo@yahoo.com.br
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 15
Related Content
• Note 691154 - SAPI with BADI: User exits in SAPI with BADI-interfaces
• How to... Create a Generic Data Extractor
Enhancing DataSources with BAdI RSU5_SAPI_BADI
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 16
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.

More Related Content

What's hot

Lo extraction part 3 extractor logic
Lo extraction   part 3 extractor logicLo extraction   part 3 extractor logic
Lo extraction part 3 extractor logic
JNTU University
 
Line item dimension and high cardinality dimension
Line item dimension and high cardinality dimensionLine item dimension and high cardinality dimension
Line item dimension and high cardinality dimension
Praveen Kumar
 
Analysis process designer (apd) part 2
Analysis process designer (apd) part   2Analysis process designer (apd) part   2
Analysis process designer (apd) part 2
dejavee
 
Bw writing routines in update rules
Bw writing routines in update rulesBw writing routines in update rules
Bw writing routines in update rules
knreddyy
 
Sap sapscripts tips and tricks
Sap sapscripts tips and tricksSap sapscripts tips and tricks
Sap sapscripts tips and tricks
Kranthi Kumar
 
Using error stack and error dt ps in sap bi 7.0
Using error stack and error dt ps in sap bi 7.0Using error stack and error dt ps in sap bi 7.0
Using error stack and error dt ps in sap bi 7.0
gireesho
 
End to-end sap fiori extensibility use case
End to-end sap fiori extensibility use caseEnd to-end sap fiori extensibility use case
End to-end sap fiori extensibility use case
dkr786
 

What's hot (20)

Lo extraction part 3 extractor logic
Lo extraction   part 3 extractor logicLo extraction   part 3 extractor logic
Lo extraction part 3 extractor logic
 
BW Adjusting settings and monitoring data loads
BW Adjusting settings and monitoring data loadsBW Adjusting settings and monitoring data loads
BW Adjusting settings and monitoring data loads
 
How to run v3 job
How to run v3 jobHow to run v3 job
How to run v3 job
 
BADI IMPLEMENTATION.pdf
BADI IMPLEMENTATION.pdfBADI IMPLEMENTATION.pdf
BADI IMPLEMENTATION.pdf
 
How to write a routine for 0 calday in infopackage selection
How to write a routine for 0 calday in infopackage selectionHow to write a routine for 0 calday in infopackage selection
How to write a routine for 0 calday in infopackage selection
 
Sap bw4 hana
Sap bw4 hanaSap bw4 hana
Sap bw4 hana
 
HANA Modeling
HANA Modeling HANA Modeling
HANA Modeling
 
Line item dimension and high cardinality dimension
Line item dimension and high cardinality dimensionLine item dimension and high cardinality dimension
Line item dimension and high cardinality dimension
 
Introduction to extracting data from sap s 4 hana with abap cds views
Introduction to extracting data from sap s 4 hana with abap cds viewsIntroduction to extracting data from sap s 4 hana with abap cds views
Introduction to extracting data from sap s 4 hana with abap cds views
 
Analysis process designer (apd) part 2
Analysis process designer (apd) part   2Analysis process designer (apd) part   2
Analysis process designer (apd) part 2
 
Bw writing routines in update rules
Bw writing routines in update rulesBw writing routines in update rules
Bw writing routines in update rules
 
LSA++ english version
LSA++ english versionLSA++ english version
LSA++ english version
 
MD04 Report in BW
MD04 Report in BWMD04 Report in BW
MD04 Report in BW
 
Sap sapscripts tips and tricks
Sap sapscripts tips and tricksSap sapscripts tips and tricks
Sap sapscripts tips and tricks
 
Bapi step-by-step
Bapi step-by-stepBapi step-by-step
Bapi step-by-step
 
Sap bw4 hana architecture archetypes
Sap bw4 hana architecture archetypesSap bw4 hana architecture archetypes
Sap bw4 hana architecture archetypes
 
Using error stack and error dt ps in sap bi 7.0
Using error stack and error dt ps in sap bi 7.0Using error stack and error dt ps in sap bi 7.0
Using error stack and error dt ps in sap bi 7.0
 
End to-end sap fiori extensibility use case
End to-end sap fiori extensibility use caseEnd to-end sap fiori extensibility use case
End to-end sap fiori extensibility use case
 
Beginner's guide create a custom 'copy' planning function type
Beginner's guide  create a custom 'copy' planning function typeBeginner's guide  create a custom 'copy' planning function type
Beginner's guide create a custom 'copy' planning function type
 
How to add new Object Link in SAP DMS
How to add new Object Link in SAP DMSHow to add new Object Link in SAP DMS
How to add new Object Link in SAP DMS
 

Viewers also liked (11)

Why sap hana
Why sap hanaWhy sap hana
Why sap hana
 
SAP HANA Platform
SAP HANA Platform SAP HANA Platform
SAP HANA Platform
 
Step by step procedure for loading of data from the flat file to the master d...
Step by step procedure for loading of data from the flat file to the master d...Step by step procedure for loading of data from the flat file to the master d...
Step by step procedure for loading of data from the flat file to the master d...
 
B adi
B adiB adi
B adi
 
Pricing Routine In Vofm
Pricing Routine In VofmPricing Routine In Vofm
Pricing Routine In Vofm
 
Kindness to parents
Kindness to parentsKindness to parents
Kindness to parents
 
What is an_sap_business_blueprint
What is an_sap_business_blueprintWhat is an_sap_business_blueprint
What is an_sap_business_blueprint
 
SITIST 2015 Dev - Abap on Hana
SITIST 2015 Dev - Abap on HanaSITIST 2015 Dev - Abap on Hana
SITIST 2015 Dev - Abap on Hana
 
Dassian GOVCON Overview
Dassian GOVCON OverviewDassian GOVCON Overview
Dassian GOVCON Overview
 
SAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional ConsultantSAP BADI Implementation Learning for Functional Consultant
SAP BADI Implementation Learning for Functional Consultant
 
SAP HANA - Understanding the Basics
SAP HANA - Understanding the Basics SAP HANA - Understanding the Basics
SAP HANA - Understanding the Basics
 

Similar to Enhancing data sources with badi in SAP ABAP

Hr structural auths
Hr   structural authsHr   structural auths
Hr structural auths
hkodali
 
Rda step by step
Rda   step by stepRda   step by step
Rda step by step
Phani Kumar
 
Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflows
Hicham Khallouki
 
Variables in sap bi
Variables in sap biVariables in sap bi
Variables in sap bi
shabari76
 
Day 6.3 extraction_business_content_and_generic
Day 6.3 extraction_business_content_and_genericDay 6.3 extraction_business_content_and_generic
Day 6.3 extraction_business_content_and_generic
tovetrivel
 
Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Backup%20 domain%20controller%20(bdc)%20step by-step(1)Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Srinivas Dukka
 

Similar to Enhancing data sources with badi in SAP ABAP (20)

Fm extraction
Fm extractionFm extraction
Fm extraction
 
Hr structural auths
Hr   structural authsHr   structural auths
Hr structural auths
 
sap
sap sap
sap
 
Top 140+ Advanced SAS Interview Questions and Answers.pdf
Top 140+ Advanced SAS Interview Questions and Answers.pdfTop 140+ Advanced SAS Interview Questions and Answers.pdf
Top 140+ Advanced SAS Interview Questions and Answers.pdf
 
Rda step by step
Rda   step by stepRda   step by step
Rda step by step
 
Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflows
 
Variables in sap bi
Variables in sap biVariables in sap bi
Variables in sap bi
 
Day 6.3 extraction_business_content_and_generic
Day 6.3 extraction_business_content_and_genericDay 6.3 extraction_business_content_and_generic
Day 6.3 extraction_business_content_and_generic
 
SAP Quickviewer
SAP QuickviewerSAP Quickviewer
SAP Quickviewer
 
Query
QueryQuery
Query
 
Creating new unit of measure in sap bw
Creating new unit of measure in sap bwCreating new unit of measure in sap bw
Creating new unit of measure in sap bw
 
Learn SAS Programming
Learn SAS ProgrammingLearn SAS Programming
Learn SAS Programming
 
Delta machenism with db connect
Delta machenism with db connectDelta machenism with db connect
Delta machenism with db connect
 
Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3Discover SAP BusinessObjects BI 4.3
Discover SAP BusinessObjects BI 4.3
 
Using infoset query %2c sap query and quick viewer
Using infoset query %2c sap query and quick viewerUsing infoset query %2c sap query and quick viewer
Using infoset query %2c sap query and quick viewer
 
Using infoset query ,sap query and quick viewer
Using infoset query ,sap query and quick viewerUsing infoset query ,sap query and quick viewer
Using infoset query ,sap query and quick viewer
 
022006 zaidi badi
022006   zaidi badi022006   zaidi badi
022006 zaidi badi
 
Sap erp
Sap erpSap erp
Sap erp
 
_Using Selective Deletion in Process Chains.pdf
_Using Selective Deletion in Process Chains.pdf_Using Selective Deletion in Process Chains.pdf
_Using Selective Deletion in Process Chains.pdf
 
Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Backup%20 domain%20controller%20(bdc)%20step by-step(1)Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Backup%20 domain%20controller%20(bdc)%20step by-step(1)
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Enhancing data sources with badi in SAP ABAP

  • 1. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 1 Enhancing DataSources 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(s): Flávio Peres Company: NetSoft Sistemas Created on: 02 febuary 2007 Author Bio Flávio Peres is a SAP-BW Senior Consultant in NetSoft, São Paulo, Brasil.
  • 2. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 2 Table of Contents Enhancing DataSources with BAdI RSU5_SAPI_BADI .................................................................. 3 Implementing the BADI.................................................................................................................... 3 On transaction SE19.................................................................................................................... 3 Define a implementation name for your class.............................................................................. 4 Then paste the following code: .................................................................................................... 6 Create a new method and name it: _TEMPLATE_DATASOURCE. ........................................... 8 Define the properties of this method as static and public ............................................................ 8 Creating a enhancemente of a datasource. .................................................................................. 10 Declare on the code the structure to populate........................................................................... 10 Bellow you have too examples of how to code your enhancement:.......................................... 11 Here a simple way to populate the fields of the structure straight from the select:................ 11 And here a slight more complex example, using some functions inside the code:................ 11 Conclusion: .................................................................................................................................... 14 Related Content............................................................................................................................. 15 Disclaimer and Liability Notice....................................................................................................... 16
  • 3. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 3 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: • SAP_BASIS 6.20 and PI_BASIS 2004_1 must be installed on your system. • The BADI-definition RSU5_SAPI_BADI (SE18) must exists in your system. Once the pre conditions ware verified, it’s time to go. 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. Implementing the BADI. SAP make available the definition of the BADI, the implementation must be created for us, as follows: On transaction SE19 • Type • Click on
  • 4. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 4 Define a implementation name for your class. Click to confirm. Click on to activate de implementation. Result: You have created the implementation of the BADI, that will used to create the datasource enhancements.
  • 5. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 5 Click on the TAB Click on the link You go to the class builder
  • 6. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 6 On the class builder click on the method name: Then paste the following code: 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 ********************************************************* DATA: ls_oltpsource TYPE rsaot_s_osource, lv_data TYPE REF TO data, lv_method TYPE seocmpname. FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE. * 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.
  • 7. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 7 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>. * get method name for datasource lv_method = i_datasource. 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. * check method is implemented CHECK _check_method_exists( lv_method ) = 'X'. CALL METHOD (lv_method) EXPORTING i_updmode = i_updmode i_t_select = i_t_select i_t_fields = i_t_fields CHANGING c_t_data = <lt_data> c_t_messages = c_t_messages. endmethod.
  • 8. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 8 Create a new method and name it: _TEMPLATE_DATASOURCE. Then click over the name of the new method and paste the following code: method _TEMPLATE_DATASOURCE. * Data Definition * DATA: lth_vbak type hashed table of vbak * with unique key vbeln, * ls_vbak type vbak . * FIELD-SYMBOLS: <L_S_DATA> TYPE <Extract structure name>. * 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. * 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 eq 0. * <L_S_DATA>-VKORG = ls_vbak-vkorg. * !!! No MODIFY necessary as the field is changed immediatly in the * internal table by using Field Symbols * endif. * ENDLOOP. endmethod. Define the properties of this method as static and public
  • 9. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 9 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.
  • 10. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 10 Creating a enhancemente of a datasource. I will assume that you have enhanced the structure of the data source, and need to code to populate the enhanced fields of the structure. Copy the method _TEMPLATE_DATASOURCE and rename it, with the same name of the datasource you want to enhance. In case of standard datasource, omit the first character of the name (‘0’ or ‘2’). ie. DataSource 2LIS_18_IOTASK Method name: LIS_18_IOTASK ie. Declare on the code the structure to populate. On the code, you have to declare the structure <L_S_DATA> of the type of the enhancement sctructure of your data source, ie: Trans: RSA6 As you see in the picture, the Extract Structure of the data source 2LIS_18_I0TASK is MC18I00TSK.
  • 11. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 11 Declare: FIELD-SYMBOLS: <l_s_data> TYPE MC18I00TSK . 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. Bellow you have too examples of how to code your enhancement: Here a simple way to populate the fields of the structure straight from the select: method DS_FICA_VIEW_ZVDSFICACI. FIELD-SYMBOLS: <L_S_DATA> TYPE ZOXBND0152. * map the data LOOP AT C_T_DATA ASSIGNING <L_S_DATA>. SELECT SINGLE BETRH BETRW INTO (<L_S_DATA>-BETRH, <L_S_DATA>-BETRW) FROM DFKKOP WHERE OPBEL = <L_S_DATA>-OPBEL AND OPUPW = <L_S_DATA>-OPUPW AND OPUPK = <L_S_DATA>-OPUPK AND OPUPZ = <L_S_DATA>-OPUPZ. ENDLOOP. endmethod. And here a slight more complex example, using some functions inside the code: METHOD lis_18_i0task. DATA: l_anw_stat_existing TYPE xfeld, l_e_stsma TYPE jsto-stsma, l_line TYPE bsvx-sttxt, l_user_line TYPE bsvx-sttxt, l_stonr TYPE tj30-stonr. ************************************************************************* * FIELD-SYMBOLS * *************************************************************************
  • 12. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 12 FIELD-SYMBOLS: <l_s_data> TYPE MC18I00TSK . ************************************************************************* * CONSTANTS * ************************************************************************* CONSTANTS: C_SPRAS TYPE SY-LANGU VALUE 'PT'. *** Get the measures status, record by record *** The DataSource loads a package of 100 records each time, then *** we have to have a loop to process then. LOOP AT c_t_data ASSIGNING <l_s_data>. *** Function measure status CALL FUNCTION 'STATUS_TEXT_EDIT' EXPORTING client = sy-mandt flg_user_stat = 'X' objnr = <l_s_data>-objnr only_active = 'X' spras = c_spras bypass_buffer = ' ' IMPORTING anw_stat_existing = l_anw_stat_existing e_stsma = l_e_stsma line = l_line user_line = l_user_line stonr = l_stonr EXCEPTIONS object_not_found = 1 OTHERS = 2. IF sy-subrc = 0. <l_s_data>-zstssis = l_line. <l_s_data>-ZSTSUSU = L_USER_LINE(4). *** SEARCH THE STRING 'ANUL' search l_user_line for 'ANUL'. IF sy-subrc = 0. <l_s_data>-zflanu = 'ANUL'. ENDIF.
  • 13. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 13 ENDIF. ENDLOOP. ENDMETHOD. Go to the transaction RSA3 and test your data source.
  • 14. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 14 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. flavio.amoedo@gmail.com flavio_amoedo@yahoo.com.br
  • 15. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 15 Related Content • Note 691154 - SAPI with BADI: User exits in SAPI with BADI-interfaces • How to... Create a Generic Data Extractor
  • 16. Enhancing DataSources with BAdI RSU5_SAPI_BADI SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 16 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.