on 08-13-2015 6:12 AM
Hi All,
Please advise on how to execute batch post (i.e. update multiple entries to database) in OData without using associations / expansion. Right now, I was able to execute batch post through creation of association / expand from principal entity then implementing logic on CREATE_DEEP_ENTITY method. However, we are looking for an alternative way to have it done not with that approach. Is it possible? Please advise how could it be done.
Thanks,
Jay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venu,
I have added a header in the request as you've suggested but still encountered the same error.
Is the request body I'm using is correct?
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST IDPAllEmployeesSet HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
<atom:content type="application/xml">
<m:properties
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:ViewID>ZZLTVSR</d:ViewID>
<d:EmployeeName>No data maintained</d:EmployeeName>
<d:FirstName />
<d:LastName>No data maintained</d:LastName>
<d:PersonnelNo>82001225</d:PersonnelNo>
<d:OrgID>12003777</d:OrgID>
<d:StatusID>0</d:StatusID>
<d:StatusName>Not Started</d:StatusName>
<d:NotApplicable>false</d:NotApplicable>
<d:LastChangedBy />
<d:LastChangedOn>00000000</d:LastChangedOn>
<d:AvailableOn />
<d:NextJob />
<d:ReportsTo>PA-UK-T109, Test-109</d:ReportsTo>
<d:Manager>false</d:Manager>
<d:Supervisor>false</d:Supervisor>
<d:StartDate>20030807</d:StartDate>
<d:EndDate>99991231</d:EndDate>
</m:properties>
</atom:content>
</atom:entry>
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST IDPAllEmployeesSet HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
<atom:content type="application/xml">
<m:properties
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:ViewID>ZZLTVSR</d:ViewID>
<d:EmployeeName>No data maintained</d:EmployeeName>
<d:FirstName />
<d:LastName>No data maintained</d:LastName>
<d:PersonnelNo>00003703</d:PersonnelNo>
<d:OrgID>12001726</d:OrgID>
<d:StatusID>0</d:StatusID>
<d:StatusName>Draft</d:StatusName>
<d:NotApplicable>false</d:NotApplicable>
<d:LastChangedBy />
<d:LastChangedOn>00000000</d:LastChangedOn>
<d:AvailableOn />
<d:NextJob />
<d:ReportsTo>PA-UK-T109, Test-109</d:ReportsTo>
<d:Manager>false</d:Manager>
<d:Supervisor>false</d:Supervisor>
<d:StartDate>20030801</d:StartDate>
<d:EndDate>99991231</d:EndDate>
</m:properties>
</atom:content>
</atom:entry>
--changeset--
--batch--
Also, I only redefined the corresponding CREATE_ENTITYSET of entity IDPAllEmployeesSet. Will that suffice to handle the operation?
Thanks,
Jay
Hi Jay,
Please send your payload what is using for POST operation so that i can check.
Regards,
Venu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venu,
Please find below detials.
Request URI:
/sap/opu/odata/SAP/YGLOPD_GPA_IDP_DOCUMENTS_SRV/$batch
HTTP Request Header:
Content-Type: multipart/mixed; boundary=batch
HTTP Request Body:
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST IDPAllEmployeesSet HTTP/1.1
Content Type: application/atom+xml
Content-Length: 975
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
<atom:content type="application/xml">
<m:properties
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:ViewID>ZZLTVSR</d:ViewID>
<d:EmployeeName>No data maintained</d:EmployeeName>
<d:FirstName />
<d:LastName>No data maintained</d:LastName>
<d:PersonnelNo>82001225</d:PersonnelNo>
<d:OrgID>12003777</d:OrgID>
<d:StatusID>0</d:StatusID>
<d:StatusName>Not Started</d:StatusName>
<d:NotApplicable>false</d:NotApplicable>
<d:LastChangedBy />
<d:LastChangedOn>00000000</d:LastChangedOn>
<d:AvailableOn />
<d:NextJob />
<d:ReportsTo>PA-UK-T109, Test-109</d:ReportsTo>
<d:Manager>false</d:Manager>
<d:Supervisor>false</d:Supervisor>
<d:StartDate>20030807</d:StartDate>
<d:EndDate>99991231</d:EndDate>
</m:properties>
</atom:content>
</atom:entry>
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST IDPAllEmployeesSet HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
<atom:content type="application/xml">
<m:properties
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:ViewID>ZZLTVSR</d:ViewID>
<d:EmployeeName>No data maintained</d:EmployeeName>
<d:FirstName />
<d:LastName>No data maintained</d:LastName>
<d:PersonnelNo>00003703</d:PersonnelNo>
<d:OrgID>12001726</d:OrgID>
<d:StatusID>0</d:StatusID>
<d:StatusName>Draft</d:StatusName>
<d:NotApplicable>false</d:NotApplicable>
<d:LastChangedBy />
<d:LastChangedOn>00000000</d:LastChangedOn>
<d:AvailableOn />
<d:NextJob />
<d:ReportsTo>PA-UK-T109, Test-109</d:ReportsTo>
<d:Manager>false</d:Manager>
<d:Supervisor>false</d:Supervisor>
<d:StartDate>20030801</d:StartDate>
<d:EndDate>99991231</d:EndDate>
</m:properties>
</atom:content>
</atom:entry>
--changeset--
--batch--
Thanks,
Jay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venu,
Those methods have been redefined as well. For the post operation, I have redefined IDPALLEMPLOYEESS_CREATE_ENTITY of the entity and not /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CREATE_ENTITY.
Please help point out what is wrong in the payload as I follow the structure of the request provided in the document in the link above.
Thanks and regards,
Jay
Hey Jay,
Please check the following links:
Regards,
Ekansh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ekansh,
I have redefined methods /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_BEGIN and /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_END as instructed. Also, will it suffice redefining *_CREATE method of the entity set to handle the POST operation? Is there anything else I need to do?
I tried to execute batch posting but just got unsupported media type error.
Payload Body Request
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST IDPAllEmployeesSet HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
<atom:content type="application/xml">
<m:properties
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:ViewID>ZZLTVSR</d:ViewID>
<d:EmployeeName>No data maintained</d:EmployeeName>
<d:FirstName />
<d:LastName>No data maintained</d:LastName>
<d:PersonnelNo>82001225</d:PersonnelNo>
<d:OrgID>12003777</d:OrgID>
<d:StatusID>0</d:StatusID>
<d:StatusName>Not Started</d:StatusName>
<d:NotApplicable>false</d:NotApplicable>
<d:LastChangedBy />
<d:LastChangedOn>00000000</d:LastChangedOn>
<d:AvailableOn />
<d:NextJob />
<d:ReportsTo>PA-UK-T109, Test-109</d:ReportsTo>
<d:Manager>false</d:Manager>
<d:Supervisor>false</d:Supervisor>
<d:StartDate>20030807</d:StartDate>
<d:EndDate>99991231</d:EndDate>
</m:properties>
</atom:content>
</atom:entry>
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST IDPAllEmployeesSet HTTP/1.1
Content-Type: application/atom+xml
Content-Length: 975
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
<atom:content type="application/xml">
<m:properties
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:ViewID>ZZLTVSR</d:ViewID>
<d:EmployeeName>No data maintained</d:EmployeeName>
<d:FirstName />
<d:LastName>No data maintained</d:LastName>
<d:PersonnelNo>00003703</d:PersonnelNo>
<d:OrgID>12001726</d:OrgID>
<d:StatusID>0</d:StatusID>
<d:StatusName>Draft</d:StatusName>
<d:NotApplicable>false</d:NotApplicable>
<d:LastChangedBy />
<d:LastChangedOn>00000000</d:LastChangedOn>
<d:AvailableOn />
<d:NextJob />
<d:ReportsTo>PA-UK-T109, Test-109</d:ReportsTo>
<d:Manager>false</d:Manager>
<d:Supervisor>false</d:Supervisor>
<d:StartDate>20030801</d:StartDate>
<d:EndDate>99991231</d:EndDate>
</m:properties>
</atom:content>
</atom:entry>
--changeset--
--batch--
Please advise on this.
Thanks,
Jay
Hi Ekansh,
As per my understanding, the use of $batch is to allow sending of multiple requests. Would that mean, based from my sample body request, that each of POST transaction will be handled seperately for each entry but not as single POST transaction for all? Please help confirm on this.
Thanks,
Jay
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.