SlideShare a Scribd company logo
1 of 17
Download to read offline
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 1
SAP BI Generic Extraction Using a Function Module
Applies to:
SAP BI
Summary
This article demonstrates a step-by-step process for doing generic extraction from R3 into BI using
a Function Module.
Author(s): P Renjith Kumar.
Company: Pricol Technologies
Created on: 14 February 2007
Author Bio
P. Renjith Kumar is SAP BI Consultant with PRICOL Technologies. He has extensive cross-
functional experience and has been with end-to-end SAP implementations as an ABAP Consultant.
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 2
Table of Contents
R3 Side...............................................................................................................................3
Code.............................................................................................................................8
Data Source Creation..............................................................................................10
Checking Extraction.................................................................................................11
BW Side.....................................................................................................................12
Disclaimer and Liability Notice......................................................................................17
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 3
R3 Side
1. Create a structure with the necessary fields. The Currency and quantity fields must
have reference fields also.
NETWR is a currency field so it must have reference field that is in the base table. Click Currency
/ Quan and give that field name.
2. In transaction SE80, Select Function group, name RSAX. Right click and Copy:
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 4
Select only the needed function module:
1
2
Give new
name of
function Group
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 5
The Function Module in SE37 will be like this, we have to do light modification
Give the new
function
module name
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 6
No change in Import Tab.
Export, Changing No values.
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 7
In TABLES tab, give the structure name.
In Exceptions No data. In Source code Tab. Write this Code
The Code that we need to write is Placed Inside
Give your structure name
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 8
Code
FUNCTION ZRSAX_BIW_GET_DATA_SIMPLE4_2.
*"----------------------------------------------------------------------
*"*"Local interface:
*” IMPORTING
*" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR
*" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
*" TABLES
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE ZNVBAK1 OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------
* Example: DataSource for table SFLIGHT
TABLES: ZNVBAK1.
* Auxiliary Selection criteria structure
DATA: L_S_SELECT TYPE SRSC_S_SELECT.
* Maximum number of lines for DB table
STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
* counter
S_COUNTER_DATAPAKID LIKE SY-TABIX,
* cursor
S_CURSOR TYPE CURSOR.
* Select ranges
* RANGES: L_R_CARRID FOR SFLIGHT-CARRID,
• L_R_CONNID FOR SFLIGHT-CONNID.
•
RANGES: SDNO FOR znvbak1-VBELN.
* Initialization mode (first call by SAPI) or data transfer mode
* (following calls) ?
IF I_INITFLAG = SBIWA_C_FLAG_ON.
************************************************************************
* Initialization: check input parameters
* buffer input parameters
* prepare data selection
************************************************************************
* Check DataSource validity
CASE I_DSOURCE.
WHEN 'ZFMEDS4'.
WHEN OTHERS.
IF 1 = 2. MESSAGE E009(R3). ENDIF.
* this is a typical log call. Please write every error message like this
LOG_WRITE 'E' "message type
'R3' "message class
'009' "message number
I_DSOURCE "message variable 1
' '. "message variable 2
Name of Data source
given in RS02
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 9
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDCASE.
APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT.
* Fill parameter buffer for data extraction calls
S_S_IF-REQUNR = I_REQUNR.
S_S_IF-DSOURCE = I_DSOURCE.
S_S_IF-MAXSIZE = I_MAXSIZE.
* Fill field list table for an optimized select statement
* (in case that there is no 1:1 relation between InfoSource fields
* and database table fields this may be far from beeing trivial)
APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
ELSE. "Initialization mode or data extraction ?
************************************************************************
* Data transfer: First Call OPEN CURSOR + FETCH
* Following Calls FETCH only
************************************************************************
* First data package -> OPEN CURSOR
IF S_COUNTER_DATAPAKID = 0.
* Fill range tables BW will only pass down simple selection criteria
* of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
* LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CARRID'.
* MOVE-CORRESPONDING L_S_SELECT TO L_R_CARRID.
* APPEND L_R_CARRID.
* ENDLOOP.
*
* LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CONNID'.
* MOVE-CORRESPONDING L_S_SELECT TO L_R_CONNID.
* APPEND L_R_CONNID.
* ENDLOOP.
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'VBELN'.
MOVE-CORRESPONDING L_S_SELECT TO SDNO.
APPEND SDNO.
ENDLOOP.
* Determine number of database records to be read per FETCH statement
* from input parameter I_MAXSIZE. If there is a one to one relation
* between DataSource table lines and database entries, this is trivial.
* In other cases, it may be impossible and some estimated value has to
* be determined.
OPEN CURSOR WITH HOLD S_CURSOR FOR
* SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
* WHERE CARRID IN L_R_CARRID AND
* CONNID IN L_R_CONNID.
SELECT VBAK~VBELN VBAK~ERDAT VBAK~NETWR VBAP~MATNR
VBAP~POSNR
FROM VBAK
INNER JOIN VBAP on VBAK~VBELN = VBAP~VBELN
WHERE VBAK~VBELN IN SDNO.
ENDIF. "First data package ?
* Fetch records into interface table.
* named E_T_'Name of extract structure'.
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 10
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE E_T_DATA
PACKAGE SIZE S_S_IF-MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR S_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF. "Initialization mode or data extraction ?
ENDFUNCTION.
Now Save, Activate the function module .
Goto SE80 -> Select Function Group, Activate the Function Group.
Note:
If you do not activate function Group, You will not be able to create data source in RS02
Data Source Creation
Then you have to create the data source, the data source name must be the name given in the source
code of the Function module.
RSO2 -> Create
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 11
Select Extr By Fun Module, Give name of Appl comp, Function Module, Extract Structure, save
Checking Extraction
Now give the selection Conditions and save.
RSA3 ->Give data source name and check extraction
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 12
BW Side.
1. RSA1 ->Source system , Src sys -> Rt Click, Data source Over view, Appl Comp, Rt click,
Replicate.
2. RSA1 - > Info source - > Create Appl comp -> Rt clk , Assign Data source - > Src Sys
Some Blank Value will come in Info object; just press F4 and select, same field option
Give max value to get
the correct value
extracted
2
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 13
Then Press <- and save, Activate Data source.
Then From Info area, Create Info cube , Assign the Info source name created to char and Key fig of
Cube
Cube will have no char in Char tab or on any other tab, Press Info source icon in Cube
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 14
If you double click that info source, every char. Key fig from that info source will come
automatically into cube, just assign Dimension to Cube and save and activate.
Create Update Rule for the Cube based on the info source
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 15
Now Schedule the Extraction
The final data will be like this in Monitor
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 16
SAP BI Generic Extraction Using a Function Module
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 17
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 4 update methods
Lo extraction   part 4 update methodsLo extraction   part 4 update methods
Lo extraction part 4 update methodsJNTU University
 
