Skip to Content
0
Jan 11, 2019 at 10:17 AM

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

89 Views

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