Compiled Document of how to add custom field to standard UIBB (reuse method)
So, there are many documents and notes from SAP that highlight how to extend a standard UIBB with a custom field. So before you flag my content as duplicating previously covered material…hear me out.
Despite this abundance of information on how to do this, it still took us a good while to get the correct sequencing down for this to actually work on our recent MDG-M project, and a LOT of trial and error.
For this reason I put together a document, a step by step guide with screenshots, to easily and successfully do this seemingly simple task.
Hope you find it as useful as we did!
Extending SAP Standard Entity with Custom Fields
Table MARA should be extended with the customer specific fields ZZBASETYP, ZZBRAND and ZZPROAREA
The Data Model MM, Entity MARASALES should be extended with these attributes. The attributes should also display in the UI.
1. Append new fields to Standard Table (MARA)
You have to extend the table MARA with the new fields, include the new fields in the customizing table T130F and extend the backend structures.
1.1 Open Transaction SE11
1.2 Display the MARA table
1.3 Pick ‘Append Structure…’ and add your own or expand on an existing one
1.4 Add new fields to the append structure as required using namespace ZZ…
1.5 Activate the table (this will take some time…so remember – patience is a virtue!)
2. Include Z-field in Table T130F
You must include the Z-field into table T130F, see SAP Note 44410.
2.1 Open Transaction SE11
2.2 Display the table T130f
2.3 Using the menu got to: Utilities -> Table Contents -> Create Entries
2.4 Select V_130F
2.5 Add your field(s) with table name in front e.g. mara-zzbrand
2.6 Activate the table
3. Structure Extensions
The Service Mapping Tool (SMT) is a program used in ABAP to fill a target structure with a set of source structures. The relevant structures for the target structure of the primary persistence (MARA, MARM, MEAN, MARC…) are:
- MDG_BS_MAT_S_ Tablename>_UI
- MDG_BS_MAT_S_ Tablename>_X
The new fields are automatically included in structure MDG_BS_MAT_S_MARA, but the other 2 structures must be appended.
3.1 Open Transaction SE11
3.2 Display the table: MDG_BS_MAT_S_ MARA_UI
3.3 Pick ‘Append Structure…’ and add your own or expand on an existing one.
3.4 Add new fields to the append structure as in the MARA table
3.5 Activate the table
3.6 Repeat steps 3.1.2 to 3.1.5 for table: MDG_BS_MAT_S_ MARA_X
MDG_BS_MAT_S_MARA (Automatically populates)
The following information concerning the structure MDG_BS_MAT_S_MARA_X:
If the X-field-structure of the MDGM-API is extended after the creation of an SMT mapping, the SMT mapping needs to be regenerated. Therefore repeat this step.
4. Extending the Data Model
You now have to extend the data model MM with the new fields, extend the structures and maintain customer includes. The system uses the data model to generate database tables in which the master data can be stored.
4.1 Open Transaction MDGIMG
4.2 Follow the menu path General Settings -> Data Modeling -> Edit Data Model
4.3 Select the line for data model ‘MM’ and click the ‘Entity Types’ folder
4.4 Select the line for the entity you are working on (e.g. MATERIAL) and click the ‘Attributes’ folder.
4.5 Add the new fields to the list of attributes
4.6 Activate the Data Model
4.7 Open Transaction SE38 and execute the report: USMD_ADJUST_STAGING using data model ‘MM’
5. Generating Back End Structures
5.1 Open Transaction MDGIMG
5.2 Follow the menu path General Settings -> Data Modeling -> Generate Data Model Specific Structures
5.3 Select the line with the data model ‘MM’ and click on ‘Structures’
5.4 Select all 6 entries for the entity ‘Material’ and click ‘Generate Selected Structures’
6. SMT Mapping
You extend mappings by creating new transformations (complex transformations, field mappings) and field checks for them or by editing them. Here you work cross-client.
6.1 Open Transaction MDGIMG
6.2 Select General Settings -> Data Modeling -> Create and Edit Mappings -> Create and Edit Mappings
6.3 Follow the next steps twice, once for each mapping. Click on Mappings -> Open and select the Mapping:
6.4 Look for ‘MDG_BS_MAT_MATERIAL (for 2PP) or ‘MDG_BS_MAT_MARA’ (for 2STA) in the column ‘Mapping Step’ of the table and click ‘Details’
6.5 Select the ‘Transformation’ tab and click the ‘Edit’ Button
6.6 Click on the add button for the field mappings and add you custom field
6.7 After you have created the mapping in SMT you should return to the IMG and perform the IMG activity check customizing to ensure consistency of the changes.
7. UI Model
The new attributes should also be considered in the UI. UI configurations can be adapted using the FPM-enhancement option.
For details see other Extensibility Guides:
https://scn.sap.com/docs/DOC-29042 (Chapter User Interface Configuration and Extending the UI configuration)
https://scn.sap.com/docs/DOC-27859 (Chapter User Interface Configuration and Extending the UI configuration)
7.1 Open Transaction MDGIMG. Select General Settings -> UI Modeling -> Manage UI Configuration
7.2 Scroll down and select UI config you are using.
7.3 Select ‘Continue in Display Mode’ and click on the hyperlink for the configuration layout
7.4 Scroll down the page to the ‘Overview Page Schema’ and select the line for the relevant UIBB for the section of the UI you are adding your field to. Click the button ‘Configure UIBB’.
7.5 Click ‘Additional Functions’ -> ‘Enhance’. If using the ‘Basic Data’ UIBB there is already an enhancement created, if not you will need to create one. You will now be able to Hit the EDIT button
7.6 Scroll to where you want your new field in the UI and click on ‘Add element’ -> ‘New element’
7.7 A list of fields will come up and if you scroll to the bottom you will see your newly added fields.
7.8 Once fields are in the correct place SAVE and exit.
8. Reactivate Data Model
8.1 Reactivate the data model and run the adjust staging report again Now should all be good to go!