Addition of attributes in MKALBASIC entity in MDG-M
This blog basically explains how to extend the MKALBASIC entity by adding new attributes . We are supposed to use this technique when SAP does not give us a straightforward way to perform the mappings via the Service Mapping Tool( SMT ). The MKALBASIC entity refers to Production Version section in MDG-M UI and is Plant specific. It corresponds to the MKAL table in database. The MDG-M version in this scenario is 8.0.
Below screenshots describe the MKALBASIC entity in data model and MDG-M UI screen. The highlighted columns in the MDG-M UI screenshot refer to the additional attributes of this entity.
The developer should be aware of the tcodes and steps which are generally followed when extending a standard entity. Broadly, these include :
-Addition of attributes inside the entity defined in data model and activating the data model
-Regenerating the data model specific structures
-Mappings via SMT
-Extending the UI configuration so as to add the new attributes on screen
Pls note in my case the name of attributes defined in data model and in MKAL table/structures were kept same to avoid complexity.
While following the steps given in the above section, we noticed that for MKALBASIC entity the mapping via SMT was not possible because the standard mapping step with the source and target structures for MKALBASIC were nowhere to be found. When we checked the MDG-M UI screen , we started getting the following error. Moreover, the data in the additional attributes/fields was also missing in the Production version section.
To overcome the above issues, we need to do the following.
Step1 – In method CLASS_CONSTRUCTOR of class CL_MDG_BS_MAT_SERVICES , the developer will see the class attribute STS_MKAL_MAP getting populated for MKALBASIC entity. The same needs to be done for the newly created attributes by the developer. To do so, create an enhancement implementation at the end of the method. So basically we need to link the staging area field name with active area field name. Like i mentioned above , these names are same in my case to avoid complexity.
Step2 – In method GET_MKAL_ATTR_FIELD of class CL_MDG_BS_MAT_ASSIST , the developer will see the following export attributes getting populated for MKALBASIC entity – ET_MKAL_ATTR_FIELD , ET_MKAL_ATTR , ET_MKAL_FIELD.
ET_MKAL_ATTR_FIELD( Links the attribute with corresponding MKAL field name)
ET_MKAL_ATTR( Populate the attribute names here )
ET_MKAL_FIELD( Populate the field names of MKAL table)
The same needs to be done by the developer for the newly added attributes in post-exit section of the above given method. Once done, assign these parameters to the corresponding static attributes of the same class – GT_MKAL_ATTR_FIELD , GT_MKAL_ATTR , GT_MKAL_FIELD.
One we perform the above steps we will get rid of the above error and see values coming in Production version section in display mode. In change mode, if we try to edit any of the values in the newly added attributes, we could save these as well in MKAL table.