How to use abap cds for data provisioning in bw
How to use abap cds for data provisioning in bwHow to use abap cds for data provisioning in bw
How to use abap cds for data provisioning in bwLuc Vanrobays
 
Sap bw lo extraction
Sap bw lo extractionSap bw lo extraction
Sap bw lo extractionObaid shaikh
 
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 dimensionPraveen Kumar
 
Lo extraction part 7 enhancements
Lo extraction   part 7 enhancementsLo extraction   part 7 enhancements
Lo extraction part 7 enhancementsJNTU University
 
Lo extraction – part 5 sales and distribution (sd) datasource overview
Lo extraction – part 5  sales and distribution (sd) datasource overviewLo extraction – part 5  sales and distribution (sd) datasource overview
Lo extraction – part 5 sales and distribution (sd) datasource overviewJNTU University
 
Sap bw 4 hana vs sap bw on hana
Sap bw 4 hana vs sap bw on hanaSap bw 4 hana vs sap bw on hana
Sap bw 4 hana vs sap bw on hanaJasbir Khanuja
 
Lo extraction part 6 implementation methodology
Lo extraction   part 6 implementation methodologyLo extraction   part 6 implementation methodology
Lo extraction part 6 implementation methodologyJNTU University
 
Analysis process designer (apd) part 2
Analysis process designer (apd) part   2Analysis process designer (apd) part   2
Analysis process designer (apd) part 2dejavee
 
