Entering content frameProcedure documentation Querying Attachments at the Receiver Locate the document in its SAP Library structure

Procedure

Using the controller object method get_attachments() you can fetch attachments on the receiver side:

data: lt_attach    type prx_attach,
      l_name       type string,
      l_xstring    type xstring,
      l_string     type string,
      l_type       type string,

      l_attachment type ref to if_ai_attachment.

lt_attach = controller->get_attachments( ).

loop at lt_attach into l_attachment.

    l_type = l_attachment->get_kind( ).

    if l_type = IF_AI_ATTACHMENT=>C_ATTACH_TYPE_BINARY.

       l_name = l_attachment->get_document_name( ).
       l_xstring = l_attachment->get_binary_data( ).

* Do whatever you want with your binary attachment

    else.  " l_type eq IF_AI_ATTACHMENT=>C_ATTACH_TYPE_TEXT.

       l_name = l_attachment->get_document_name( ).
       l_string = l_attachment->get_text_data( ).

* Do whatever you want with your text attachment

    endif.

endloop.

This graphic is explained in the accompanying text

Once you have fetched the input message attachments, you can set attachments for the output message in the synchronous case, using set_attachments (). Since only one controller object exists for the inbound interface, you overwrite the attachments of the input message. If you do not want to return any attachments, call the method reset_attachments(), so that the system deletes received attachments and does not return them.

 

 

 

 

Leaving content frame