Generic Datasource creation using function module
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
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 .
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 .