Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need help changing this ABAP XI Proxy sample code to fit what I'm doing

former_member210148
Participant
0 Kudos

Hello, everyone! I've been googling and searching through the SDN forums for the past day trying to find the answer on my own. I found some sample code, but after a lot of unsuccessful trial-and-error in SAP, I'm hoping someone out there can help me out.

I am working on an outbound interface with a colleague. She is doing the "XI" portion of the interface, and I am doing the ABAP Proxy. What I'm doing is relatively straight-forward: I'm reading data from SAP, putting it into an internal table, and it's the data in that table that needs to go back to XI. Each record in my internal table represents one person (PERNR). The fields represent data that will eventually become separate record types that we'll send off-site to another system.

Sample record contains data for:

<Record 01><Record 02><Record 03><Record 04 "A"><Record 05 "A"><Record 04 "B"><Record 05 "B">

Record 04 and Record 05 exists twice because a person might have just a record 04/05 for "A", just a record for 04/05 for "B", or records for both. In any event, if situation "A" occurs, they have an 04/05 record. If situation "B" occurs, they have an 04/05 record for that as well.

Here's the sample code I plucked from SDN:

&----


*& Report ZBLOG_ABAP_PROXY

*&

&----


*&

*&

&----


REPORT zblog_abap_proxy.

DATA prxy TYPE REF TO zblogco_proxy_interface_ob.

*

CREATE OBJECT prxy.

DATA it TYPE zblogemp_profile_msg.

TRY.

it-emp_profile_msg-emp_name = 'Sravya'.

it-emp_profile_msg-empno = '80101'.

it-emp_profile_msg-DEPARTMENT_NAME = 'NetWeaver'.

CALL METHOD prxy->execute_asynchronous

EXPORTING

output = it.

commit work

.

CATCH cx_ai_system_fault .

DATA fault TYPE REF TO cx_ai_system_fault .

CREATE OBJECT fault.

WRITE 😕 fault->errortext.

ENDTRY.

Here's the class, structures, and tables generated for me to use from XI:

  • Class: ZXI_CO_OB_HRBN_PURDUE_STD_LTD

  • Struc: ZXI_DT_PURDUE_RECORD01

  • Struc: ZXI_DT_PURDUE_RECORD02

  • Struc: ZXI_DT_PURDUE_RECORD03

  • Struc: ZXI_DT_PURDUE_RECORD04

  • Struc: ZXI_DT_PURDUE_RECORD05

  • Struc: ZXI_DT_PURDUE_STD_LTD

  • Struc: ZXI_MT_HRBN_PURDUE_STD_LTD

  • Table: ZXI_DT_PURDUE_RECORD01_TAB

  • Table: ZXI_DT_PURDUE_RECORD02_TAB

  • Table: ZXI_DT_PURDUE_RECORD03_TAB

  • Table: ZXI_DT_PURDUE_RECORD04_TAB

  • Table: ZXI_DT_PURDUE_RECORD05_TAB

Ok, I know where to plug in the Class (that's what my "prxy" reference variable will reference). I was told structure ZXI_DT_PURDUE_STD_LTD includes the structures for the 5 record type (01 thru 05) above it.

I think I'll have to loop thru my internal table, populating the above stuff. I feel like the "MT" structure above will be the "it" table in the example based on another example I saw, but is that true? I've had tables generated for each of the 5 record types. The sample SDN code is a simple one, of course, and I feel like I'm so close to figure this out -- I think I have the pieces, I just don't know how to put them together.

Can someone tell me what my processing should look like. It can be simple pseudocode, as long as it references those "XI" items above. Thanks so much, folks -- points will be awarded for all helpful information.

3 REPLIES 3

Former Member
0 Kudos

Just fill your internal table value in your proxy structure and call the outbound proxy.

Here i am giving another example

l_output-pbsfil_mt-paymentdata-record[] = it_payment_data[].

  • Create Object for Proxy Class

CREATE OBJECT obj1.

  • Calling the Proxy Class Asynchronous Method

TRY.

CALL METHOD obj1->execute_asynchronous

EXPORTING

output = l_output.

CATCH cx_ai_system_fault INTO some_ex.

ENDTRY.

  • Send data

COMMIT WORK.

In this example i am fiiling the selected data in the data field of my proxy structure.

0 Kudos

Swagatika,

Are you saying that a lot of what I was provided with, all those XI-generated tables and structures, I really don't need to use in my program? I think that's part of the issue there. I understand "_DT_" means data type and "_MT_" means message type, and it looks like it's the message structure ("_MT_") that is actually a table that I should pass back to XI. But given all this other stuff generated by XI and provided to me, I don't know if those are pieces I need, and if so, how I use them, etc.

0 Kudos

Send me your email id, i will send you some attachements with explanation.