cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Client proxies: extract data from the response and update Z table

Former Member
0 Kudos

Hi All,

I have following ABAP code for client proxies:

We have DT_Req, MT_Req, DT_Res, MT_Res and MI_Sync_OB (O/p Message: MT_Req, I/P message:MT_Res)

Proxy Objects generated:

ZCO_MI_SYNC_OB

ZMT_REQ

ZDT_REQ

ZDT_REQ_RECORDS

ZDT_REQ_RECORDS_TAB

ZMT_RES

ZDT_RES

ZDT_RES_RECORDS

ZDT_RES_RECORDS_TAB

ABAP Code:

REPORT ZTEST_DELETE.

DATA:

lo_history TYPE REF TO ZCO_MI_SYNC_OB,

lo_sys_exception TYPE REF TO cx_ai_system_fault,

  • Structures to set and get message content

lv_history_req_mt TYPE ZMT_REQ OCCURS 0 WITH HEADER LINE,

lv_history_res_mt TYPE ZMT_RES,

lv_history_req_rec TYPE ZDT_REQ_RECORDS,

lv_history_res_rec TYPE ZDT_RES_RECORDS.

lv_history_req_rec-VLAUE = SY-DATUM.

APPEND lv_history_req_rec TO lv_history_req_mt-MT_REQ-RECORDS.

CREATE OBJECT lo_history.

TRY.

  • Call outbound Proxy

CALL METHOD lo_history->execute_synchronous

EXPORTING

output = lv_history_req_mt

IMPORTING

<b>input = lv_history_res_mt.</b>

  • Error handling

CATCH cx_ai_system_fault INTO lo_sys_exception.

SKIP 2.

WRITE:/ lo_sys_exception->errortext.

RETURN.

ENDTRY.

<b>Now I have my response data in the internable "lv_history_res_mt-MT_REQ-RECORDS" which is deep structure.

How do I extract data records (multiple) from the above internal table and update to Z table??</b>

Thanx

Navin

Accepted Solutions (0)

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Navin,

go to SPROXY, flag structure and search for your table definition. You will find a table definition a field "line" or something, where you find the right structure. Create a new structure with DATA: myStructure type tableStructure. Define a second structure type with your Ztable. Next Loop at internal table into the structure. Inside that loop fill the Zstructure. Insert the Zstrucure (Press F1 on insert to have the syntax you need)


loop at internalTable into intStructure.
zstructure-myField = intStructure-myField.
...
INSERT ztable FROM zstructure.
endloop.

Regards,

Udo

Former Member
0 Kudos

Hi naveen,

I have done a similar requirement.Need to implement a BADI like below:

WA_req type ztable_req.

wa_req-kunnr = I_kunnr.( this is the BADI Parameter).

wa_req-update_date = sy-datum.

wa_req-update_time = sy-uzeit.

wa_req-mandt = sy-mandt.

Then for each new record in Ztable for the primary key, need to send the records to the Proxy structure.

Hope it helps.

Regards,

Ann S

Former Member
0 Kudos

Hi Ann,

Thanks for reply. Seems like you are talking about the fillins the structures for request. I have done that part. I wanted to extract the data from the internal table and and put it in Z table.

Just like in sync BAPI, if you get response in, take that res and update some tables.

Thanx

Navin