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
- Deactivate the datasource in LBWE & clear the delta queue (RSA7)
- Drag the fields from the pool.
- 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.
Steps..
Goto Tcode SE11
MCVBAK is communication structure of VBAK table
Save and Activate
The field is added to the structure...
Now if look at communication structure from LBWE maintenance...
Now we have to write a code to populate that
Goto Tcode SE37
Transaction data exit_saplrsap_001
Attributes, exit_saplrsap_002
Texts exit_saplrsap_003
Hierarchies exit_saplrsap_004
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
case i_datasource.
When '2LIS_11_VAITM'.
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.
Endif .
- Endloop.
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.