Below is a sample scenario to enhance the extract structure of a standard Data source. The procedure is same for custom data source. However, the procedure is slightly different for enhancing the LO extractors.
Enhancing a data source structure signifies that you want to add an extra field to the data source which is not present in the extract structure. For this you need to add this field in the extract structure and then write a logic to populate this field in tcode CMOD. The extractor then can be checked in tcode RSA3.
If it is a non LO standard data source, you need to install and activate the business content data source in tcode RSA5 first and then change the data source in tcode RSA6. Below is the step by step process on how to do the same.
You can go through the details for data source enhancement in SAP in my ebook which has LO as well as Non LO data source enhancement procedure along with other SAP enhancement concepts-
Enhance a non LO standard business content data source with a field not present in the data source extract structure
Login to SAP ECC system. Go to RSA5 and activate the business content data source-
Now go to Tcode RSA6 and find your data source – 0PU_IS_PS_44. Double click on it and note the extract structure name. Observe the fields. Press F3.
In the tcode RSA6 itself, select your data source and click on ‘Enhance Extract Structure’.
System creates an append with name ZA<Extract Structure Name>
Give a description of the append structure, add the fields with which you want to enhance your data source. I have given name of the field starting with ‘ZZ..’ just to indicate that it is a user created appended field.
Give a component type and press enter. Here I am adding the field ‘SD Document Category’ to this data source. This is a standard field in SAP standard table VBAK (Sales Document Header table).
Save and activate your append structure, continue with the warnings. Press F3.
Now select your data source and click on the edit icon. Observe the newly added field.
Deselect the check boxes ‘Hide field’ and ‘Field only known in customer exit’. Save.
(Note: if you do not deselect these options here, the field will not come to BW)
Now you need to write the logic for populating this newly added field. If you check in RSA3 now, the data source will show this field as blank for all the records-
To write the logic for populating this field, go to transaction CMOD.
Select your project and make sure that it has the enhancement object ‘RSAP0001’.
Go to Components and double click on ‘EXIT_SAPLRSAP_001’ since it is a transaction data source.
Note: To view the type of the data source, go to tcode SE11 and type the table name as ‘ROOSOURCE’. Go to table contents and enter your data source name and check the entry.
We can see that the data source is of the type ‘TRAN’ which means transaction data.
Once you double click on ‘EXIT_SAPLRSAP_001’ in cmod transaction, you can see the below screen-
Double click on the include ‘ZXRSAU01’.
Go to change mode and insert few lines just before the ‘When others’ statement and after the ‘end loop’ statement.
Start writing your code. I will write a code to populate the new field as a constant just to demonstrate the process.
Declare a field symbol as type of the data source extract structure. Loop on the table C_T_DATA and assign your field ‘ZZIND’ values.
I have assigned a constant value ‘A’ to the field. Check and save your include. Then Activate it. Press F3. Activate your exit also and press F3.
Now go to tcode RSA3 to check the extractor. Observe that the new field is getting populated.
Login to BW system. Replicate your data source and activate it. Create info package to extract the data to the PSA. Create targets like Cube or DSOs to load this data.