Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
16,350
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

 
22 Comments
maheshpalavalli
Active Contributor
0 Kudos
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-a...
Former Member
0 Kudos
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
jvanattenhoven
Participant
0 Kudos
Here you added fields to an existing tab. How do you add an new tab with new back-end data?
stefaniehager
Product and Topic Expert
Product and Topic Expert
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
Former Member
0 Kudos
Hi Jereon,

Never came across such requirement.

Thanks,

Dhiraj M

 
former_member727990
Discoverer
0 Kudos

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

Wonderful! Thanks for sharing Dhiraj!

Former Member
0 Kudos
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
Zarko_Jovanovic
Explorer
0 Kudos
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

 
Former Member
0 Kudos
Thanks Alinta Dimitri
Former Member
0 Kudos
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

 
former_member82338
Discoverer
0 Kudos
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
pranamr
Explorer
0 Kudos

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.

 

 

Former Member
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
MrVila
Participant
0 Kudos
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
soumya_r
Participant
0 Kudos

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

soumya_r
Participant
0 Kudos

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

himansagarwal
Newcomer
0 Kudos
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
WandersonSantos
Participant
0 Kudos
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
Sschlegel
SAP Champion
SAP Champion
0 Kudos
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
Sschlegel
SAP Champion
SAP Champion
0 Kudos
Hi jvg.mango ,

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
0 Kudos
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
ShugufthaNaveed
Explorer
0 Kudos

Thankyou for the Step by Step process , I also have requirement to add custom fields to add custom fields (producer code , net cost ) to Long Term Supplier Declaration Inbound Standard Fiori app in SAP GTS . Can any one help to enhance BOBF class and save the data in database.