cancel
Showing results for 
Search instead for 
Did you mean: 

Mail to File: Attachment is not getting picked

Former Member
0 Kudos

Dears,

I have configured a Mail to File Scenario: Where PI will read email and pick the first attachment (.PDF File) and place it on File Server, however some times it is not picking the attachment and not placing it on File server.

Case1: In this case, it is working perfectly... the PDF file 145-2015.pdf is placing on file server

Case2: In this case, the attachment is not placing on File server. DECORP F221.pdf file not placing on File server

Your help need to solve this issue...

Thanks-
Rams

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member187010
Participant
0 Kudos

Hi Rams G,

Had experience similar issue in the past.

In my case when I send the same mail to the mailbox again , for which it skips at first time, it process successfully.

It was really very difficult to trace which all mail it was skipping to extract the payload and it was creating high priority issue from business side. We tried almost everything testing with different encoding format, different browser to access mail server, single attachment -multi attachment etc etc.

We raised OSS message to check the issue, on comparing the PI trace log for successful and unsuccessful one(as suggested by SAP) , found that attachment information was missing in the log which was causing the issue and they suggested to check with the mail box administrator for the logs at their end.

But unfortunately all this process took a long time and I moved to another assignment by that time. So not sure about the current situation. Couldn't remember any similarity between your highlighted processing log and mine processing log.

Regards

Former Member
0 Kudos

Hello Jitender,

I am facing the same issue, when i resend the same attachment from mail to the mail box then PI is able to pick the attachment and placing it on FTP.

Don't know why PI is unable to pick the attachment from the first email (which sent by user). It is writing the attachment in a different file (the file name is 'Interface Name') and placing it on FTP.

It is very difficult to me to understand the root cause of this issue 😞

Can any other expert could help to get the root cause??

Thanks-
Rams

former_member182412
Active Contributor
0 Kudos

Hi Rams,

Both success and failure messages got content type in dynamic header, So why don't you implement java mapping which i suggested above to resolve this issue.

I think some how PI is not receiving the content description and it could be problem in mail server side.

Regards,

Praveen.

Former Member
0 Kudos

Dear Experts,

Can any one could help me to identify the issue?

In rare cases, the Content-Description field value is missing in the 'DynamicConfiguration' and hence it is affecting to place the Mail Attachment on File server.

I need to identify the root cause for this issue and rectify the error.

Thanks in advance.

Regards,
Rams

Former Member
0 Kudos

Dear Experts,

Can any one of you could help me to identify the exact root cause of the issue?

Thanks in advance!!!

Regards,
Rams

former_member207892
Participant
0 Kudos

Hi Ram,

Looks like the file DECORP F221.pdf has space in the filename and may not be storing in the file location.

Can you please check this attachment 145-2015.pdf  with some while space in the filename like 145 2015.pdf? and if you are getting same error then probably that could be the reason.

let me know once checked if you see any more issues.

Thanks!

Praveen

former_member182412
Active Contributor
0 Kudos

Hi Rams,

You can use below java mapping to get the attachment file name from content type of attachment.


public class GetAttachmentName_JavaMap extends AbstractTransformation {

  @Override

  public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput)

  throws StreamTransformationException {

  try {

  InputStream inputStream = transformationInput.getInputPayload().getInputStream();

  OutputStream outputStream = transformationOutput.getOutputPayload().getOutputStream();

  DynamicConfiguration conf = transformationInput.getDynamicConfiguration();

  DynamicConfigurationKey KEY_FILE_NAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File",

  "FileName");

  DynamicConfigurationKey KEY_CONTENT_TYPE = DynamicConfigurationKey.create(

  "http://sap.com/xi/XI/System/Mail", "Part[1].Content-Type");

  String contentType = conf.get(KEY_CONTENT_TYPE);

  Pattern p = Pattern.compile("\"([^\"]*)\"");

  Matcher m = p.matcher(contentType);

  String fileName = null;

  while (m.find()) {

  fileName = m.group(1);

  }

  conf.put(KEY_FILE_NAME, fileName);

  byte[] b = new byte[inputStream.available()];

  inputStream.read(b);

  outputStream.write(b);

  } catch (Exception e) {

  throw new StreamTransformationException("Exception: " + e.getMessage(), e);

  }

  }

}

And then you can remove DynamicConfigurationBean and variable substitution from receiver file communication channel, Enable adapter specific message attributes and select the file name, in the File Name Scheme you can use %FileName%.

Regards,

Praveen.

Former Member
0 Kudos

Hello Praveen,

As i said on earlier replies, it is picking the file even there is space on file name.

Thanks-

Rams

Former Member
0 Kudos

Hello,

I have identified that 'Content-Description' is not populating in the un-successful case because on File Receiver Adapter, i have used 'Content-Description' for the File Name as shown on below screen shot...

However i need to identify why the 'Content-Description' is missing in some cases...

This is the reason the attachment is unable to place it on File System...


Could any one of help me to identify the root cause?


Thanks-
Rams

0 Kudos

Please use PayloadSwapBean.

BR,
Varsha.

former_member181985
Active Contributor
0 Kudos

Hi Rams,

In case2, looks like a space in file name creating an issue. And as you know in general space is a valid character for FileName, however the issue might be happening within standard adapter/moudule code.

Try to rename space with _ or - etc.. for filename and see how it goes

Please also provide your configuration details how you are fetching filename etc..

Best Regards,

Praveen Gujjeti

Former Member
0 Kudos

Dear Praveen,

The issue is not on space it seems as some other files with space are placed on File serve (for instance Facture 1425786.pdf)

Please note that, as per the current configuration, PI Mail adapter will pick all the attachments from email however it is considering the first attachment only for the replication...

Actually I need to pick all the attachments and replicate but i don't know how to do it... 😞

Please find my Sender Mail Adapter Configuration below...

thanks-

Rams

Former Member
0 Kudos

Hi Praveen,

I have used following blog to configure the scenario...

Thanks-
Rams

former_member181985
Active Contributor
0 Kudos

Hi Rams,

One option would be to zip all attachments during (Java) mapping as I have described @ . Using same Java Mapping with small change, you could also set the zip file as main payload instead of a new attachment. This way you can avoid payload swap bean and other modules in channel configuraiton

And use some OS level script in receiver file channel to unzip

Best Regards,

Praveen Gujjeti

RaghuVamseedhar
Active Contributor
0 Kudos

Hi Rams,

Please try these parameters for PayloadSwapBean (please remove Payload-Name parameters).

swap.keyName     Content-Type

swap.keyValue     application/pdf


Adding PayloadSwapBean - SAP Library