Skip to Content
Technical Articles
Author's profile photo Dhiraj More

Extending Transactional Fiori App based on Fiori Elements in SAP

Hello Everyone,

I searched for some blogs on how to extend standard fiori apps which is based on CDS BOPF and Fiori Elements but didn’t found anything. There is plenety of material on custom app creation based on CDS, BOPF and Fiori element but nothing on extension.

Pre-Requisite :: One should have knowledge on CDS,BOPF generated from CDS, ODATA and Fiori elements.

Requirement :: I want to extend Standard Fiori App “Manage Purchasing Info Records” to add below fields.

  1. Country of Origin(EINA-BSTAE)
  2. Production Version(EINE-VERID

Standard App Screen without extension as follows:

  1. Supplier Country of Origin field as shown below in UI after extension

   2.Need to add Production Field as shown below in UI after extension

 

Application Description  ==>  Manage Purchase Info Record is transactional app based on Fiori Elements where Create/Update/Delete is supported by BOPF Object I_PURGINFORECORDWWITHDRAFT generated from CDS.

  • BOPF Object ==> I_PURGINFORECORDWWITHDRAFT
  • Transactional CDS Root View ==> I_PURGINFORECORDWWITHDRAFT
  • Consumption CDS View in ODATA ==> C_PURINFORECORDWITHORG
  • Draft Class ==> CL_I_DR_PURGINFORECORDWWITHDRA responsible for Creation and update of Info records

Analysis ==> We did initial analysis as given below.

  1. We found that Country of Origin is part of Transactional CDS and BOPF Object. Therefore create, update for field is supported by underlying business object. But field is not added in consumption view. Hence field is not available in UI app.

          Solution ==> Add field in Consumption CDS view C_PURINFORECORDWITHORG to appear in UI

2. Production Version field is not present in consumption, transactional CDS and BOPF Object. Thus Create/Update of field need to be handled explicitly.

Solution ==> Please follow the below steps.

a. Extend transactional view I_PURGINFORECORDWWITHDRAFT to include Production Version field using association with EINE table

b. Next, we need to add these field in underlying draft structure and draft table explicitly.

  • Add field to draft table

  • Add field to draft structures

c. Now we need to make changes in Draft class wither using Implicit enhancement or Pre-Exit or Post Exit method. I have not done changes because of Approval issues. But that is normal ABAP

d. Extend the consumption CDS to add Production field to expose in UI.

Note: ODATA redefinition is not needed as we just have to add extra fields which is possible from consumption CDS. If we have to add new entity then we have to redefine the project.

Conclusion :: If custom field is not present in transactional and consumption CDS then we have to add field from scratch in transactional CDS, Draft table and it’s structures and finally to consumption view.

Also I appeal experts to share their expertise and experience on how they have handled such requirement. Also if there is any better way of doing it.

Thanks,

Dhiraj More

 

Assigned Tags

      17 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Mahesh Kumar Palavalli
      Mahesh Kumar Palavalli

      Nice one!!  Just wondering if there is any reason for not going with custom fields app ?

      https://blogs.sap.com/2020/02/01/adding-field-in-standard-fiori-apps-of-s-4hana-with-custom-fields-and-logic/

      Author's profile photo Dhiraj More
      Dhiraj More
      Blog Post Author

      Hi Mahesh,

      I have not worked with Custom Field and Logic app more. But I tried using for above case and could not achieve it because of reason mentioned below.

      1. Using Custom Field ==> I was able to get the business context but i don't want to add any new custom field. I want to expose existing standard fields from EINA and EINE table which are not exposed in UI. Therefore custom field is not applicable in my case. @Mahesh please correct me if my understanding is wrong.
      2. I tried using Data Source Extension to add existing standard field from EINA but could not find the data source. Therefore I have to go with other approach.

      Please let me know if I am missing anything.

      Thanks,

      Dhiraj M

      Author's profile photo Jeroen Vanattenhoven
      Jeroen Vanattenhoven

      Here you added fields to an existing tab. How do you add an new tab with new back-end data?

      Author's profile photo Dhiraj More
      Dhiraj More
      Blog Post Author

      Hi Jereon,

      Never came across such requirement.

      Thanks,

      Dhiraj M

       

      Author's profile photo arun muthukumarasamy
      arun muthukumarasamy

      Hi Jeroen,

       

      It is possible however you have to make changes in the following places.

      1. Create an extension in the CDS view with the new fields and create Annotation for the New section.
      2. Enhance the BOPF to include the changes.
      3. Enhance the manifest.json file and add the section information to the object page configuration.

      hope this helps.

       

      thanks,

      Arun

      Author's profile photo soumya r
      soumya r

      Hi Arun,

      I have tried the above step you mentioned. 

      I am adding custom fields for PO item in Manage PO transactional application. I did extension cds and added fields explicitly in bopf structures as he mentioned, but OData is not allowing me to create/edit the PO in fiori app level.

      I created CDS view and did annotation extension. But, i got OData level metadata loading error.

      How to enable them at OData level so i can add value help to this custom fields.

      your steps are useful for the fiori elements applications built on cds.

      Thanks,

      Soumya

      Author's profile photo Stefanie Hager
      Stefanie Hager

      Hi Dhiraj,
      thank you for this great step-by-step instruction. Very nice blog!
      Not sure if you had seen the documentation on Extending Apps with Custom Code. Not exactly your use case, but very close. Do you find this useful?
      best regards,
      Stefanie

      Author's profile photo Dhiraj More
      Dhiraj More
      Blog Post Author

      Hi Stefanie,

      The link you shared is related to extension of CDS view but in our case we are extending transactional CDS view means CDS with generated business object. Therefore only extending CDS view will not work in our case.

      Thanks,

      Dhiraj M

      Author's profile photo Alinta Dimitri
      Alinta Dimitri

      This is really a helpful blog I am really impressed with your work, keep it up the good work

      Wonderful! Thanks for sharing Dhiraj!

      Author's profile photo Dhiraj More
      Dhiraj More
      Blog Post Author

      Thanks Alinta Dimitri

      Author's profile photo Zarko Jovanovic
      Zarko Jovanovic

      Hi great blog!

      I am facing the similar issues, I tired to apply yours solution but unfortunately when I want to extend Transactional view I_Purchaserequisitionitem_Wd with the field I have added with custom field and logic app or with the field that already exists in the Draft table I get the error saying that the name of the field is not unique. And if I use the unique name then I get the error that the field is not in the Draft table.

      Do I need to first extend the transaction view and then extend draft table? Is it not posibble to extend transaction view with the fields already in the Draft table?

      Thanks,

      Zarko

       

      Author's profile photo Dhiraj More
      Dhiraj More
      Blog Post Author

      Hi Zarko,

      I didn't got your scenario. Always whatever we will add in Transactional CDS view will have to add in Draft table too. I am not getting how come new field is already present in draft table but not in Transactional View. First we have to add field in Transactional view and then draft table.

      Not sure it might be because you are using "Custom Field and Logic" app.

      Thanks,

      Dhiraj M

       

      Author's profile photo Pranam R
      Pranam R

      Hi Dhiraj

      I followed the steps that you have mentioned and the 'Country of Origin' field is showing up in the object page under 'General Information' tab but the value help is not showing on the field and in the SEGW project it is asking me to regenerate the project .

      Since it is SAP standard ODATA service, I am unable to regenerate. Can you please tell how did you solve this issue.

       

       

      Author's profile photo Dhiraj More
      Dhiraj More
      Blog Post Author

      Hi Pranam,

      I don't think Valuehelp for the Country of Origin will come automatically. I guess you have to redefine the ODATA service so that Valuehelp entity gets added to ODATA service.

      Thanks,

      Dhiraj M

      Author's profile photo Jordi Vila
      Jordi Vila

      Hi Dhiraj More,

      If you redefined the oData Service, then you will have to replace the oData service in the Fiori application. So it means you have to create a copy of the standard Fiori app and replace the service on it. From that moment every time you will apply a note you will have to copy again the application... am I right?

      I don't like it at all and SAP should provide a better way to do it.

      Thanks

      Author's profile photo soumya r
      soumya r

      Hi Dhiraj,
      its a very helpful blog.
      I have some of the open points after i tried the same kind of development for Procurement: manage PO by enabling custom fields.

      CFL - custom field and logic app is meant to extend the app with standard fields/custom field reference to standard fields for this business context. but the abap developer already developed this custom fields in PO Me22 transacation, i have to enable at fiori applications.

      In your blog, i found more details for cds/bopf level.
      I have tried the same doing it for manage purchase order app as its transactional application with CRUD operation with BOPF.
      scenario - adding 3 custom fields along with standard field from EKPO table in new custom facet of PO item object page.
      first step, i defined these custom fields in CFL app, and enabled in this fiori app but its not working as getting error while creating adaptation project to manage PO BSP app.
      identified the item level cds view with draft table mentioned in the annotation level.
      pain points.

      Fiori application is created as smart template with OData as reference data source by CDS.

      -OData is throwing the error for these fields as it created new sadl field which doesnt exist in MPC metadata.
      - i couldnt find the class implementing this cds/bopf for item.

      • how did you read the data in BADI? i see the data flowing to OData, but BAdi structure has field with no values from fiori application.
      •  

      Thanks in advance,
      Soumya

      Author's profile photo Himanshu Agarwal
      Himanshu Agarwal

      Hi Dheeraj,

       

      I have a similar requirement. I need to extend Manage Business Partner App (F3163). I followed the same steps as you suggested but I am getting the error "Error related to element 'DEATHDT' of entity 'C_BUSINESSPARTNER(CDS)': The element 'DEATHDT' of the CDS view 'C_BUSINESSPARTNER' is not Read-Only"

      The consumption CDS view for the service is C_BUSINESSPARTNER. it's accepting the added field only when I am marking the field as @ObjectModel.readOnly: true. it's giving the error if I am giving read-only as 'EXTERNAL_CALCULATION'.

      Do you have any idea, how I can overcome this error?

       

      Thanks

      Himanshu