In this Blog i am going to talk about the creation of Custom BI extarctors. But before that a question arises, What are Extractors or BI Extractors? Isn’t it??.
Extractors are used to extract data from a source system and to transfer the data to the other system. When the system to which data is transfered is BI system, then the Extractor is called BI extractor. Quite simple, right!!!. BI system can directly access the source data by calling this extractors.
SAP has provided standard Extractors for the extractions of data for general scenarios. But these standard extractor won’t suffice the requirement in some cases like custom tables or data from some standard tables based on specific joins or conditions etc. In such cases we need to create custom extractors.
Extractors make use of the datasources defined in SAP for the data extraction. So, for creating the custom extractor, first we need to create a datasource.Now Question arises, Whats this Datasource?
A DataSource is an object for retrieving data. It has
- an extract structure,
- an extraction type, and
- an extraction method.
The extract structure describes the fields of the internal table that contain the extracted data. The extraction type describes which type of extractor the DataSource uses. The extraction method extracts the data and transfers it into an internal table with the same type as the extract structure.
The DataSource also contains information on the type of data that it stages, for example, attributes, transactional data, hierachies, or texts. It can also support different types of data update.Four types of DataSources exist:
- DataSources for transaction data
- DataSource for master data
DataSource for attributes
DataSource for texts
DataSource for hierarchies
Steps for creating a custom datasource : Let’s begin with the process or Steps to create a custom datasource or Extractor.
- To create a custom datasource, we need to go to transaction RSO2. Select the type of datasource we want to create, For Transaction data or Master data or Texts…
- Specify the Datasource name and click on create button.
- Enter the Application Component ( PP,MM,PM,SD etc.) and the short, medium and long descriptions for the extractor.
- Now we have three ways to extract data into the datasource i.e.
- Extraction from DB View
- Extraction by Function modules
- Extraction from SAP Query
- Extraction from DB View:
Choose Extraction from DB View, if you want to extract data from a transparent table or a database view. Enter the name of the table or the database view.
In this, i have taken VBAK transparent table. In case you have custom table or database view, specify the name of that custom table or datbase view name here.
After generation i.e save , you get a DataSource whose extract structure is congruent with the database view or the transparent table view.
When we press ‘Save’ after entering the View or Table name, a screen appears in which we can edit the fields of extract structure. Here, we have the options like ‘Select’, ‘Hide’, ‘Inversion’ and ‘Field only’ each for a different use.
Each option has a specific purpose as mentioned below.
- Selection: If we want the filed to appear as a selection parameter, we need to check this checbox for that field. So, when this Extractor is called from the BW system, this selection field can be passed to fetech the data based on the input value. In this case, i have selected VBELN and ERDAT as the selection fields.
- Hide Field: If we want a field not to appear in the output, we need to check this checkbox for that field.
- Inversion: Set the Inversion indicator if you want to carry out a reverse posting for a customer-defined field (key figure). The value of the key figure is then transferred in inverted form (multiplied by –1) into BW.If the option Field Only Known in Customer Exit is selected for the field, this field is not inverted. If this option is selected, you cannot activate or deactivate inversion while postprocessing the DataSource.
- Field Only: Fields with the Field Only Known in Exit indicator are not passed to the extractor in the field list and the selection table.This setting is required to avoid runtime errors in the extractor since it is possible that the extractor is coded only to those fields that existed when the DataSource was defined.For fields of an append structure that were added to a customer scenario, the Field Only Known in Exit indicator should therefore be set.
- If a field (from an append structure, for example) is not to be passed to the extractor at runtime, select this indicator.
- If a field is to be passed to the extractor, deselect Field Known Only in Exit.
This is only effective if the extractor is coded generically and can react to the added fields.
After editing the structure, save the datasource. Now the datasource is ready for extraction.
Now we need to testi if the extractor we created is working fine or not.. To test the same follow the following steps:
- GoTo Transaction code RSA3.Enter the Datasource name and Execute.
- A information message pop up will that will give you the number of records fetched. Now, you will see the different options to display the fetched data and log at the bottom of the screen.
- You can display the data in ALV format or the LIST Format.
- As we executed the datsource without passing the Selection fileds, it extracted the entire data. Now, we can restrict the data by paasing the selection field values as shown below
- So, we can see that the extract fetches the data based on the range of sales doc. numbers we passed on the seletion screen.
With this we are done with the creation and testing of custom Datasouce Extractor using the Database view or Transparent table. Quite Simple, Isn’t it!!!