on 12-23-2016 5:18 PM
Hi Friends,
I have the next integration FTP--> PI-->PROXY SAP
I need Attachment file xlsx from ftp to PROXY.
How I must do this integration on File Sender CC for attachment the xlsx file ?
Help Me Friends.
Regards
Brians,
The xlsx file can be picked as an attachment only if u mention it under "Additional File" section , so you need two files one the main payload which is picked and another xlsx.
In Case if u have just xlsx file alone then pick the file as a mainpayload then in mapping use java mapping to make the incoming mainpayload as attachment to outgoing payload.
A bit of code is as below.
try{
GlobalContainer globalContainer = container.getGlobalContainer();
MappingTrace trace=container.getTrace();
byte[]convertedInput=input.getBytes("UTF-8");
OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
Attachment outputAttachment;
String contentType="application/xml";//<could be changed>
DynamicConfiguration conf = ( (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key =DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String fileName = (conf.get(key));
trace.addInfo("filename used for attachment "+ fileName);
outputAttachment = outputAttachments.create(fileName,contentType,convertedInput);
outputAttachments.setAttachment(outputAttachment);
}
catch(UnsupportedEncodingException e) {
e.printStackTrace();
throw new StreamTransformationException(e.getMessage());
}
return "";
Br,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.