cancel
Showing results for 
Search instead for 
Did you mean: 

Same sender Filename for the receiver ZIP output

Former Member
0 Kudos

Hi Experts

Currently i have a scenario where PI need to pick File from Sender folder and transfer (pass through or Binary transfer) to SFTP adapter(Advantco). I need to pick the file and zip it at the receiver place in the SFTP server. I am using AF_Modules/PayloadZipbean module for zip but i need the same filename as the sender in the receiver zip file name. So please suggest me how can i get the same file name. I am not using any IR objects for the interface. Can it be done with Standard without any custom modules.

Thanks&Regards

Rajesh Marupaka

Accepted Solutions (0)

Answers (2)

Answers (2)

subhro_de
Active Participant
0 Kudos

Hi Rajesh,

In general  custom adapter module is used to handle this - guidance can be found in the link below -

http://wiki.sdn.sap.com/wiki/display/xi/adapter%20module%20pi%207.0%20set%20attachment%20name?bc=tru...

Although not an excellent way of doing this  in mapping unless needed  but you may want to try out the following approach if it suits you :

1) Add a Operation Mapping with dummy interfaces and Java Mapping to your scenario

2) The zipping of the file is done in the Java mapping  which can be coded in the following lines :

import java.util.zip.ZipEntry;

import java.util.zip.ZipOutputStream;

.........

..........

  byte[] buffer = new byte[1024];

  ZipOutputStream zos = new ZipOutputStream(os);

  ZipEntry ze= new ZipEntry("filename");

  // os - outputstream in your mapping

  // in - inputstream in your mapping

  // retrieve the sender filename from DynamicConfiguration and put it above in place of filename.

  zos.putNextEntry(ze);

.......

    int len;

    while ((len = in.read(buffer)) > 0) {

                   zos.write(buffer, 0, len);

     }

     in.close();

     zos.closeEntry();

     zos.close();

......

Regards

Subhro

ambrish_mishra
Active Contributor
0 Kudos

Hi Rajesh,

AFAIK, this is not possible.

Please also check the thread

http://scn.sap.com/thread/759529

Ambrish