cancel
Showing results for 
Search instead for 
Did you mean: 

How to read content in a batch request

0 Kudos

Hello,

We are doing a batch request with below payload.


PUT SubstitutionPeriodSet(SubstitutedPerNr='12345678',Begda=datetime'2015-07-14T00%3A00%3A00',Endda=datetime'2015-07-30T00%3A00%3A00') HTTP/1.1

Accept-Language: de

Accept: application/json

MaxDataServiceVersion: 2.0

DataServiceVersion: 2.0

Content-Type: application/json

Content-Length: 114

{"SubstitutedPerNr":"12345678","Begda":"\/Date(1436832000000)\/","Endda":"\/Date(1438300800000)\/","Leaveflag":""}


The method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_PROCESS is implemented for processing. We are able to get the entry key with below code.

ls_changeset_request-entry_provider->read_entry_data( IMPORTING es_data = ls_subst ).

My question: How can i get the body of the request. In this case content of below line.

{"SubstitutedPerNr":"10096395","Begda":"\/Date(1436832000000)\/","Endda":"\/Date(1438300800000)\/","Leaveflag":""}


Thanks

Pradeep





Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor
0 Kudos

The option you are using is called deferred batch which was introduced in SP9.

If this option is used the framework would allow the developer/user to process all the operations in the batch as per own convenience, thus not propagating the calls to default implementations.

You can access the payload from IT_CHANGESET_REQUEST in ENTRY_PROVIDER using the following method

entry_provider->read_entry_data( IMPORTING es_data = work_area ).

Hope this helps.

Atanu

Answers (2)

Answers (2)

AshwinDutt
Active Contributor
0 Kudos

Hello Pradeep,

Inside the Update_Entity Method,

1. Get the Key first.

READ TABLE it_key_tab WITH KEY name = '<Property_Name>' INTO ls_key_tab.

<lv_property_value> = ls_key_tab-value.


2. Read the payload only if <lv_property_value> ( Key ) is not initial.


io_data_provider->read_entry_data( IMPORTING es_data = <ls_input_structure> ).


Where <ls_input_structure> is the structure as per the GW Model and this will have the payload details now.


Regards,

Ashwin

sreehari_vpillai
Active Contributor
0 Kudos

call METHOD IO_DATA_PROVIDER->READ_ENTRY_DATA

               IMPORTING

                 ES_DATA = ER_ENTITY.


you can use the above statement in the PUT handler ( UPDATE_ENTITY ) to get the data . Even though you are using batch  you will get control in this method as this is the handler for the PUT ( for other operations also the same)


Sree

0 Kudos

Hello,

No, control is not going to UPDATE_ENTITY or DELETE_ENTITY methods. Any other suggestions..

Pradeep

AshwinDutt
Active Contributor
0 Kudos

Hello Pradeep,

Are you collecting all the Update Operation of the Payload and calling Update for all those only once is it ? i mean calling data provider in defer mode ?

Can you please share details how you have implemented ?

Regards,

Ashwin

0 Kudos

Hi Ashwin,

Yes, we are using deferred mode and this flag is set in method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_BEGIN...

Pradeep