Skip to Content
Author's profile photo Vijay Sharma

Extending Extractor DataSource to Include Custom Fields

In my last blog, Creation of Custom Extractors , I explained how to create a custom extractor using database table or view. But sometimes requirement are such that we need  some custom fields also along with the database fields.

In this blog, I will explain how we can extend the extractor DataSource to include custom fields and how to fill those custom fields. 

To explain this, I am taking the example of one of the datasource I extended to include some custom fields as per requirement.The Data Extractor “ZBW_PG_VENDOR_ATTR_LFA1_AUST” is created to fetch the data from a database view for table LFA1 as shown below.

(To check how to create one, click here).

/wp-content/uploads/2013/09/1_288556.png

 

ZPG_LFA1_AUST_V is the view created for LFA1 table.

/wp-content/uploads/2013/09/2_288605.png

Extract Structure ZOXDEV0190 is generated automatically when we selected the database view and saved the extracted while creating it.
Now, our requirement is to include some custom fields in the extractor along with the LFA1 fields. For this, we need not extend the LFA1 table …just to clarify if you are thinking in that direction.

The automatically generated structure ZOXDEV0190 is nothing but another database structure. So, to include our custom fields we can extend this structure in SE11.

Create a custom structure in SE11 to hold our custom fields as shown below. Here structure ZAZOXDEV0190 holds our custom fields, which we want to be a part of our extractor. Now, once we have created this structure, we need to append this structure to our Extract structure ZOXDEV0190 as shown below.
/wp-content/uploads/2013/09/3_288606.png

We have added the fields we want, to the extractor , but now the question is where the data will come from in these fields.

To fill the extended datsource fields, SAP has provided an EXIT “EXIT_SAPLRSAP_002”. We can write out logic inside this exist to fill the custom fields.

Import parameter “i_datasource” of this exit holds the datasource name and table “I_T_DATA” holds all the data fetched from the database view or table. At this point, the custom fields will be empty in this table.

We need to fill the custom fields inside this exit and modify the I_T_DATA table as shown below.

/wp-content/uploads/2013/09/4_288607.png

Just one thing to note here is that, this exit is called for all the DataSources. So, our logic to fill in the fields should be executed only on our DataSource call as shown below.

/wp-content/uploads/2013/09/5_288608.png

So, this is how we can extend the datasource structure to include the custom fields and fill them as per our need.

I hope you will like this blog.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.