Skip to Content
avatar image
Former Member

how to read attachment data in mapping


In my scenario I receive an XML file with another file as attachment. I need to map both the content of the XML file and the attachment to the target which will be sent as an attachment in a mail.

I have used JavaMapping and I'm now able to send the mail with the attachment. But i'm not sure how to read the contents of the attachment in the mapping.

Any help would be appreciated.



Edited by: Bhargav Srinadh Gundabolu on Feb 12, 2009 10:03 PM

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Feb 13, 2009 at 12:11 AM

    You will not be able to read the attachment in mapping unless u use the payloadswap been. But this would replace your actual payload. If you want both of them in the mapping, you need to write an adapter module which would read both the payload and the attachment and create a sinlge message and sends it to IE. You have to define your message types according to this new XML and use in mapping.


    Add comment
    10|10000 characters needed characters exceeded

  • Feb 14, 2009 at 01:18 PM

    Hi Bhargav,

    if your receiver system is a SAP system with WAS >= 6.20 then you can use a ABAP inbound proxy and create the business logic there. It is quite easy to pick the attachment there: [SAP help: Attachments|]



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 27, 2009 at 08:56 AM

    Hello Bhargav,

    It depends on the version of SAP PI you have,

    Prior to Version 7.1 there was no support to access attachments in a Mapping Programm, so in that

    case the only way to handle it is e.g. to access it in an adapter module (dependent on your scenario).

    In SAP PI 7.1 you can easily access an attachment within a mapping.

    Within a Java mapping program this can be done with the TransformationInput Class, calling the method getInputAttachments() which will give you all available attachments.

    Also see the SAP PI 7.1 javadocs (

    In a graphical mapping you can access attachments within a UDF through the GlobalContainer parameter:

    GlobalContainer globalContainer = container.getGlobalContainer();

    InputAttachments inputAttachments = globalContainer.getInputAttachments();

    With best regards


    Add comment
    10|10000 characters needed characters exceeded