on 10-16-2014 5:07 PM
Dear Friends,
I am sure there are loads of materials / discussions on the $batch topic.
I shall try and keep it simple as I am unable to find my example.
My requirement is to Create Multiple LineItems for an existing OrderHeader in a single session. ( $batch does this well )
Is there a sample piece of code i can use for collecting all the LineItems fired as part of the ChangeSet($batch) and pass the Internal Table of LineItems to the Create LineItems?
-- This is because i understand ...internally, the ChangeSet Begin and ...End would be invoked for each POST LineItems under one ChangeSet?
..Apologies, if i am talking no sense!!
Suresh BJ
Tags edited by: jitendra kansal
Ashwin / Ron / Atanu
Many thanks for your replies.
We are currently on SP08 ; So, I understand the following ..
1) Client Side
$batch
-- ChangeSet001
POST LineItem01
POST LineItem02
POST LineItem03
-- ChangeSet001
2) Server Side : SP08
Gateway internally invokes POST 3 times (POST LineItem01 ; LineItem02 ; LineItem03) although the response to Client would be once ( lets say, all the POST messages go through successfully).
3) Server Side : SP09
A new feature in the form of ChangeSet_Process to collect LineItem01,LineItem02,LineItem03 is possible.
Many thanks once again,
Suresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes.. this would be possible in SP9. Now you have the option to collect the information from chageset and post them together as per your need.
A sample code may look like this
1. somehow you need to tell the Gateway framework that you want to process OrderHeader/OrderItems together. This means for every changeset it should not call the CREATE_ENTITY(or update or delete). Rather it should be called once. This can be done in the CHANGESET_BEGIN method
DATA: ls_operation_info TYPE /iwbep/s_mgw_operation_info.
IF ls_operation_info-entity_set <> 'MY_ENTITYSET_NAME'
cv_defer_mode = abap_true.
ENDIF.
This code will enable DEFERRED mode for your entityset/entitysets and will tell the framework not to call CREATE/UPDATE/DELETE methods separately.
2. Now you need to collect the payloads from the changeset in the method CHANGESET_PROCESS. You will find all the contents of the changeset in parameter it_changeset_request in the method CHANGESET_PROCESS. Now you need to collect all the payload data and process.
Hope this gives some idea..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suresh
Unless you are placing each LineItems instance into a separate consecutive changsets, the end method won't be called more than once. Building a batch request like this is rather pointless. The typical use case is to post all changes to the LineItems in one changeset. Then the "end" method is called once all of the change (entity update) operations have finished.
The original framework processing for $batch chains the individual update operations, there is no mass update feature unless you subvert the framework in some way to provide your own solution. Ideally there should be such a feature ans as Ashwin has pointed out, this looks set to arrive in SP09.
Ron.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Suresh,
According to me, during run-time Instantiation happens for each change and i dont see any why we can collect everything and pass to our back end logic.
May be in new release this may be possible. Not sure about it.
Please refer below
$batch Processing - SAP NetWeaver Gateway - SAP Library
Refer the comments as well.
In SP 09 i read there is some improvements done for BATCH and m not very if its applicable for deep entity operations as i have not gone through it and checked cos we are still on old SP
Go through that column and see if it can help.
Need to wait other experts in the forum to comment on this.
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.