on 09-13-2013 9:38 AM
hi all,
i have a scenario where i have to read 2 files merge them and send to traget
I am using additional files option and reading both file .one is coming as main payload and other as attachment .
how can i read this attachment and merge with first file and send it to taget?
Hi Sahana,
I don't think we can read attachments in message mapping. You can write a java mapping to read the attachement and merge it into the main payload.
Below is the Transform method to merge attachments to mainpayload:
public void transform(TransformationInput in, TransformationOutput out)throws StreamTransformationException
{
try
{
InputAttachments ia=in.getInputAttachments();
Collection<String> attachnames=ia.getAllContentIds(false);
Iterator<String> itr = attachnames.iterator();
while(itr.hasNext())
{
String name=itr.next();
Attachment atth = ia.getAttachment(name);
out.getOutputPayload().getOutputStream().write(atth.getContent());
}
}
catch(Exception e)
{
throw new StreamTransformationException("Error in java mapping:"+e.getMessage());
}
}
Thanks,
Anand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sahana,
Did you check the following blog & doc that may help you to write udf:
http://scn.sap.com/docs/DOC-26528
or other option is that if you have text files and want to append at the end of the other file
then you can use append mode in Receiver side while creating a file in CC.
Regards
gagan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
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.