Wednesday, September 29, 2010

Generic Extraction with Function Module

Generic Datasource creation using function module
P Renjith Kumar SAP Employee Active Contributor Silver: 500-1,499 points
Business Card
Company: SAP Labs
Posted on Oct. 07, 2009 07:44 AM in ABAP, Business Intelligence (BI)

Print. Print
Permalink Permalink
If the business content datasource do not  address the customer's requirment, then
we need to go for the generic datasource creation. The complex requirment needs to
be implemented by ABAP code and we need to create the function module to i
mplement those logic. The creation of generic datasource is quite complex when
compared to the other 2 methods ( View, Infoset ) . So this blog tries to explain that

Follow the procedure given below to create a generic datasource based on function
module . 

Create a structure with the necessary filelds , The Currency and quantity fields must Have reference fields also . Structure fields are shown below.


NETWR is currency field so it must have reference field that is in base table  .
Click Currency / Quan and give that field name .


In our case we can copy the standard function module , information about them :

Pacakage name : RSAX  
Function module name : RSAX_BIW_GET_DATA_SAMPLE

Copy to your Z function module name and save .


Open your copied function module from SE37 . There is no change in IMPORT tab.But
give the parameter name with relevant assoicated type in TABLES tab.


In Exceptions No data . In Source code Tab . Write this ABAP Code to extract the data
into the generic data source.

To know more about the ABAP code , Just read this Wiki page, i have provided the
complete code of the function module there . Check for our generic fields and the
code logic implemented for our datasource.

 Save , Activate the function module .

Creating Generic Datasource

Using RS02 / SBIW transaction , create a generic datasource based on the
function module . It look like this .


Save the datasource , Give selection fields , Remove the check mark in hide
field in RSO2 .

Testing the extraction

In RSA3 give the datasource name you created , and test the extraction .


You can see that 16,102 records is selected .

Steps to be done on BI side

1.Create the infoobjects .
2.Create datasource
3.Create infoproviders .
4.Create transformation between the datasource and infoprovider.
5.Create an infopackage and load data till PSA .
6.Create DTP from datasoure to infoprovider and execute the DTP.

Now you can see the extracted data in the infoprovider.

If you want to implement the delta extarction functiionality , you need to right the
code for that seperately .

Hope this helps you to create a datasource based on function module .

1 comment:

  1. iam new for sap bw/bi plezzz explain for me
    explain the steps of fuction module extraction with screen shots
    plezzz send me as a document this is my mail id