Sap sapscripts tips and tricks
Sap sapscripts tips and tricksSap sapscripts tips and tricks
Sap sapscripts tips and tricksKranthi Kumar
 
Step by step on changing ecc source systems without affecting data modeling o...
Step by step on changing ecc source systems without affecting data modeling o...Step by step on changing ecc source systems without affecting data modeling o...
Step by step on changing ecc source systems without affecting data modeling o...Andre Bothma
 
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 loadsLuc Vanrobays
 
Introducing enhancement framework.doc
Introducing enhancement framework.docIntroducing enhancement framework.doc
Introducing enhancement framework.docKranthi Kumar
 

What's hot (20)

Lo extraction part 4 update methods
Lo extraction   part 4 update methodsLo extraction   part 4 update methods
Lo extraction part 4 update methods
 
How to use abap cds for data provisioning in bw
How to use abap cds for data provisioning in bwHow to use abap cds for data provisioning in bw
How to use abap cds for data provisioning in bw
 
Sap bw lo extraction
Sap bw lo extractionSap bw lo extraction
Sap bw lo extraction
 
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
 
Lo extraction part 7 enhancements
Lo extraction   part 7 enhancementsLo extraction   part 7 enhancements
Lo extraction part 7 enhancements
 
Lo extraction – part 5 sales and distribution (sd) datasource overview
Lo extraction – part 5  sales and distribution (sd) datasource overviewLo extraction – part 5  sales and distribution (sd) datasource overview
Lo extraction – part 5 sales and distribution (sd) datasource overview
 
SAP BI/BW
SAP BI/BWSAP BI/BW
SAP BI/BW
 
Sap bw 4 hana vs sap bw on hana
Sap bw 4 hana vs sap bw on hanaSap bw 4 hana vs sap bw on hana
Sap bw 4 hana vs sap bw on hana
 
Usgage of ABAP in BI
Usgage of ABAP in BIUsgage of ABAP in BI
Usgage of ABAP in BI
 
Lo extraction part 6 implementation methodology
Lo extraction   part 6 implementation methodologyLo extraction   part 6 implementation methodology
Lo extraction part 6 implementation methodology
 
Abap hr programing
Abap hr programingAbap hr programing
Abap hr programing
 
Analysis process designer (apd) part 2
Analysis process designer (apd) part   2Analysis process designer (apd) part   2
Analysis process designer (apd) part 2
 
Sap abap tutorials
Sap abap tutorialsSap abap tutorials
Sap abap tutorials
 
Sap system copy procedure
Sap system copy procedureSap system copy procedure
Sap system copy procedure
 
Sap sapscripts tips and tricks
Sap sapscripts tips and tricksSap sapscripts tips and tricks
Sap sapscripts tips and tricks
 
Step by step on changing ecc source systems without affecting data modeling o...
Step by step on changing ecc source systems without affecting data modeling o...Step by step on changing ecc source systems without affecting data modeling o...
Step by step on changing ecc source systems without affecting data modeling o...
 
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
 
Introducing enhancement framework.doc
Introducing enhancement framework.docIntroducing enhancement framework.doc
Introducing enhancement framework.doc
 
Sap bw4 hana
Sap bw4 hanaSap bw4 hana
Sap bw4 hana
 
Bapi step-by-step
Bapi step-by-stepBapi step-by-step
Bapi step-by-step
 

Similar to SAP BI Generic Extraction Using a Function Module.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)Srinivas Dukka
 
Variables in sap bi
Variables in sap biVariables in sap bi
Variables in sap bishabari76
 
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 workflowsHicham Khallouki
 
SAP Quickviewer
SAP QuickviewerSAP Quickviewer
SAP Quickviewerotchmarz
 
ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1 ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1 Rehan Zaidi
 
ERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP ProfessionalsERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP ProfessionalsRehan Zaidi
 
