Adding new fields to the communication structure is called Datasource enhancement.
We have to append the standard business content data source 2LIS_11_VAITM with a field MTART (Material Type ) from MARA table .
First check if the field that you need to enhance is available in the communication structure. If it is there
1. Deactivate the datasource in LBWE & clear the delta queue (RSA7)
2. Drag the fields from the pool.
3. Activate the datasource..
This scenario requires no coding to populate the enhanced field.
But in our case the field MTART is not in MCVBAK and MCVBAP. So now the option is to append the extract structure and write a code to populate that.
Goto Tcode SE11
MCVBAK is communication structure of VBAK table
Save and Activate
Field is added to the structure...
Now if look in communication structure from LBWE maintainace...
Now we have to write a code to populate that
Goto Tcode SE37
Transaction data exit_saplrsap_001
In our case we are dealing with transaction data . so select exit_saplrsap_001
Click on display...
Double click on include
Insert the following code
Tables : MARA .
Data : L_S_VAITM LIKE MC11VA0ITM . *MC11VA0ITM - extract structure of DS
Loop at C_T_DATA Into L_S_VAITM .
L_TABIX = SY-TABIX .
Select Single * From MARA where MATNR = L_S_VAITM-MATNR.
If sy-subrc = 0.
L_S_VAITM-MTART = MARA-MTART.
Modify C_T_DATA FROM L_S_VAITM INDEX L_TABIX.
Save and Activate Code..
Go to T-code LBWE and add the new field to extract structure
Field Only should always be checked for enhanced fields...
Now do the Statistical setup run( filling of setup tables) from SBIW
and check in RSA3 for data...
Material type (MTART)... the Enhanced field is available.