In this block I will discuss about the ECC out of box master data source enhancement to add an additional field .
In our business requirement we need field PLANT(WERKS) and field Cross plant material status (MTSTB) from T141T in SAP BW flow. We have Material number (0Material) in our BW transaction data flow. We found that we need of MATNR and WERKS to get MTSTB which is available in 0MAT_PLANT_ATTR datasource.
We decided to enhance 0MAT_PLANT_ATTR(0MAT_PLANT_ATTR) in ECC and extract it as a master data infoobject in BW and used it in our Transactional data flow by lookup with MATNR.
I will explain the steps in very easy and transparently so that new developers can easily enhance it .
A. Add field in the by append structure in an existing structure.
1.Go to RSA5 and activate 0MAT_PLANT_ATTR if is not activated already. If it is activated go to directly to RSA6 cockpit.
2. Go to RSA6 and check the Extract structure behind the datasource 0MAT_PLANT_ATTR which is .BIW_MARC_S.
Append the structure by creating a customized structure(ZMARC) .Double click on the extract structure of the data source and then click on the append structure.
Add the field MMSTB with the same datatype of field MMSTB T141T in the append structure ZMARC. Save the datasource.
B. Write code in SAPI enhancement with TCODE RSAP00001 inside EXIT_SAPLRSAP_002 .
1. Check If there is existing project is available for enhancement or not.
- Execute command SMOD and put the enhancement name. you can check if there is any existing enhancement.
2. As we enhancing Master data we will enhance inside EXIT_SAPLRSAP_002. If we enhance any Transaction data we will enhance inside EXIT_SAPLRSAP_001.
3. If you are no enhancement is there need to create a project using CMOD. Create an enhancement and assign it to the project.
4. Double click on EXIT_SAPLRSAP_002 as we are enhancing Master data.
5. Go inside ZXRSAU02 and start enhancement to fill the data inside the added field MTSTB.
Write the following code :
* 0MAT_PLANT_ATTR Enhancement for MTSTB -------------- WHEN '0MAT_PLANT_ATTR'. FIELD-SYMBOLS: <FS_BIW_MARC_S> TYPE BIW_MARC_S. DATA: LV_MTSTB TYPE T141T-MTSTB. LOOP AT C_T_DATA ASSIGNING <FS_BIW_MARC_S>. SELECT SINGLE MTSTB INTO LV_MTSTB FROM T141T WHERE MMSTA=<FS_BIW_MARC_S>-MMSTA IF SY-SUBRC = 0. <FS_BIW_MARC_S>-MMSTB=LV_MTSTB. ENDIF. ENDLOOP.
6. Activate the program. and make the field visible in DataSource by uncheck the check box “HIDE FIELDS” from RSA6. Activate the datasource then.
7. Go to RSA3 and check the data .
Hope this will help.