Trigger bi process chain from ecc
Trigger bi process chain from eccTrigger bi process chain from ecc
Trigger bi process chain from eccObaid shaikh
 
MS_SAP_ABAP_WDA_2016_Pict
MS_SAP_ABAP_WDA_2016_PictMS_SAP_ABAP_WDA_2016_Pict
MS_SAP_ABAP_WDA_2016_PictMunir Solkar
 
CO_TM_Controlling_co-om Master Data .pdf
CO_TM_Controlling_co-om Master Data .pdfCO_TM_Controlling_co-om Master Data .pdf
CO_TM_Controlling_co-om Master Data .pdfssuser878ec2
 
User exits
User exitsUser exits
User exitsanilkv29
 
How to create_an_ecatt
How to create_an_ecattHow to create_an_ecatt
How to create_an_ecattMohammed Azhad
 
PS ehp6 enhancements
PS ehp6 enhancementsPS ehp6 enhancements
PS ehp6 enhancementsSapPSGuy
 
Dynamic variant creation
Dynamic variant creationDynamic variant creation
Dynamic variant creationyoung moon woo
 
_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.pdfssuserfe1f82
 
News in abap concepts to further increase the power of abap development 2
News in abap   concepts to further increase the power of abap development  2News in abap   concepts to further increase the power of abap development  2
News in abap concepts to further increase the power of abap development 2Alexander Talac
 
News in abap concepts to further increase the power of abap development
News in abap  concepts to further increase the power of abap developmentNews in abap  concepts to further increase the power of abap development
News in abap concepts to further increase the power of abap developmentAlexander Talac
 
How to find user exits
How to find user exitsHow to find user exits
How to find user exitsMohammed Shoeb
 

Similar to SAP BI Generic Extraction Using a Function Module.pdf (20)

Fm extraction
Fm extractionFm extraction
Fm extraction
 
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)
 
Variables in sap bi
Variables in sap biVariables in sap bi
Variables in sap bi
 
sap
sap sap
sap
 
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
 
SAP Quickviewer
SAP QuickviewerSAP Quickviewer
SAP Quickviewer
 
ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1 ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1
 
ERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP ProfessionalsERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP Professionals
 
Trigger bi process chain from ecc
Trigger bi process chain from eccTrigger bi process chain from ecc
Trigger bi process chain from ecc
 
MS_SAP_ABAP_WDA_2016_Pict
MS_SAP_ABAP_WDA_2016_PictMS_SAP_ABAP_WDA_2016_Pict
MS_SAP_ABAP_WDA_2016_Pict
 
CO_TM_Controlling_co-om Master Data .pdf
CO_TM_Controlling_co-om Master Data .pdfCO_TM_Controlling_co-om Master Data .pdf
CO_TM_Controlling_co-om Master Data .pdf
 
User exits
User exitsUser exits
User exits
 
How to create_an_ecatt
How to create_an_ecattHow to create_an_ecatt
How to create_an_ecatt
 
PS ehp6 enhancements
PS ehp6 enhancementsPS ehp6 enhancements
PS ehp6 enhancements
 
SAP Integration with Excel - Basic Guide
SAP Integration with Excel - Basic GuideSAP Integration with Excel - Basic Guide
SAP Integration with Excel - Basic Guide
 
Dynamic variant creation
Dynamic variant creationDynamic variant creation
Dynamic variant creation
 
_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
 
News in abap concepts to further increase the power of abap development 2
News in abap   concepts to further increase the power of abap development  2News in abap   concepts to further increase the power of abap development  2
News in abap concepts to further increase the power of abap development 2
 
News in abap concepts to further increase the power of abap development
News in abap  concepts to further increase the power of abap developmentNews in abap  concepts to further increase the power of abap development
News in abap concepts to further increase the power of abap development
 
How to find user exits
How to find user exitsHow to find user exits
How to find user exits
 

Recently uploaded

fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptAfnanAhmad53
 
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...manju garg
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdfKamal Acharya
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...ssuserdfc773
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxNANDHAKUMARA10
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessorAshwiniTodkar4
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementDr. Deepak Mudgal
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...ppkakm
 
