Skip to Content

Need the same attachment name in the receiver side (REST to SFTP scenario)

Hi Experts,

I working a requirement where i need to send the attachment along with the message payload. My scenario is REST to SOAP. I tried below blogs and the code.

https://archive.sap.com/discussions/thread/3722207

https://archive.sap.com/discussions/thread/3956705

UDF code:

  1. String attachmentID =null;
  2. GlobalContainer globalContainer = container.getGlobalContainer();
  3. InputAttachments inputAttachments = globalContainer.getInputAttachments();
  4. if(inputAttachments.areAttachmentsAvailable())
  5. {
  6. Collection<String>CollectionIDs= inputAttachments.getAllContentIds(true);
  7. Object[] arrayObj =CollectionIDs.toArray();
  8. attachmentID =(String)arrayObj[0];
  9. Attachment attachment = inputAttachments.getAttachment(attachmentID);
  10. int attachmentsize = attachment.getContent().length;
  11. return"Attachment Name : "+attachmentID +" Attachment Size : "+attachmentsize+" bytes";
  12. }
  13. else{
  14. return"no attachment found";
  15. }

I am not able to get the same attachment name in the receiver and format too.

My source attachment name is : 2365727_E_20181219.pdf and

Target attachment name i am getting is like this. cid%3Aatt-43c91c58158811e9aeb9000000622a47@sap20190111-100422-352.com.

Please help on fixing in this issue.

Thanks in Advance.

Pavan T

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jan 22 at 08:20 AM

    Hi Pavan,

    Try to use Multipartheaderbean to poulate all the message header values in the PI message header. This will also hold the attachment names and then use a UDF to grab the value from that header using DynamicConfiguration.

    https://help.sap.com/saphelp_nwpi711/helpdata/en/fd/66f50ac8d84babaa111c033f411f3d/frameset.htm

    Thanks

    Sugata

    Add comment
    10|10000 characters needed characters exceeded