With SAP ERP, the Media Product Master is an extension of the Material Master that is shipped as part of the media business function set (IS-Media). A set of media-specific fields are shipped as part of the Media Product Master. Adding new customer-specific fields is a time-consuming task that requires development skills.
In SAP S/4HANA, SAP provides a more flexible concept. Instead of shipping a fixed set of fields SAP provides an easy way of defining and adding new fields to the product master. In this blog post, you will learn how to define new fields for the product master and how to add them to the Fiori UI.
You have the following authorization roles assigned in the front-end system:
- The SAP_BR_PRODMASTER_SPECIALIST specialist role. This allows access to the Manage Product Master app.
- The SAP_NW_APS_EXT_CFL_APP role. This allows use of the Custom Fields and Logic app.
- The SAP_UI_FLEX_KEY_USER role. This allows you to adapt Fiori UI.
In addition, the business catalog SAP_CMD_BC_PR_MAINT_PC must be assigned to your user. This allows you to adapt the UI of the Product Master app.
There are 3 steps involved in extending the Product Master:
- Create a Custom Field
Generate the persistence for the new field in the backend
- Add New Field to the Fiori UI
Define where the new field is placed on the Fiori UI
- Extend CDS View
Define a CDS view extension for the CDS view C_MDProductHierarchyQuery
As an example, for a custom field we will use field Genre with a code list.
1: Create a Custom Field
- Open the Custom Fields and Logic application from the SAP Fiori launchpad and click Create.
- In the opening pop-up, choose Product Master General for Business Context and enter the Label Genre.
- Change the editable pre-filled Identifier and Tooltip if required.
- Choose Type Code List and enter the Length of the ID, for example 4.
- Now you can enter the code list. As an example, enter Code Value SCFI and Description Science Fiction.
- When you are finished entering the allowed values, click Create and Edit.
- Go to UIs and Reports.
- Click Enable Usage for Product Basic Data, Master Data Product Filter and Master Data Product Hierarchy Query.
- For Product Basic Data select the Search Relevance checkbox. Then you can enter values for genre in the basic search field when searching for your products.
- Save the data and then choose the Publish button.
This creates the persistence of the field and makes it available in adaptation mode of the chosen UI. Once the status for the new field changes from Publishing to Published you can continue with the next step.
Tip: you can define several custom fields and publish them all together.
Result: As part of the generation that happens during the publishing process, a domain ZZ1_GENRE and a data element ZZ1_GENRE are created. Using these DDIC objects a field ZZ1_GENRE_PRD was appended to the MARA table. Here we assume that in the Adaptation Transport Organizer (ATO, transaction S_ATO_SETUP) a prefix “ZZ1_” was defined.
2: Add New Field to the Fiori UI
In this step, you define where the new field is placed on the SAP Fiori UI.
- Open the Product Master application from the SAP Fiori launchpad. Search for an existing product and go to the object page of that product.
- Click on your image in the upper left corner to access the Me area.
- Click Adapt UI. The Product Master object page is displayed in UI adaptation mode.
Note: When you mouseover the UI, different areas are highlighted. With a right-click several options are displayed for the highlighted area of the screen.
- Select the area to the right of the Created By/On and Last Changed By/On fields.
- Right-click and choose Create Group from the menu and enter Title Data as a title for this new group.
- To place the new field Genre, select the new group, right-click and choose Add Field.
7. In the list of Available Fields search for Genre. The fields Genre and Genre (Desc.) are displayed. Select Genre and click OK.
8. Choose the Publish button to publish the UI changes. Choose Exit to close the UI adaptation mode.
3: Extend CDS View
Finally, you define a CDS view extension for the CDS view C_MDProductHierarchyQuery . This allows you to use the custom fields in tree table columns of the Product Master Hierarchy application. This is required, since in SAP S/4HANA 1709 the Custom Fields and Logic app generates the custom fields only into the CDS view C_MDProductHierarchyQuery for usage as filter attributes. If you would like to have the custom fields available for usage as columns in the tree table of the Product Master Hierarchy application, this must be added manually via the extension view.
- Open the SAP HANA Studio and connect to the SAP S/4HANA back-end system.
- Switch to the ABAP perspective. If your development system is not yet registered, create a new ABAP project for your development system.
- Right-click System Library and choose New → Other ABAP Repository Object.
- Open the Core Data Services folder, select Data Definition, and click on Next.
- Enter the Package, the Name (for example ZEXT_HPC_ProdHierarchyQ) and the Description (for example extension view for fields in tree table columns).
- Click Finish and copy the following text into the text editor:
@EndUserText.label: ‘Extension for C_MDProductHierarchyQuery’
extend view C_MDProductHierarchyQuery with ZEXT_HPC_ProdHierarchyQ
_Product.ZZ1_Genre_PRD as ZZ1_Tree_Genre,
_Product.ZZ1_ReleaseDate_PRD as ZZ1_Tree_ReleaseDate,
_Product.ZZ1_Title_PRD as ZZ1_Tree_Title
For each custom field that will appear in the product hierarchy tree table, you must add a line such as “_Product.ZZ1_<name>_PRD as ZZ1_<Alternative name>” .
7. Click on Activate button to activate the new extension view. It should now be considered as extension of the C_MDProductHierarchyQuery view.
In the Product Master Hierarchy App, you can add the field Genre to filter attributes by choosing Adapt Filters. To add the field to the columns, you need to click the Settings button.