cancel
Showing results for 
Search instead for 
Did you mean: 

ZIP FileName (Additional Files)

04-21-2011 2:41 AM
1026 views 8 comments
0 Likes
SAP Managed Tags
Subscribe

Hi, My sender FTP channel picks two files Main& Additional file suing adavanced options and zips it using Payloadzipbean and writes to the target without any mapping,however the name inside the zipped file is "MainDocument & File"

How can i get the original file name as in the source directory inside my zipped file? I think I need a module for this but not sure how to access the source filenames inside the module any help would be greatly appreciated.

Thanks,

0 Likes

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Likes

Thanks Ryan, as i cannot attach the screenshot here is how the soap header looks..

<Inbound Message>
<Soap Header>
<Soap Body>
<Payloads>
     MainDocument (application/xml)
     <File> (application/xml)
<Receiver Identification >

The two payloads when doubleclicked opens up the pdf documents, The dynamic Configuration contains the name of the Main Document i.e..

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <!--  Inbound Message 
  --> 
- <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
  <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">601070461-601070461-WB.pdf</SAP:Record> 
  </SAP:DynamicConfiguration>

Now when I use PayloadZipBean in my reciever File adapter the zip file is written as

Output.zip->when Unzipped>MainDocument &_File_ , with no extensions.

I have tried to include a custom module before PayloadZipBean to set the ContentType of the MainDocument and gave the parameter zip.filenameKey = contentType ,but still the Archive filename in the zip file does not change.

Kindly let me know if you need further info..struggling wid this ) i could send the screenshots to ur mail(if u ok to provide)

Many Thanks,

Ryan-Crosby
Active Contributor
0 Likes

The dynamic configuration doesn't contain the names for each file? If not, then you wouldn't be able to achieve this with an adapter module alone. In that case it would be simpler to run a UNIX script on the receiver side to zip the files at the OS level.

If you must go the route of using an adapter then I think your only option would be to include a java mapping which inserts all the file name data into the payload such that each payload has a file name key that you can then use in your custom adapter module. It would be a lot easier to do the UNIX script however to zip the files up on the OS side if you can.

Regards,

Ryan

Former Member
0 Likes

Hi I have followed the code in the below thread to dynamically change the name of the Zip Archive file as in ASMA, i have used this module before my PayloadZipBean, however the CC throws an error saying Null. no firther info on the CC.???

Could you help me with the code to zip two files and set the file name as per ASMA,(plz not i am using 'Additional File' so there are two payloads one as Main and other as <file>

really appreciate your help.

Thanks

Ryan-Crosby
Active Contributor
0 Likes

Hi,

Can you attach the key pieces of the payload including the SOAP header information which shows the filename information? I'm not sure how it gets structured but that is key in knowing what needs to be done in the module. No need to include the entire payload but the tags are important.

Regards,

Ryan

Edited by: Ryan Crosby on Apr 26, 2011 9:12 AM

Former Member
0 Likes

Hi,

If u want dynamic filename, then its not possible without implementing an adapter module.

and for static filename, you can set the name with help from MessageTransformBean.

Chk this blog :-

/people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework

In PayloadZipBean you find the parameter zip.fileNameKey's Content type that will have filename of original file ,try using Dynamic configuration in UDF to meet ur req.

Chk the below links for the above :-

http://help.sap.com/saphelp_nw04/helpdata/en/45/da9358a1772e97e10000000a155369/content.htm

/people/sravya.talanki2/blog/2006/12/20/accessing-system-parameters-in-mapping-runtime

/people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions

Chk this blog for Dynamic name in the mail attachment :-

/people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution

/people/francesco.bersani/blog/2007/03/27/rename-attachment-adapter-module

hope it will help u

Regards.

Rohit

Former Member
0 Likes

Thanks Ryan, Infact i do not want to merge it into a single filename, the requirement is to retain the original two filenames

for eg :

Source files : abc_123.pdf & abc_234.pdf

files picked by cc as one main and another as Additional with comman file.namepart as "abc"

after zippind expected outcome :file.zip--->abc_123.pdf & abc_234.pdf

currently the outcome is : file.zip--> mainDocument & file.

Hope i was able to explain my case..thanks much

Ryan-Crosby
Active Contributor
0 Likes

I misunderstood the problem before, but you'd have to write your own adapter module to handle the naming for both files inside the zip archive. The PayloadZipBean doesn't allow (at least that's my understanding from the help) for you to designate the file names inside the compressed file. You'd have to write an adapter that does two things... getting all the names you need and the zipping process itself. The code for getting a file name is very simple but it may be a little more complex with more than one file. If you need the sample code for getting the file name I can help...

Regards,

Ryan

Ryan-Crosby
Active Contributor
0 Likes

A module would be the answer but before I supply the answer I have one question... How do you propose to merge two different file names (a main document and a file) into one file name?

Regards