on 03-20-2017 4:41 PM
In the picture you can see a simplified oData model of my service.
What I want to do is to create an IbaseHeader with Ibase Items (deep insert) and then once it has been created I want to add it as an object to an existing Work Order(Objects tab in the transaction IW32).
How do I do that?
Should I call the create deep entity IbaseHeader + Items from my SAPUI5 app and then on the "success" callback, call update method on the WorkOrderObject entity?
Or should I batch it in LUW and process it together in one go? If yes then how to do that exactly?
If anyone is aware of any FIORI apps doing something similar could you point me towards it?
I would suggest you to process in batch.
In Your Gateway Code
In ChangeSet_Begin, for the mentioned entitites set deferred flag to true.
In Changeset_Process, collect all the changes and perform Create as well as WorkOrder update.
In Changeset_End, Commit all.
Your Gateway Request Body will look like this. (pseudocode). Basically single Batch and single changerequest. If you want sample request bodies, use CORE_SAMPLES test cases in Gateway Client.
--BatchRequest-1
--ChangeSet-1
POST IbaseHeader (this is a deep call)
--ChangeSet-1
PUT WorkOrderObject
--ChangeSet-1--
--BatchRequest-1--
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to start using 'BatchId'. Here is the pseudocode.
1. Set BatchID 'abc' as 'deferred'. (API on V2 odata model)
2. Create call mentioning batchID 'abc'
3. Update call mentioning batchID 'abc'
4. call submitchanges on odata model mentioning batchid 'abc'. (This is when create and update are sent as a single batch request).
it is recommended to use the batch approach.
Use OData model v2 version which has automatic batch handling and just loop through all the records and call odatamodel create method for all the entities at a time. Then a batch request is sent to backend.
Now in the backend, assuming it sap abap, implement, changeset begin and changeset process which belongs to APPL interface(not core, check for blogs in google, you will get plenty ). Now in the chageset begin, you need to set cv_defer as abap_true and in the chageset process method, you will find all the records that you have sent from the ui5 batch in an importing internal table.
Let me know if you need any help.
Best Regards,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.