cancel
Showing results for 
Search instead for 
Did you mean: 

Sync ABAP Server Proxy - Attachment in Response possible ?

szymon_bolek
Participant
0 Kudos

Hi I need to send an attachment in a synchronous ABAP Server Proxy.

I proceeded as follows:

1. design sync inbound interface in PI

2. generate abap server proxy

3. implement this abap proxy

4. tried to attach file to response like this:


    data server_context type ref to if_ws_server_context.
    data attachment_prot type ref to if_wsprotocol_attachments.
    data attachment          type ref to if_ai_attachment.
    data attachments         type prx_attach.
    data lo_protocol         type ref to if_wsprotocol.
    data lo_payload_protocol type ref to if_wsprotocol_payload.
    try.
        server_context = cl_proxy_access=>get_server_context(
               ).



        attachment_prot ?= server_context->get_protocol( if_wsprotocol=>attachments ).
        attachment = attachment_prot->get_attachment_from_binary(
            data       = lv_xdata
            type       = if_ai_attachment=>c_mimetype_pdf
            name       = 'my attachment'
               ).
        append attachment to attachments.
        attachment_prot->set_attachments( attachments ).
      catch cx_ai_system_fault .
        output-mt_get_documents_resp-fault-fault_text = 'cx_ai_system_fault'.
        output-mt_get_documents_resp-fault-fault_url = 'ERR001'.
    endtry.

However I cannot see any attachment in the response.

Q1: is it possible at all to create attachments in sync server abap proxy?

Q2: if it is, what is wrong with my coding?

cheers

simon:)

Accepted Solutions (0)

Answers (1)

Answers (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>> is it possible at all to create attachments in sync server abap proxy?

Yes, it is 100 percent possible

Refer this blog for Q1 and Q2

/people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments

Thanks

Baskar

szymon_bolek
Participant
0 Kudos

Baskar,

Yes thank you I did see this blog already. However it is commenting asynch communication initialized by NW application server.

I am talking about sync communication initialized by 3rd party system calling ABAP proxy and giving a response. To this response I would like to attach a file.

best regards

simon:)

Former Member
0 Kudos

I have the same issue. Any help on this would be great

stefan_grube
Active Contributor
0 Kudos

Working with attachments in server proxies has to be coded differently compared to client proxies and there is no code sample or other hint in online help.

I recommend to open an OSS ticket for this, as someone from SAP should enhance the online help.

Sorry, I do not have a code sampe.

Former Member
0 Kudos

Hello,

I found your message, I have the same problem than you.

I want send an attachments in response in synchronous proxy, I wrote code similar than you, but, I can't see the attachment too.

Can you resolve the error?

Thanks in Advance!

szymon_bolek
Participant
0 Kudos

Veronica,

Unfortunately, this was not possible, due to the system EHP state.

First after upgrade this functionality will be possible ( ECC 6.0 EHP5 - corresponding to NW AS EHP2 )

For an example, as Stefan pointed out, you might want to open OSS if your system is up-to-date and you need one.

best regards

Simon:)