Application Development and Automation 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: 
Read only

Outbound interface using ABAP Proxy

manoj_goyal2
Participant
0 Likes
4,351

Hi Guys,

I am trying to create an interface between a Z table and XI using ABAP Proxy. I suggested file based interface, but client is insisting using ABAP proxy. Z table is in IS-Retail side.

I will appreciate is somebody can share a program to do this.

Any advise/guidance is appreciated.

Thanks,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,948

Hi There

From your subject line i can see that you want to develop an outbound proxy which means you want to send data to XI from your SAP custom table. That means you need to extract all the information from your Z-table and send it to XI via proxy.

If my understanding is correct then what you need to do is :

1.Ask your XI team team to generate a message interface for you of type 'outbound' and include the structure in the way they want you to send data to them.

2.Once the message interface is created by them , you can generate the same in transaction SPROXY . Search for your interface namespace and then right click

on it and say 'CREATE' . Give the appropriate package and prefix to it.Generate the proxy, save and activate

3. Now you can create a report and then according to the structure generated by XI , you can popluate your internal table to be passed back.

4. Call the method of the proxy in your report and send the data to XI.

I can give you an example of how to do this:

suppose you have built up an internal table by extracting data from your Z-table .Lets say it is tbl_output.

In your report you need to trigger the proxy method as follows:

Note: i am assuming i am triggering an asynchronous proxy method from my report:

DATA:lo_senddata  TYPE REF TO CL_DATA_OUT,
                  lo_system_fault TYPE REF TO cx_ai_system_fault,
                  lo_root         TYPE REF TO cx_root.
ls_output-output_file-data[] = tbl_data[].
CREATE OBJECT lo_senddata
TRY.
* call the asynchronous method of the proxy and send the data
          CALL METHOD lo_senddata->execute_asynchronous
            EXPORTING
              output = ls_output.
* get the system exceptions and display the error text
        CATCH cx_ai_system_fault INTO lo_system_fault.
          WRITE:/ 'System Error:'(E01),
                  lo_system_fault->errortext.
          RETURN.
* get the root exception and display the textid value
        CATCH cx_root INTO lo_root.
          WRITE:/ 'System Error:'(E01),
                  lo_root->textid.
          RETURN.
      ENDTRY.
COMMIT WORK.

.

<b>Note:</b> 1. CL_DATA_OUT is the message interface class.

2. ls_output is the output structure to be sent back to XI and data

is an internal table with the same structure as tbl_data.

3. It is very imp to catch exceptions as i have shown u above.

Please let me know if you are a little clear or you need some more clarifications on this.

cheers

shivika

15 REPLIES 15
Read only

Former Member
0 Likes
2,948

Hi,

Its better to post in XI forums, so that you will get solutions quickly.

https://www.sdn.sap.com/irj/sdn/forums

Thanks

Donepudi

Read only

Former Member
0 Likes
2,949

Hi There

From your subject line i can see that you want to develop an outbound proxy which means you want to send data to XI from your SAP custom table. That means you need to extract all the information from your Z-table and send it to XI via proxy.

If my understanding is correct then what you need to do is :

1.Ask your XI team team to generate a message interface for you of type 'outbound' and include the structure in the way they want you to send data to them.

2.Once the message interface is created by them , you can generate the same in transaction SPROXY . Search for your interface namespace and then right click

on it and say 'CREATE' . Give the appropriate package and prefix to it.Generate the proxy, save and activate

3. Now you can create a report and then according to the structure generated by XI , you can popluate your internal table to be passed back.

4. Call the method of the proxy in your report and send the data to XI.

I can give you an example of how to do this:

suppose you have built up an internal table by extracting data from your Z-table .Lets say it is tbl_output.

In your report you need to trigger the proxy method as follows:

Note: i am assuming i am triggering an asynchronous proxy method from my report:

DATA:lo_senddata  TYPE REF TO CL_DATA_OUT,
                  lo_system_fault TYPE REF TO cx_ai_system_fault,
                  lo_root         TYPE REF TO cx_root.
ls_output-output_file-data[] = tbl_data[].
CREATE OBJECT lo_senddata
TRY.
* call the asynchronous method of the proxy and send the data
          CALL METHOD lo_senddata->execute_asynchronous
            EXPORTING
              output = ls_output.
* get the system exceptions and display the error text
        CATCH cx_ai_system_fault INTO lo_system_fault.
          WRITE:/ 'System Error:'(E01),
                  lo_system_fault->errortext.
          RETURN.
* get the root exception and display the textid value
        CATCH cx_root INTO lo_root.
          WRITE:/ 'System Error:'(E01),
                  lo_root->textid.
          RETURN.
      ENDTRY.
COMMIT WORK.

.

<b>Note:</b> 1. CL_DATA_OUT is the message interface class.

2. ls_output is the output structure to be sent back to XI and data

is an internal table with the same structure as tbl_data.

3. It is very imp to catch exceptions as i have shown u above.

