In-App extensibility in S/4 HANA Cloud | Part 1 – Adding a custom field on the UI
This blog intends to demonstrate in-app extensibility in S/4 HANA cloud, with focus on how a custom field can be added on a Fiori application. Extensibility in S/4 HANA cloud spans across multiple options and possibilities and this is just one of the scenarios. This is the first blog in the In-App extensibility series and more scenarios will be covered in subsequent blogs in this series.
The customer needs to add a custom field on the “Purchase Order” screen, as they need to see some specific information (in this field) and the available standard fields don’t suffice this requirement.
A custom field needs to be created in the system and subsequently added to the purchase order screen. Data entered in this field will be saved in the database and subsequently retrieved later when the purchase order is viewed/edited.
To be able to carry out in-app extensions, you must have one of the following roles assigned to your user in the S/4 HANA Cloud system:
The following steps are to be followed for adding the custom field.
1) Access the “Custom fields and Logic” app
This app is meant to create custom fields in the system. It can be located by either searching directly in the search box or in the “Extensibility” catalog.
2) Once in the App, make sure you are in the “Custom fields” tab. Click on the “+” icon to start creating a new custom field
3) On the subsequent popup, you will need to enter the details for creating the new custom field. One of the most important aspect of these details is to select the correct business context under which the field needs to be created. Upon choosing the business context, the field can be added to the relevant apps/screens/forms etc which fall under this context. Since for this demo, we want to add a custom field to the Purchase order screen, we will choose the business context as “Procurement: Purchasing Document”
Enter the rest of the details as appropriate for the field – the label, tooltip and data type of the custom field.
In our case, we are adding a field “Special request to supplier”. This will be a text field having a maximum length of 20 characters.
Click on “Create and Edit” to move into further processing of this new field.
4) Depending on the business context chosen on the previous screen, the system presents different options where this new field can be used in the system. This includes UIs and Reports, Email templates, form templates and so on.
For our demo, we want to add the field on a UI so navigate to the “UIs and Reports” tab.
5) Since we want to add the new field on the Purchase order screen, scroll down within the “UIs and Reports” tab to locate the “Manage purchase order”. Click on the “Enable Usage” button against this option. This will mean that the new field is now enabled to be used on this UI.
Note that once “Enable usage” is clicked, the field usage column should have changed to “Enabled”.
6) Click on “Save” to save the changes
7) The field is now saved but for changes to take effect and the field to be available for addition in the UI, it needs to be published. Click on the “Publish” button to publish the field.
It may take a few minutes for the field to be published. The status will display as “Published” once this is complete.
8) Now that the newly added custom field is published, it needs to be added on the relevant UI application screen. Navigate to the “Manage Purchase orders” app to add the custom field on that screen.
9) You may choose to create a new purchase order or open an existing one. In this case, we search for an existing purchase order and open it on the screen.
10) To add the new field, click on the User icon on the top-right corner of the screen and choose “Adapt UI”
11) You will now be in the Edit mode on the UI screen. Choose an appropriate area to add the custom field, right-click on the area and select “+ Add: Field”. In our case, we will add the new field in the “Further information” section.
12) Clicking on “Add field” will bring up a popup which shows a list of fields that are available to be added on this screen. Search for the field “Special request to supplier” that was created earlier. Choose the field once available and click “OK”
13) The field will now be added on the screen.
14) Click on “Save and Exit” to save the changes and exit the UI adaptation mode.
15) The new field is now available in the screen. You can enter data into this field as you would normally do on a purchase order create/edit screen and the relevant changes will be saved in the backend along with the other purchase order information. The same data will be retrieved once you open the relevant purchase order for viewing/editing.
It is possible to add a custom field to a Fiori UI screen as demonstrated above.
It should be noted that while any Fiori screen will allow addition of such custom fields, there may still be some transactions/screens in the system which may not allow such addition. While it can be expected that with subsequent releases, all relevant transactions will allow this type of extensibility, you are advised to ensure that the concerned application supports extensibility before attempting to add a field as advised above.
Very well explained, thanks for sharing.
Is there a possibility to make the custom field mandatory in PO?
I don't think there is a direct option to make this custom field mandatory on the screen, at least I could not find one in the extensibility options. We may have to explore this by checking the possibility to write this check in a custom logic, given the availability of a suitable Business Add-in.
We can use another BAdI Change of Field Control for Purchase Order Items (MM_PUR_S4_PO_FLD_CNTRL_SIMPLE) to make this field mandatory.
Thanks for sharing!
Thanks for putting this together.
Very detailed and helpful - thank you for sharing!
Thanks for this detailed one!!! waiting for other parts 🙂
I like this example. It could be reference for other Apps. Thanks!
Thank you for sharing it. Agreed with Owen that I think it's a general help document which also works for other Apps / function areas.
Priyank, Thank you to the post. It is nice presented and very useful one to add custom fields to the Fiori UI in S/4HANA Cloud. I have a need to add the Customer field (say Shipper_Truck_Route details) to Delivery Header details and then update the field contents through API API_OUTBOUND_DELIVERY_SRV entity A_OutbDeliveryHeader from CPI middleware which is coming in EDI 945 data. Can you shed some light on how to do this. I can add the custom field using Extensibility cockpit into API field list. But not sure how to make this new custom field available in CPI layer.
Thank you for sharing this information
Thanks for the blog. Very useful content for the S/4 HANA Cloud community.
But how to update this same field through BAPI? or any other way to update if we wants to modify these fields in PR/PO though program?
In S/4HANA Cloud, you can use whitelisted APIs to create / update POs. Now if you want this custom field to be available for use in the API, you need to enable it accordingly in the "Custom fields" app (just like it was enabled in the "UIs and Reports" tab). If the API is extensible, you will be able to enable this field for the API. Once this is done, you can then use the relevant API to update the field.
Hope this helps.
Could u help for any such API which we can use to update custom fields added in EBAN/EKKO through Extensibility Registry.