Use Case: Extending standard transaction with screen fields in S4HANA
Specific Example: In this document, I would show the steps needed to enhance the data model to enable addition of custom fields in the standard MIGO transaction in S4 HANA.
Some background before jumping in the modelling.
With the advent of S4HANA, the data model has changed for many business objects. Same is the case with Material Documents (which is the case study for this blog). A new table ‘MATDOC’ has been introduced which stores the combined results of MKPF and MSEG tables. Any write operation persists the results in MATDOC table only. Also, these tables have been enhanced with proxy objects (aka CDS views) namely NSDM_E_MKPF and NSDM_E_MSEG. They are primarily used during data retrieval. Also, any enhancement in these tables needs to consider the proxy objects as well.
In traditional ECC (non S4HANA) days, we used only below options of enhancing any standard table(wherever allowed)
- Option 1 – Use the provided CI include and add custom fields
- Option 2 – Create a new append structure with custom fields
Same could be followed in S4HANA paradigm as well. Following Option 1 will lead to the addition of the custom fields in all the places where the CI include is used. This in turn forces us to enhance all the associated proxy objects or CDS views as well. This is good in case the custom fields are needed in all views and at all levels. But, if it’s a non-reusable then Option 2 is the quick and easy way to do it.
Here, I will demo option 2 where I will enhance the MSEG table with custom fields.
There are 3 steps in options 2.
a. Enhance MSEG table for BAPI or BADI processing.
b. Enhance the MATDOC table for persisting the data.
c. Enhance the associated CDS view on MSEG to be able to retrieve the stored data.
a. We can add an append structure in MSEG as below
b. We can locate the suitable place in MATDOC where custom field can be added. We need to read the description of all includes and see fields in them to identify the suitable place.
c. In this step, we need to identify the proxy object. After that we need to extend that proxy object with custom fields.
PS: This blog is on similar lines to Joachim’s blog @ https://blogs.sap.com/2016/07/11/appending-tables-in-s4hana-easy-mbew/
Feedback is much appreciated.