Skip to Content
Technical Articles
Author's profile photo Ajay Rawat

Extend SAP S/4HANA Manage Purchase Orders SAP Fiori App with Custom Fields Part-1

In  part-1 of this blog series we will add a custom field Smart Number to SAP S/4HANA Manage Purchase Order SAP Fiori app and also make it editable so that data will persist in Database.

Manage Purchase Order is Created using below principles:


  • Backend SAP Fiori Elements on CDS for UI annotations
  • Reference Data Source to enable OData query options using SADL Framework
  • BOPF to handle Transactional Behavior including Draft handling

In theory any app which is created using above principles can be extended in similar way including those created using auto generated OData services (@ OData publish true).

Please note that SAP also provides key user extensibility  which enables customers to enhance standard apps without any technical knowhow.

However, if key user extensibility is not supported for the app you want to enhance, then the method mentioned in this blog can be used which is more generic in nature.

On High level below steps are required to extend the SAP Fiori App.

  • Add custom fields to the extension include (DDIC Structure) so that custom fields appear in DB Table, Draft Table and BO Persistent Structure
  • Extend the Transactional and Consumption CDS views with custom fields. The fields are automatically available in OData service metadata and no regeneration is required.
  • In some cases UI Adoption in WebIDE may be required if backend SAP Fiori Elements are missing in the Standard consumptions CDS view. For our use case we will  extend the Delivery and Invoice node at PO header and we would not require any UI adoption .

Step1: Add custom fields to structure EKKO_INCL_EEW_PS 

We will use append structure to add custom field ZSMART_NUMBER.

Enhancing structure EKKO_INCL_EEW_PS automatically enhances the PO header table EKKO and Draft Table PURORDTP_D with custom fields as this structure is used as include in both tables as well as Business Object Persistent Structure.



Another advantage is that EKKO_INCL_EEW_PS  is an extension include provided by SAP standard and no additional code is required to transfer the data from business layer to database layer.

Note that you can also use CI Include CI_EKKODB to add your custom fields.

Step2: Enhance the Consumption and Transactional CDS View 

C_PurchaseOrderTP is the consumption view which is used as reference data source in SEGW OData project and will be enhanced so that custom fields appear on SAP Fiori application.

I_PurchaseOrderTP is the transactional view with associated BOPF node, and is responsible for transactional behavior. This view also needs to be enhanced so that we can save data for custom field

R_PurchasingDocument is the basic view which gets data from EKKO.

We will extend all four view highlighted below so that custom fields are available in Consumption and Transactional CDS View



Extend R_PurchasingDocument


