Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

API_SALES_ORDER_SRV:How to extend the Standard odata service

chee_wee
Explorer
3,627

Hi,

I have a requirement to create a generic structure for the import payload for Order Post related to the API_SALES_ORDER_SRV, and then perform the update process to the Z field etc.

Can someone please share the information how to deal with such requirement?

- using the Customer field app to extend the Odata structure?

- MPC_EXT, DPC_EXT to build the logic for update? without impacting the Standard SAP process?

For example: Input structure

"nameValuePair": [ { "name1": "Logic1", --> Logic to update the Z field "name2": "000010", --> Indicate the Sales Order item "name3": "", "value": "Test", } ],Odata Process: Check the "Logic1" and update the value to the Z-field.
3 REPLIES 3

CE6
Product and Topic Expert
Product and Topic Expert
3,492

Hi Chee,
I think you can fulfill your requirements with pure key user extensibility functionality. You can find a more detailed example and all further information in that blog.

For your specific use case you need to do the following:

1. Create custom fields for the sales order via Custom Fields app and enable the usage for API_SALES_ORDER_SRV if needed (Tab APIs).

2. Create a Cloud BAdI Implementation for Cloud BAdI "Modification of Header Custom Fields in Sales Documents" (SD_SLS_MODIFY_HEAD) via Custom Logic app to fill the value of your custom fields.

best regards,
Christian

0 Kudos
3,492

Hi Christian,

Thanks for the information.

I need more advise from you with the following points:

1. I created the fields i wanted, and it is available at the OData header structure, if i wanted this additional fields to be added a complete new structure e.g. ZNameValuePair, what should be the steps?

2. If these custom fields is only needed for the OData processing such as manipulate the creation process, or change the data field that is not available in the standard odata, should i redefine the DPC_EXT for CreateEntity method?

Thanks 😄

CE6
Product and Topic Expert
Product and Topic Expert
0 Kudos
3,492

Hi Chee,

1. It is not possible to add a complete new entity/structure to the OData service. Why is a new structure needed? As a workaround you could create a custom business object via Custom Business Object app and define it with all the fields you want. In the sales order you can create a custom field of type "Association to Business Object" which will be the key of your Custom Business Object. The disadvantage would be, that you cannot integrate the Custom BO into the Sales Order API. You would need to have a second OData request to create the entry for your custom business object before adding the key of the custom business object to the sales order.

2. This question is not clear to me. What exactly do you want to do there? Which data do you want to change or manipulate?

best regards,
Christian