Enhancement of Generic datasource with new field(ZZ field) – Customer exit approach
This document explains about enhancing a datasource with new ZZ field and gets it populated from the underlying database table.
This document has been explained with an example. You can create new one based on this document.
Generic datasource : ZBI_EKKO_AK
Datasource built upon table : EKKO
Datasource type : Transaction datasource
New field name in datasource : ZZTAXJRDN
Source from which new field fetches data : EKPO-TXJCD.
Kindly follow the procedure as shown in the screenshots below to get it done which is self explanatory:
Got T-code: RSA6
Select the datasource for which we need to enhance a new field.
If the extract structure does not have append structure in it, then create new append structure.
Click on “Enhance extract structure”.
Give your own naming convention starts with Z.
Enter short description.
We need to include the below mentioned field in the datasource from the table EKPO.
Enter the unique component name starts with ZZ.
Component type is Field name (TXJCD) from EKPO.
Activate the append structure upon completion.
If append structure already exist in extract structure, then include new filed in that existing append structure.
Again got RSA6 and select your datasource and click on display.
It shows that newly created field is shown in the datasource.
But the hide field and Field only are marked. So, we need to uncheck both the fields. Or else those fields will not be replicated to BW side.
Uncheck those two fields.
Save the datasource.
You can confirm the same from the extract structure created for this datasource.
We have done with the creation of new filed in the datasource. Now we need to populate the field with the values from the table field EKPO- TXJCD which is from different table.
Goto t-code: CMOD.
Get the project in which the Enhancement RASP0001 is assigned. Click on display.
Note: Enhancement RASP0001 can be assigned to only one project. So, we need to search for that project.
Click on Components.
You can see four function calls. Each function call is intended for different datasource type.
EXIT_SAPLRSAP_001 – for Transaction datasource enhancement.
EXIT_SAPLRSAP_002 – for Attribute datasource enhancement.
EXIT_SAPLRSAP_003 – for Text datasource enhancement
EXIT_SAPLRSAP_004 – for Hierarchy datasource enhancement
Double click the first function since we are enhancing transactional datasource.
In the source code tab Double click on include program as shown below:
And create the code part as shown below.
DATA: l_s_icctrcst LIKE s001biws,
l_s_icctract LIKE icctract,
l_s_icctrsta LIKE icctrsta,
l_tabix LIKE sy-tabix.
DATA: l_s_zoxid30165 LIKE zoxid30165.
LOOP AT c_t_data INTO l_s_zoxid30165.
l_tabix = sy-tabix.
SELECT SINGLE * FROM ekpo
WHERE ebeln = l_s_zoxid30165-ebeln.
IF sy-subrc = 0.
l_s_zoxid30165-zztaxjrdn = ekpo-txjcd.
MODIFY c_t_data FROM l_s_zoxid30165 INDEX l_tabix.
*WE CAN INCLUDE MANY DATASOURCE LIKE THIS HERE
Activate the include program after completion of coding and come out of the screen.
Now its time for testing to check whether the field is getting populated with values.
Goto t-code RSA3.
Enter the datasource name and some entries for particular document number which contains value for newly added field. Click on execute.
It extracted one entry from the table EKKO.
Click on ALV grid to display the record.
The newly added field “Tax jurisdiction” got populated with value from the table EKPO.
We can confirm the entry from the table EKPO.
After completion of above steps, we can proceed with replicating the datasource from BW and assign new info-object for this newly added field.