on 08-30-2013 5:40 PM
Hi,
We have a proxy to file scenario. The data is coming from ECC and we have to send it to a target system via SFTP adapter. An attachment will be sent through the ABAP proxy which will contain flat files. So our goal is to somehow send the attachments to the target system and drop it to their SFTP server. I know about the payloadswapbean which can be used in the email adapter. My question is can it be used in the file adapter as well ?
Also, in my scenario should the payloadswapbean reside on the target side i.e on the file adapter ? or on the proxy side ? If it's on the proxy side how do I achieve this - as there is no communication channel for a proxy ?
Any thoughts/ suggestions?
Thanks.
Hi,
Yes you are in right direction, use payloadswapbean in receiver SFTP file channel with correct entries to swap the payload with attachment.
Regards,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venakta,
Read attachment name via mapping and set FileName via same mapping using Dynamic Configuration code.
Sample code to attachment name
String attachmentID = null;
AbstractTrace trace;
//gets the input attachment from the source message
GlobalContainer globalContainer = container.getGlobalContainer();
InputAttachments inputAttachments = globalContainer.getInputAttachments();
trace = container.getTrace();
ry
{
//checks for the availability of attachments in the input message
if(inputAttachments.areAttachmentsAvailable())
{
trace.addInfo("Attachments Available");
//gets the attachmentIds and store it in an Object array
Collection<String> CollectionIDs = inputAttachments.getAllContentIds(true);
Object[] arrayObj = CollectionIDs.toArray();
//Loops at the input attachments to get the content of the attachment
for(int i =0;i<arrayObj.length;i++)
{
attachmentID =(String)arrayObj[i];
trace.addInfo((i+1) + ") Attachment Name: " + attachmentID);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
//Use above attachmentID value to set File Name using Dynamic configuration code
return "";
Regards,
Praveen Gujjeti
Hi Praveen,
It's not picking the attachment name from the above code. I am getting the value as null.
Does ContentID contain the filename ?? Below is the code that I tried. I have assigned the output of the UDF to the root of the target message, just like we do for regular Dynamic config scenario and checked the ASMA flag in the receiver file channel. I have also tried %FileName% in the filename schema, although that shouldn't matter. Any suggestions ???
String attachmentID = null;
AbstractTrace trace;
//gets the input attachment from the source message
GlobalContainer globalContainer = container.getGlobalContainer();
InputAttachments inputAttachments = globalContainer.getInputAttachments();
trace = container.getTrace();
try
{
//checks for the availability of attachments in the input message
if(inputAttachments.areAttachmentsAvailable())
{
trace.addInfo("Attachments Available");
//gets the attachmentIds and store it in an Object array
Collection<String> CollectionIDs = inputAttachments.getAllContentIds(true);
Object[] arrayObj = CollectionIDs.toArray();
//Loops at the input attachments to get the content of the attachment
for(int i =0;i<arrayObj.length;i++)
{
attachmentID =(String)arrayObj[i];
trace.addInfo((i+1) + ") Attachment Name: " + attachmentID);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
//Use above attachmentID value to set File Name using Dynamic configuration code
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create( "http:/"+"/sap.com/xi/XI/System/File","FileName");
String newfile= attachmentID+".csv";
conf.put(key,newfile);
return newfile;
Yes, that seems the issues. Thanks a lot
However, the file name that I am getting is
cid:payload-d9dd4b7417db11e390bd0000122886db@sap.com
The contentID doesn't seem to reflect the filename. Is there any other method in the API that we can use to get the file name ?
Thanks a lot for your assistance.
Hi ,
I have an issue while sending a pdf file from proxy to sftp. To read the file attachment i have manintained a proxy structure with filename as field and i have used UDF to read the file name. The SFTP server needs only PDF file but when ever the ECC trigger a message the SFTP server is receiving both PDF and XML structure which i have mainted to read the filename in PI.
User | Count |
---|---|
83 | |
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.