on 05-22-2012 11:36 PM
Hi experts,
AS IS, without SAP ERP and SAP PI, my scenario extracts some data from a DB (a stored procedure) and writes two files that are, then, compressed into a zip file.
Now, the TO BE, with SAP ERP and SAP PI, my scenario will be ABAP PROXY -> PI -> and 2 FILE. Until now I have done the first part, so I have extracted the data from the ERP and I have sent it to SAP PI that writes to separates files into a folder (that we will call, to simplify, A.TXT and B.TXT).
I have tried to zip both into one zip file in two way:
- Using the AF_Modules/PayloadZipBean: but no way, this module can only zip every single file, with a 'bad name' inside every single zip file (Maindocument)
- Using some OS Commands: but I can't ... maybe I haven't found the right command ...
So, this is my goal:
- take two files from a folder and compress them into one zip file
- And, if it's possible, maintain the original names of each file into the zip file (not like Maindocument)
I think to be near the solution but maybe I lost some details that are importants to reach my goal, so I need your help
Thanks,
Antonello
Hi Antonello, Did you got the solution for this, even i have same requirement. Please assist Regards, Swapna.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I ad same issue and resolved it with os command in file channel.
I have created a .sh file on server and run it in os command
cd /usr/sap/folder zip batch.zip *.csv
Thanks
Shivi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Antonello,
If we can make one file as an attachment and another as Main Payload then they can be zipped together as Single file. But it will be bit complex development.
Thanks,
Sunil Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Antonello,
You can zip all payloads with PayloadZipBean using the following attribute:
zip.Mode zipAll
Unfortunately, I think you can only set the name of the file created for the main payload:
zip.filenameKey Content-Type: text/plain; name="expected_name.txt"
You can read more on this bean here:
http://help.sap.com/saphelp_nw04/helpdata/en/45/da9358a1772e97e10000000a155369/content.htm
Regards,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Grzegorz,
did you have used before this Module? Because I had used it with the same parameters that you suggests me but the result is: one file zip for each file taken from the sender channel, so, in my scenario, two files zip, those are the screens of my files sequence:
Sender:
Receiver:
The folder with the 2 txt files, that are teaken from the sender channel, then the result zip files from the receiver channel.
Did I have mistake something?
Thanks,
Antonello
Dear Antonello,
Just one thing I forgot to ask before. These two files you already create - are they two separate payloads of one PI message, or two completely separate messages? The zipAll option zips all the payloads of one message (the first case). If you want to zip two separate messages, it might be more complicated. Personally, I would split it to two interfaces:
1. The scenario you already have, that creates two files based on the proxy call.
2. File-to-file pass-through scenario (with no mapping involved) that reads both files as one message (with two payloads) using the Additional Files option in sender file channel, and zips them to one zip archive.
Regards,
Greg
The way you suggest me seems to be right but in my case I have 2 files with 2 different names and in the Rules of this option there is one that says:
The way that the files to be transported are grouped together is defined by the file names. All file names must be identical except for a defined part (such as the suffix).
Mmmm ... maybe I can't do this with PI ?
Hi,
Just one more idea: I remember seeing a blog or Wiki on how to zip messages into a file in a Java mapping and then write the .zip file content in binary mode. This should be possible in your case, and moreover should comply to your requirement to set the file names accordingly. The only question that you didn't answer the previous time is, if you create both files based on one message? If yes, then I guess you've got your solution
Regards,
Greg
Hi Kevin,
I have tried what you are suggesting me (if you see just a little bit over your post ) but I use 2 different files with 2 different names, so i catch an error in sender channel because the names are not the same ... but maybe you are right and I mistake something ... this is the rule of the option:
The way that the files to be transported are grouped together is defined by the file names. All file names must be identical except for a defined part (such as the suffix).
This is the Sender channel configuration with the option Additional file/s:
this is the error on the channel after I start it:
Can you help me?
Thanks,
Antonello
Hi Greg,
why not? We can try ... but can you explain just a little bit more what you are saying me?
Now my scenario is like this:
- one outbound Service Interface -> the ABAP Proxy call Async
- two inbound Service Interface -> Clienti and Movimenti
- one multimapping -> Proxy to Clienti and Movimenti
and I create 2 files.
So, as you say me now, I have to collapse Clienti and Movimenti in one Service Interface and split them after with Java Mapping, and then zip them into one file? with the right names of txt files?
Antonello
Hi,
>>> So, as you say me now, I have to collapse Clienti and Movimenti in one Service Interface
Not really, using multimapping should be fine. Just use two consecutive message mappings in your operation mapping:
1. One that you are using so far, with two messages created.
2. Additional Java mapping that will read both payloads into some streams (files) and then zip them into one file.
I've found the doc, by the way: http://scn.sap.com/docs/DOC-3784.
Regards,
Greg
Please go through the below link to zip the multiple files.I think it"ll helpful for you.
http://www.loni.ucla.edu/~esowell/edevel/people/eric/unixcmd.html
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Why are you creating two different files? do you have any condition?
If no condition then you can collect messages and create as a one file (very much possible).
Best Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raja,
why you are wearing two shoes? maybe you can wear only one! 🙂 What kind of question is this? I don't think is the right way to solve the technical problem. The scenario is this, and this will be, because the process, who will takes the files, needs two files to do its job.
Thanks,
Antonello
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.