cancel
Showing results for 
Search instead for 
Did you mean: 

Hi Kenichi Unnai,

0 Kudos
156

I tried implementing the batch operation with content id as given in the blog. The process works fine when only a single item is passed. When more than one items are passed in the payload it throws an error.

The following is the error.

Association cardinality for node Person Involved, association PERSON_INJ_INFO violated.

Person is the item set.

--batch_a80f-2292-a769

Content-Type: multipart/mixed; boundary=changeset

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST Incidents HTTP/1.1

Content-Id: 1

Content-Type: application/json

Accept: application/json {"IncidentCategory":"001","IncidentDescriptionOfEvents":"test123","IncidentUTCDateTime":"\/Date(1525683009034)\/","EHSLocationUUID":"005056B0-240D-1ED5-BF9A-2D76E9FD7F8A","__metadata":{"type":"EHS_INC_REPORTINCIDENT_SRV.Incident","uri":"/SGD/sap/opu/odata/sap/EHS_INC_REPORTINCIDENT_SRV/Incidents('id-1525683009032-71')"}}

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST $1/Persons HTTP/1.1

Content-Type: application/json

Content-Id-Ref: 1

Accept: application/json

{ "PersonInvolvedRole":"EHHSS_PR_INJURED_PER", "PersonFullName":"Ricky Pointing" }

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST $1/Persons HTTP/1.1

Content-Type: application/json

Content-Id-Ref: 1

Accept: application/json

{ "PersonInvolvedRole":"EHHSS_PR_INJURED_PER", "PersonFullName":"Micheal Clarke" }

--changeset--

--batch_a80f-2292-a769--

gregorw
Active Contributor
0 Kudos

It would help if you link to the blog and provide a subject that describes what you're asking for.

View Entire Topic
Ankit_Maskara
Advisor
Advisor
0 Kudos

Hi,

In your second child entry you need to repeat the header of first child again.

Below payload worked for me -

--batch_mybatch
Content-Type: multipart/mixed; boundary=changeset_mychangeset1
--changeset_mychangeset1
Content-Type: application/http
Content-Transfer-Encoding: binary
POST HeaderSet HTTP/1.1
Content-Type: application/xml
Content-Length: 1021
Content-ID: 100
<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="http://..._SRV/"
xmlns="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<content type="application/xml">
<m:properties>
<d:Id>1</d:Id>
<d:Text>New parent entity</d:Text>
</m:properties>
</content>
</entry>
--changeset_mychangeset1
Content-Type: application/http
Content-Transfer-Encoding: binary
POST $100/ToItems HTTP/1.1
Content-Type: application/xml
Content-Length: 1021
<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="http://..._SRV/"
xmlns="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<content type="application/xml">
<m:properties>
<d:ParentId></d:ParentId>
<d:Id>000010</d:Id>
<d:Text>First child entity</d:Text>
</m:properties>
</content>
</entry>
--changeset_mychangeset1
Content-Type: application/http
Content-Transfer-Encoding: binary
POST $100/ToItems HTTP/1.1
Content-Type: application/xml
Content-Length: 1021
<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="http://..._SRV/"
xmlns="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<content type="application/xml">
<m:properties>
<d:ParentId></d:ParentId>
<d:Id>000020</d:Id>
<d:Text>Second child entity</d:Text>
</m:properties>
</content>
</entry>
--changeset_mychangeset1--
--batch_mybatch--