cancel
Showing results for 
Search instead for 
Did you mean: 

Redefine or Extend FDP_EF_PURCHASE_ORDER

Deon_van_Zyl
Active Participant
239

I want to Redefine FDP_EF_PURCHASE_ORDER in order to extend the entity sets to add some fields, but when I try to edit FDP_EF_PURCHASE_ORDER I get a message that editing is prohibited because its SAP standard. But according to the SAP help SAP Help and blogs Blogs I should be able to do it? What am I missing?

Screenshot 2025-03-14 at 14.25.12.png

View Entire Topic
FabioPagoti
Active Contributor

That is the thing - this blog is just wrong and the documentation is not so clear but it says:

  To redefine a service for the first time, proceed as follows - Empty project:

The blog should not teach to change the standard - this change is lost on the next system upgrade. How come this blog has 32 Kudos and 35 comments of former members I will never know.

So the right way of extending an SEGW service is by creating a new (empty) one and then using the the "Redefine" option.

Right click on the "Data Model" folder > Redefine > OData Service (SEGW)

When generating the runtime artifacts for the first time it will ask you if you want to overwrite the standard service. Usually that is the best option so you don't need to adjust the UI app to use your own service. But that means that any call to the standard API will actually call yours. You can add the fields using the SEGW interface but you will need to populate them by using your DPC_EXT class.

Make sure to reuse as much logic as possible by redefining methods and calling the super class using the super reference.

Deon_van_Zyl
Active Participant
@FabioPagoti Thank you so much! I would have never caught that "Empty project" in the SAP help.. Why is it that there are no blogs that details that step? Most things you find is coping the SAP Standard.. which I thought could not be right. Thanks, I created a new project and did a redefinition of FDP_EF_PURCHASE_ORDER.
FabioPagoti
Active Contributor
Glad to help! There should be some blogs but it always gave me the impression this was almost a hidden gem in SEGW (as it's not available anywhere else in the UI apart from the path inside the Data Model folder. For any newer API created in RAP you would need to create some behavior definitions and service definitions with types "extension" by the way.
Deon_van_Zyl
Active Participant
0 Kudos

FabioPagoti Should I copy the callback class as well then as per note 0003009083  ?

FabioPagoti
Active Contributor
0 Kudos

A "callback" class is something very specific of this context/app. I see it it's final so you cannot extend the class.

However this class is a Badi implementation so you might have some lucky by creating a new custom implementation.
It's not clear what you want to achieve here but clearly this is out of scope of the SEGW enhancement.

There are many classes which implement IF_APOC_COMMON_API so clearly there are ways of creating your own callback class.

 

FabioPagoti_0-1742226074011.png

 

Deon_van_Zyl
Active Participant
0 Kudos

@FabioPagotiThe context is as follow:) I have client that wants their own custom version of a Purchase Order (MM_PUR_PURCHASE_ORDER). I created new Master and Content template which I linked via config and that pulls through correctly. They have some address fields i.e their Invoice To Address which should be read from a z-table and one or two non standard fields on the form, which got me to the point where I had to extend the OData service in order to 1) add the non standard fields 2) add the coding for the custom address. So I did my redefinition that created ZFDP_EF_PURCHASE_ORDER and ZCL_ZFDP_EF_PURCHAS_01_DPC_EXT. So my understanding was that I should link that redefined OData to the content template in Output Management Form Template.. but the Z redefined service does not show up there? That is why I thought I had to change it in the call back class.. but maybe I am missing something again ? :))

Screenshot 2025-03-17 at 21.25.11.pngScreenshot 2025-03-17 at 21.25.40.pngScreenshot 2025-03-17 at 21.27.34.png

FabioPagoti
Active Contributor
0 Kudos

I don't get it where the first image was taken from.

Deon_van_Zyl
Active Participant
0 Kudos
Output Management Form Template app from S/4