Technical Articles
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.
- Country of Origin(EINA-BSTAE)
- Production Version(EINE-VERID
Standard App Screen without extension as follows:
- 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.
- 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
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/
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.
Please let me know if I am missing anything.
Thanks,
Dhiraj M
Here you added fields to an existing tab. How do you add an new tab with new back-end data?
Hi Jereon,
Never came across such requirement.
Thanks,
Dhiraj M
Hi Jeroen,
It is possible however you have to make changes in the following places.
hope this helps.
thanks,
Arun
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
Hi Soumya,
the SEGW Project needs to be refreshed and also regenerated to created MPC and CDS for the new association. But as a customer, you don't have the possibility to start this!
Take a look at Andre Fischer - Post: How to redefine RDS based OData services? | SAP Blogs
Or if you are to lazy to read, enjoy his ABAPConf Session on YouTube
Regards
Sören
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
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
This is really a helpful blog I am really impressed with your work, keep it up the good work
Wonderful! Thanks for sharing Dhiraj!
Thanks Alinta Dimitri
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
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
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.
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
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
Hi Jordi Vila ,
you don't have to copy the Fiori App - as you can see here: Extending a service using the Gateway Service Builder | SAP Blogs
Or some more details: How to redefine RDS based OData services? | SAP Blogs
Regards
Sören
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.
Thanks in advance,
Soumya
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
Hi Himanshu,
I know this is an old post. But we are also facing the same error. We added a custom field but it says entity is not Read Only. With ObjectModel.readOnly: true. there is no error in gateway but field is not editable. Could you pls let us know how did you resolve this.
Thanks in advance . James
Hi Dhiraj,
thank you for this great step-by-step instruction. Very nice blog!
I'm extending App (F3163). I followed all the steps.
The field is now available on the APP. However, when changing the value, it is not being updated. Could help with draft class enhancement .
Thanks
Wanderson