Please let me know if you are a little clear or you need some more clarifications on this.

cheers

shivika

Read only

0 Likes
2,948

Thanks Shivika for you reply and guidance. This is what I was looking for.

Read only

0 Likes
2,948

Hi, Shivika,

I have one clarification to ask, In step 2 about using t-code SPROXY, I believe I have create Proxy on our SAP system and not in XI. Please tell me.

Can you tell me the steps to generate proxy. I am pushing data from SAP to XI.

I guess I have to generate an OUTBOUND proxy. Please confirm.

Thanks,

Read only

pramod_p
Product and Topic Expert
Product and Topic Expert
0 Likes
2,948

This message was moderated.

Read only

Former Member
0 Likes
2,948

thats great !!

cheers

shivika

Read only

manoj_goyal2
Participant
0 Likes
2,948

I have asked another question.

Read only

Former Member
0 Likes
2,948

Hi there

Yes you need to generate your proxy in SAP through Tcode SPROXY.

Message Interface has to be created in XI by your XI team members else you wont be able to see any interface in sproxy that you can generate.

If they have created a message interface for you , then you simply need to right click on that and it will give you an option to 'Create' your proxy.

And since you are sending data from SAP to XI , it is definitely an outbound proxy.

Does this solve your query?

Cheers

shivika

Read only

0 Likes
2,948

Hi Shivika,

You are lighting fast in giving response.

I have rewarded points to you.

Thanks again.

Read only

manoj_goyal2
Participant
0 Likes
2,948

Resolved

Read only

0 Likes
2,948

hey thanx

lemme know if u have other queries...send me ur email id and i can send u few docs on proxies.

cheers

shivika

Message was edited by:

Shivika Bhorchi

Message was edited by:

Shivika Bhorchi

Read only

0 Likes
2,948

hi:Shivika Bhorchi

thank you for your guide of ABAP SPROXY,now ,i have write the report to trigger the abap sproxy ,but it catch the system error [System Error: System not configured as XI Integration Engine ], i have no idea with this problem ,can you do me a favor to see it ,thank you ! i just using outbound sproxy transfer data from R/3 to XI, thank you in advance !

if you would like ,please add my msn: 1234ming@163.com , i think we can make friends .

Read only

manoj_goyal2
Participant
0 Likes
2,948

Hi Shivika,

Thanks for offering me the docs on proxies. I really appreciate it.

Please send it to me at my email address miniSAP@inbox.com

Also I want to know if I need to call the below method 3 times, if my internal table has 3 records.

  • call the asynchronous method of the proxy and send the data

CALL METHOD lo_senddata->execute_asynchronous

EXPORTING

output = ls_output.

Many thanks again.

Read only

0 Likes
2,948

Hi Mini

You(as in your XI team ) needs to define ls_output as a deep structure .

e.g:

DATA: ls_output TYPE ty_output.

This ty_output has a field X which is a deep structure with lets say another field 'Y' which in turn is a table type . So the hierarchy would be :

ty_output->X(is a field of ty_output with a deep structure)->Y( is a field of X which is a table type of lets say data type string)

Note: XI should define this in your proxy structure when yu generate it.

This Y will then take in multiple records just like a table. You can then send all your 3 records to this table at once and then call the method only once.

e.g : ls_output-X-Y[] = lt_data[] where lt_data has all your 3 records.

Hence you need to call your method only once.

Hope this clarifies your doubt.

Cheers

shivika

Read only

0 Likes
2,948

Hi Shivika,

Thanks for your reply. I am not able to declare the passing structure corrently. I think XI team created a structre of type STURCTURE instead of TABLE TYPE. I am an ABAPER, should I tell XI team to create stucture ZDT_HEIR of type - TABLE TYPE. I will appreciate if you can confirm.

Below I have tried to give the details of parameters passing to method EXECUTE_ASYNCHRONOUS. If it is not clear then please send me your email address to minisap@inbox.com and I will send you the screen shots.

zMT_HEIR is an OUTPUT Method parameter of method EXECUTE_ASYNCHRONOUS.

Double click on zMT_HEIR.

Structure: zDT_HEIR

CONTROLLER PRXCTRLTAB (DATA TYPE – table type) MT_HEIR zDT_HIER1 (DATA TYPE – Structure)

Double click on zDT_HEIR1.

Structure: zDT_HEIR1

CONTROLLER PRXCTRLTAB (DATA TYPE – table type) zMD_HEIR ZDT_HEIR (Data type – Structure)

Double click on zMD_HEIR.

Structure: zMD_HEIR

CONTROLLER PRXCTRLTAB (DATA TYPE – table type) zfield1 (Data type – STRING)

Zfield2 (Data type – STRING)

Declaration:

data: ls_output type zMT_HEIR.

ls_output-MT_HEIR-zMD_HEIR[] = gi_outdata[].

gi_outdata is an internal table with 3 records.

Many thanks,