cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple entries in a Single table via OData service

Rohan_Chauhan
Explorer
0 Kudos

Hi.

I tried to create a service in which we have to send more than one entry via OData service.

My project name is ZVBAP and I use VBAP table fields which are vbeln, posnr and matnr

So by use of Create entity I can send the single entry to the Standard table but after many try I didn't get any solution to how to send more than one entry in Standard table.

Also I tried this in METHOD /iwbep/if_mgw_appl_srv_runtime~create_entity but still it doesn't run and it affects the Create entity service also.

 

Please help me to solve this.

Thanks in advance.

Rohan Chauhan

Accepted Solutions (1)

Accepted Solutions (1)

sajid-khan
Explorer

You can't create multiple entries with OData's CRUD operations. For bulk creation, use batch processing.

Edit: You can also make use of OData's deep create feature. You'll have to modify your OData to add a new parent entity type (For example, a VBAK entity type) which will hold multiple VBAP entities using navigation property (VBAK 1:N VBAP cardinality). Sending a deep create request on VBAK will let you pass multiple VBAP entries in same request, the multiple entries then can be created in backend all at once. 

Rohan_Chauhan
Explorer
0 Kudos

Hi Sajid.

You tell me the alternate method to create a deep entity service. But in this method we have to add another table which was VBAK but I have to add entries only in one table.

And please elaborate the batch process method which helps me a lot.

 

Thanks

Rohan Chauhan

sajid-khan
Explorer
0 Kudos

Hi @Rohan_Chauhan

For Deep create, you have the control over whether the parent entity is created in the table. You can extend the CREATE_DEEP_ENTITY method in your data provider class. Simply omit the code responsible for inserting parent entity data into the table.

For batch processing see (https://community.sap.com/t5/technology-blogs-by-members/odata-batch-processing-part-1/ba-p/13484676)

If you are using Ui5, you don't have to worry about manually passing all these HTTP headers and payloads. For example, for Odata V4, you can simply call sap.ui.model.odata.v4.ODataListBinding:create method to add create requests to queue, and finally call sap.ui.model.odata.v4.ODataModel:submitBatch to send the batch create request to the server.

Answers (0)