cancel
Showing results for 
Search instead for 
Did you mean: 

Attachment in ABAP server proxy

Former Member
0 Kudos

Hi,

I have a PI -> ABAP server proxy -> PI scenario. I need to attach a PDF in the response message of the server proxy. Everything seems ok (no exceptions, sy-subrc = 0) but PI don't receive the attachment. I use the following code. What am I doing wrong?

    TRY.
        lo_server_context       = cl_proxy_access=>get_server_context( ).
        lo_attachment_protocol ?= lo_server_context->get_protocol( if_wsprotocol=>attachments ).

        lo_attachment = lo_attachment_protocol->get_attachment_from_binary(
                                 data = ld_pdf
                                 type = ld_type
                                 name = ld_name ).

        APPEND lo_attachment TO li_attachments.

        lo_attachment_protocol->set_attachments( li_attachments ).

      CATCH cx_ai_system_fault INTO lo_oref.
    ENDTRY.

Tranks.

Accepted Solutions (0)

Answers (3)

Answers (3)

engswee
Active Contributor
0 Kudos

Hi Benito

A few things come to mind after looking at your code:

  • Can you share more details on where the ld_pdf, ld_type, ld_name is coming from?
  • There is no exception handling logic after the CATCH statement. It is possible that there was some exception raised within the TRY body but since nothing happens in CATCH, it just continues processing.

Have you tried debugging the proxy to step through whether the creating of the attachment from PDF data and setting it to the message works?

Rgds

Eng Swee

iaki_vila
Active Contributor
0 Kudos

Hi Benito,

I'm sorry i didn't read your question propperly. First of all, you should figure out if the attachment is reaching your ECC system. Please, enable the monitoring in your ECC system (like the ABAP monitoring in PI ABAP stack), and check if the attachment is reaching your ECC system or the attachment is being lost in PI.

Regards.

iaki_vila
Active Contributor
0 Kudos

Hi Benito,

I don't see in your code when you call to PI, check Michal's code here

Regards.

Former Member
0 Kudos

Hi Iñaki,

Michal's example is a proxy client, not a proxy server. In my case it's PI who calls my proxy code, not vice versa. I just need to fill the output structure and attach the PDF, no need to call anything.

Regards.