on 06-03-2013 12:24 PM
Hi Experts,
I have a file to mail scenario in SAP PI 7.31 in which I have to pick multiple files of different types like XML and CSV
and send these as attachments in a single mail to the client with same filenames as attachments. The requirement is, the file adapter should pick the two files which is having the same name but with different extensions. Should I have to use Java Mapping? If so, please help me out with your replies.
EXAMPLE:If I am sending two files namely apple.xml, apple.csv then, the file adapter should pick the two files. If we give the two files as apple1.xml and apple2.csv even then the file adapter should pick the two files. The received mail should also show the same names in the attachments accordingly.
You can use Sender File Adapter with additional files option
http://chizztectep.blogspot.ru/2013/01/sender-file-adapter-with-additional.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Artem,
Thanks for your reply.Actually i have to set the name of the attachments dynamically as the same name of the files I am sending ...so whether i have to use a java mapping or is there any module avilable for achiving this ...
I used the following java coding but,it s not setting the name dynamically
public class Dfilename extends AbstractTransformation {
public void transform(TransformationInput in, TransformationOutput out)
throws StreamTransformationException {
// TODO Auto-generated method stub
Collection<String> contentid=null;
if(in.getInputAttachments().areAttachmentsAvailable())
{
contentid=in.getInputAttachments().getAllContentIds(true);
}
for(String id:contentid)
{
Attachment attachment=in.getInputAttachments().getAttachment(id);
byte[] content=attachment.getContent();
String contenttype=attachment.getContentType();
out.getOutputAttachments().setAttachment(out.getOutputAttachments().create(id, contenttype, content));
}
} }
Have a look at this following link
http://www.java-tips.org/other-api-tips/javamail/how-to-send-an-email-with-a-file-attachment.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.