Introduction to Geographic Information Systems
Introduction to Geographic Information SystemsIntroduction to Geographic Information Systems
Introduction to Geographic Information SystemsAnge Felix NSANZIYERA
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)ChandrakantDivate1
 

Recently uploaded (20)

fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
👉 Yavatmal Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Girl S...
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor8086 Microprocessor Architecture: 16-bit microprocessor
8086 Microprocessor Architecture: 16-bit microprocessor
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...Basic Electronics for diploma students as per technical education Kerala Syll...
Basic Electronics for diploma students as per technical education Kerala Syll...
 
Introduction to Geographic Information Systems
Introduction to Geographic Information SystemsIntroduction to Geographic Information Systems
Introduction to Geographic Information Systems
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 

SAP BI Generic Extraction Using a Function Module.pdf

  • 1. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 1 SAP BI Generic Extraction Using a Function Module Applies to: SAP BI Summary This article demonstrates a step-by-step process for doing generic extraction from R3 into BI using a Function Module. Author(s): P Renjith Kumar. Company: Pricol Technologies Created on: 14 February 2007 Author Bio P. Renjith Kumar is SAP BI Consultant with PRICOL Technologies. He has extensive cross- functional experience and has been with end-to-end SAP implementations as an ABAP Consultant.
  • 2. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 2 Table of Contents R3 Side...............................................................................................................................3 Code.............................................................................................................................8 Data Source Creation..............................................................................................10 Checking Extraction.................................................................................................11 BW Side.....................................................................................................................12 Disclaimer and Liability Notice......................................................................................17
  • 3. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 3 R3 Side 1. Create a structure with the necessary fields. The Currency and quantity fields must have reference fields also. NETWR is a currency field so it must have reference field that is in the base table. Click Currency / Quan and give that field name. 2. In transaction SE80, Select Function group, name RSAX. Right click and Copy:
  • 4. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 4 Select only the needed function module: 1 2 Give new name of function Group
  • 5. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 5 The Function Module in SE37 will be like this, we have to do light modification Give the new function module name
  • 6. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 6 No change in Import Tab. Export, Changing No values.
  • 7. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 7 In TABLES tab, give the structure name. In Exceptions No data. In Source code Tab. Write this Code The Code that we need to write is Placed Inside Give your structure name
  • 8. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 8 Code FUNCTION ZRSAX_BIW_GET_DATA_SIMPLE4_2. *"---------------------------------------------------------------------- *"*"Local interface: *” IMPORTING *" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR *" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL *" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL *" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL *" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL *" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF *" TABLES *" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL *" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL *" E_T_DATA STRUCTURE ZNVBAK1 OPTIONAL *" EXCEPTIONS *" NO_MORE_DATA *" ERROR_PASSED_TO_MESS_HANDLER *"---------------------------------------------------------------------- * Example: DataSource for table SFLIGHT TABLES: ZNVBAK1. * Auxiliary Selection criteria structure DATA: L_S_SELECT TYPE SRSC_S_SELECT. * Maximum number of lines for DB table STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE, * counter S_COUNTER_DATAPAKID LIKE SY-TABIX, * cursor S_CURSOR TYPE CURSOR. * Select ranges * RANGES: L_R_CARRID FOR SFLIGHT-CARRID, • L_R_CONNID FOR SFLIGHT-CONNID. • RANGES: SDNO FOR znvbak1-VBELN. * Initialization mode (first call by SAPI) or data transfer mode * (following calls) ? IF I_INITFLAG = SBIWA_C_FLAG_ON. ************************************************************************ * Initialization: check input parameters * buffer input parameters * prepare data selection ************************************************************************ * Check DataSource validity CASE I_DSOURCE. WHEN 'ZFMEDS4'. WHEN OTHERS. IF 1 = 2. MESSAGE E009(R3). ENDIF. * this is a typical log call. Please write every error message like this LOG_WRITE 'E' "message type 'R3' "message class '009' "message number I_DSOURCE "message variable 1 ' '. "message variable 2 Name of Data source given in RS02
  • 9. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 9 RAISE ERROR_PASSED_TO_MESS_HANDLER. ENDCASE. APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT. * Fill parameter buffer for data extraction calls S_S_IF-REQUNR = I_REQUNR. S_S_IF-DSOURCE = I_DSOURCE. S_S_IF-MAXSIZE = I_MAXSIZE. * Fill field list table for an optimized select statement * (in case that there is no 1:1 relation between InfoSource fields * and database table fields this may be far from beeing trivial) APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS. ELSE. "Initialization mode or data extraction ? ************************************************************************ * Data transfer: First Call OPEN CURSOR + FETCH * Following Calls FETCH only ************************************************************************ * First data package -> OPEN CURSOR IF S_COUNTER_DATAPAKID = 0. * Fill range tables BW will only pass down simple selection criteria * of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'. * LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CARRID'. * MOVE-CORRESPONDING L_S_SELECT TO L_R_CARRID. * APPEND L_R_CARRID. * ENDLOOP. * * LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CONNID'. * MOVE-CORRESPONDING L_S_SELECT TO L_R_CONNID. * APPEND L_R_CONNID. * ENDLOOP. LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'VBELN'. MOVE-CORRESPONDING L_S_SELECT TO SDNO. APPEND SDNO. ENDLOOP. * Determine number of database records to be read per FETCH statement * from input parameter I_MAXSIZE. If there is a one to one relation * between DataSource table lines and database entries, this is trivial. * In other cases, it may be impossible and some estimated value has to * be determined. OPEN CURSOR WITH HOLD S_CURSOR FOR * SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT * WHERE CARRID IN L_R_CARRID AND * CONNID IN L_R_CONNID. SELECT VBAK~VBELN VBAK~ERDAT VBAK~NETWR VBAP~MATNR VBAP~POSNR FROM VBAK INNER JOIN VBAP on VBAK~VBELN = VBAP~VBELN WHERE VBAK~VBELN IN SDNO. ENDIF. "First data package ? * Fetch records into interface table. * named E_T_'Name of extract structure'.
  • 10. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 10 FETCH NEXT CURSOR S_CURSOR APPENDING CORRESPONDING FIELDS OF TABLE E_T_DATA PACKAGE SIZE S_S_IF-MAXSIZE. IF SY-SUBRC <> 0. CLOSE CURSOR S_CURSOR. RAISE NO_MORE_DATA. ENDIF. S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1. ENDIF. "Initialization mode or data extraction ? ENDFUNCTION. Now Save, Activate the function module . Goto SE80 -> Select Function Group, Activate the Function Group. Note: If you do not activate function Group, You will not be able to create data source in RS02 Data Source Creation Then you have to create the data source, the data source name must be the name given in the source code of the Function module. RSO2 -> Create
  • 11. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 11 Select Extr By Fun Module, Give name of Appl comp, Function Module, Extract Structure, save Checking Extraction Now give the selection Conditions and save. RSA3 ->Give data source name and check extraction
  • 12. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 12 BW Side. 1. RSA1 ->Source system , Src sys -> Rt Click, Data source Over view, Appl Comp, Rt click, Replicate. 2. RSA1 - > Info source - > Create Appl comp -> Rt clk , Assign Data source - > Src Sys Some Blank Value will come in Info object; just press F4 and select, same field option Give max value to get the correct value extracted 2
  • 13. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 13 Then Press <- and save, Activate Data source. Then From Info area, Create Info cube , Assign the Info source name created to char and Key fig of Cube Cube will have no char in Char tab or on any other tab, Press Info source icon in Cube
  • 14. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 14 If you double click that info source, every char. Key fig from that info source will come automatically into cube, just assign Dimension to Cube and save and activate. Create Update Rule for the Cube based on the info source
  • 15. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 15 Now Schedule the Extraction The final data will be like this in Monitor
  • 16. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 16
  • 17. SAP BI Generic Extraction Using a Function Module SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2007 SAP AG 17 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.