Skip to Content

OData POST operation for hierarchical Business Objects

Hello, I'm looking for your help please, to know the way to do properly a POST(create) for the hierarchical business objects. Please find below an example for my issue :

An Accounting Entry (open to modification in OData modeler) needs Items to be created, and the Items need also the Accounting Entry ID(ParentObjectId) to be created. That way, I cannot create neither the Accounting Entry, nor the Items.

I found some information concerning the use of Differed key word on OData, but nothing concerning the use of it for SAP. It would be very usefull for me to get a concrete example of a request body to create an Accounting entry with OData.

With sincere regards,

Ismaïl

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 13 at 03:54 PM

    Hi Ismail,

    I have a quick example to create a sales order with items using OData. Maybe that helps you as well:

    URL: https://{{TenantHostname}}/sap/byd/odata/cust/v1/khsalesorder/SalesOrderCollection

    Header parameters: Content-Type = application/json and x-csrf-token = <as provided by the GET response>

    Body:

    {	
    	"BuyerID": "MY_EXT_REF_123",
    	"Name": "KH Sales Order (OData Nested Create)",
    	"DataOriginTypeCode": "4",
    	"SalesOrderSalesUnitParty":
    		{	
    			"PartyID": "P1110"
    		}, 	
    	"SalesOrderBuyerParty":
    		{
    			"PartyID": "CP100110"
    		},
    	"SalesOrderPricingTerms":
    		{
    			"CurrencyCode": "EUR",
    			"GrossAmountIndicator": false
    		},
    	"SalesOrderItem":
    		[
    			{
    				"ID": "10",
    				"SalesOrderItemProduct":
    					{
    						"ProductID": "P100401"
    					},
    				"SalesOrderItemScheduleLine":
    					[
    						{
    							"Quantity": "2",
    							"unitCode": "EA"
    						}
    					]
    			},
    			{
    				"ID": "20",
    				"ProcessingTypeCode": "TASC",
    				"SalesOrderItemProduct":
    					{
    						"ProductID": "300002"
    					},
    				"SalesOrderItemScheduleLine":
    					[
    						{
    							"Quantity": "2",
    							"unitCode": "HUR"
    						}
    					]
    			}
    		]
    }    	
    

    Best regards,
    Knut

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Knut,

      Thank you for your quick answer. It's a good example to start with.

      Could you please, provide me the OData service that you created to use this query that I can upload on ByD, in a way to test this example with the same conditions as you did?

      Thanks in advance for your precious help.

      Best regards,

      Ismaïl