@AbapCatalog.sqlViewAppendName: 'ZRPURCHDOCEXT'
@EndUserText.label: 'Extend R_PurchasingDocument'
extend view  R_PurchasingDocument with ZR_PurchasingDocument_Ext {


    Extend R_PurchaseOrder

@AbapCatalog.sqlViewAppendName: 'ZRPOEXT'
@EndUserText.label: 'Extend R_PurchaseOrder'
extend view R_PurchaseOrder with ZR_PurchaseOrder_Ext {

Extend I_PurchaseOrderTP

@AbapCatalog.sqlViewAppendName: 'ZIPOTPEXT'
@EndUserText.label: 'Extend I_PurchaseOrderTP'
extend view I_PurchaseOrderTP with ZI_PurchaseOrderTP_EXT {

Extend C_PurchaseOrderTP

Annotation @UI lineItem is used to place the fields in list page so that it appears at third position

Annotation @UI.fieldGroup is used to place the field in object page under Delivery and Invoice Tab

@AbapCatalog.sqlViewAppendName: 'ZCPOTPEXT'
@EndUserText.label: 'Extend C_PurchaseOrderTP'
extend view C_PurchaseOrderTP with ZC_PurchaseOrderTP_EXT {
  @UI: {lineItem: [ {position: 25, importance: #HIGH} ] }
  @UI.fieldGroup: [ { position: 45, qualifier: 'DeliveryInvoiceGroup2'} ]       


Note that since @UI.fieldGroup annotation exist in consumption view C_PurchaseOrderTP we were able to use the same in extended view.

For General Information Tab no such annotation exists, UI adoption on WebIDE may be needed if you want add custom field on Generation Information Tab where you can add frontend annotations.

Step3: Test the CDS view and ODATA Service

Using se16n insert some  test values for our custom fields in EKKO Table.


Test Consumption View C_PurchaseOrderTP


Check SEGW project MM_PUR_PO_MAINTAIN_V2 for custom field

Since Consumption View C_PurchaseOrderTP is used as Reference Data Source, any extension to this view should automatically appear without need for Regeneration


Test OData Service MM_PUR_PO_MAINT_V2_SRV

Using below URL we can fetch the data for PO header and can see fields zsmart_number is returning correct value



Step4: Test SAP Fiori UI

We can see that field Smart Number appear as filter option as well as in list page.  We can search for PO documents which have smart number as non empty.



The smart number also appears on Delivery and Invoice Node of Object Page . We can edit and update the value in database. The draft functionality also works for our field.


We were able to achieve all of this without any ABAP code changes and UI adoption so far as CDS Extension, SADL and BOPF Framework, together with SAP Fiori Elements  automatically takes  cares of this.

In  part-2 of this series I will attempt to incorporate below functionality for custom fields.

  1. Adding a Value Help
  2. Adding Validation and Determinations

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Syambabu Allu
      Syambabu Allu

      Hi Ajay,

      Good explanation. Thanks for sharing!!

      Thank you,


      Author's profile photo Ajay Rawat
      Ajay Rawat
      Blog Post Author

      Thanks Syam

      Author's profile photo Pavan Golesar
      Pavan Golesar

      Hi Ajay,

      Nice blog, thank you good detailing.

      Best Regards,

      Pavan Golesar

      Author's profile photo Ajay Rawat
      Ajay Rawat
      Blog Post Author

      Thanks Pavan

      Author's profile photo Kanwardeep Singh Gill
      Kanwardeep Singh Gill

      HI Ajay,

      Nice Blog!


      Do the extended consumption views have MDEs for annotations and there is no local binding for the annotations in the UI project?


      If no, then, it will not be possible to add value helps to the fields without performing modification of the gateway project.


      We faced this scenario in our project and to enable the value helps and new entities (nodes-read-only), we had to add annotations manually in the DEFINE method and handle the get entity sets manually in the DPC EXT.


      Also, with the RDS and BOPF there is no capability to add new nodes for transactional behavior.



      Author's profile photo Ajay Rawat
      Ajay Rawat
      Blog Post Author

      Thanks Kanwar

      On Value Help part I am not sure, as this is something I need to explore as part of next blog.   You may be right as valuehelp CDS needs to be exposed to gateway project.

      On node extension part we are working closely with standard procurement team where they will provide some dummy/generic nodes in S4 Core which will directly attach to standard CDS/BOPF.

      We can then enhance those nodes using the similar principle mentioned in this blog.  I am currently working on this POC in a sandbox system and will also share more details if it works out fine.

      Author's profile photo Gerardo Moreno
      Gerardo Moreno

      Hi Ajay,

      Were you able to figure out the value help for the extended fields? We are facing this situation in a PoC we are doing and haven't found the way forward yet. This in the context of BOPF.



      Author's profile photo Ajay Rawat
      Ajay Rawat
      Blog Post Author

      Hi Gerardo

      I was not able to explore more on this

      You can contact Kanwardeep Singh Gill from SAP, I think his team  have implemented the custom  value help  for Fiori Apps for Procurements Apps based on BOPF and RDS

      Author's profile photo Jun Wu
      Jun Wu

      what version of s4 you are using?

      mine is s4 2020. I don't see that R*** view

      usually you will enhance the E_*** cds view to include additional fields.

      Author's profile photo Ajay Rawat
      Ajay Rawat
      Blog Post Author

      I am on latest version of S4 Hana which will be released in 2022 sometime this year.

      E_PurchasingDocument can be extended as well as you correctly mentioned. It is an extension View association provided by SAP to get custom fields from EKKO table.

      However not every Fiori App will have this kind of view extension association provided.  For example if you want to extend Line Item View for PO,  you can't do it using extension view. But you can do it with approach I have discussed.


      I wanted to present a more generic approach to extend the FIori APP.

      Author's profile photo Jun Wu
      Jun Wu


      item also has the extension view.

      Author's profile photo Ajay Rawat
      Ajay Rawat
      Blog Post Author

      Yes You are right.

      The same is not available on other apps like PR

      Author's profile photo George Zaras
      George Zaras

      Hello Ajay,

      Nice Blog! Thanks for sharing!

      Can you please also share some insight regarding the way that we can massively update a custom field?

      For example I would expect that the custom field would be readily available in the migration cockpit but I am afraid this is not the case. Correct?

      Kind regards,


      Author's profile photo Shamsher Ali Mohammed
      Shamsher Ali Mohammed

      Excellent blog.

      Thanks for sharing...looking forward more and more buddy.

      "Sharing is Caring" 😊

      Author's profile photo SAP ABAP
      SAP ABAP

      Hi Ajay,

      Thanks for detailed explanation !! Could you confirm if you did any enhancement for  Update functionality to work? if Not, how system maps updated value to BAPI or FM in the backend.

      Kind Regards !!

      Author's profile photo Rudolf Pfeffer
      Rudolf Pfeffer

      In Extend R_PurchaseOrder:

      How can you extend the view with R_PurchasingDocument.zsmart_number.

      R_PurchasingDocument does not exist in R_PurchaseOrder

      @AbapCatalog.sqlViewAppendName: 'ZRPOEXT'
      @EndUserText.label: 'Extend R_PurchaseOrder'
      extend view R_PurchaseOrder with ZR_PurchaseOrder_Ext {
      Author's profile photo Nitish Chawla
      Nitish Chawla

      Excellent Blog. Eagerly waiting for the second part.

      Author's profile photo Vivek Sharma
      Vivek Sharma

      Hi Ajay,

      Thanks for sharing this nice article. I have been struggling with one question. Does extending Standard Fiori apps using Custom Fields and Logic App or using Extension Points is strategically correct towards keeping the core clean which SAP is promoting with S/4 Hana?