cancel
Showing results for 
Search instead for 
Did you mean: 

How to Download data in Zip folder

Former Member
0 Kudos

Hello,

In ver. 4.7, I am downloading the data from internal table to CSV (comma delimited) text files (2).

I need to put them into ZIP folder (both in one folder).

Can anyone suggest me how can I achieve this functionality?

Thanks in advance,

Sajith

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

We have a requirement for the same thing and I've got that to work, however, the client is now requesting that we password protect the zip files.

It seems that each file that is added to the zip must be password protected in order for the zip to be considered password protected.

Any suggestions?

Former Member
0 Kudos

Was this issue ever resolved?

Former Member
0 Kudos

Hi Sajith,

Did the replies help in your solution? If so, don't forget to assign points. I gave them some, but feel free to increase them! Click on the Yellow Star icon in each reply. You can give:

1 10 pointer (solves problem)

2 6 pointers (very helpful)

lots of 2 pointers (helpful)

Thanks!

Joan (and Mark Finnern)

ssimsekler
Active Contributor
0 Kudos

Hi

It should be OK to give the filepath parameter same for the two files. However, if you mean to zip two files into one zipped archive, then you can call "GUI_EXEC" to call WinZip. WinZip offers command line interface with "WinZip Command Line Support Add-On" which is downloadable from http://www.winzip.com/wzcline.cgi .

*--Serdar

Former Member
0 Kudos

I forgot to mention one thing. We have to download this file to UNIX server. Can you please guide me in this?

Regards,

Sajith.

ssimsekler
Active Contributor
0 Kudos

Hi Sajith

Two solutions:

1. Zipping files at the presentation server and then putting them to application server using "OPEN DATASET" "CLOSE DATASET" statements. You can have more information from SAPHelp (F1). This way cannot be used if you want background processing.

2. I am not so accustomed to UNIX but as far as I know, you can define OS commands at SAP and execute. Then, you will not need presentation layer. Save your files to the application server via "DATASET" commands and use zip utilities existing at UNIX.

*--Serdar

Former Member
0 Kudos

Hi,

to add to the suggestions above, after you create the text file in the app server using OPEN/CLOSE Dataset, you can call a UNIX script to perrform the zipping (via ZIP utility) of the files inside your source folder. Your UNIX script can also create a log file which you can read via ABAP as a return code for success/failure of the zip operation.

Cheers,

Kelvin

ssimsekler
Active Contributor
0 Kudos

Hi

If we have the zipping utility at UNIX, then the second way will be OK. So, the procedure should be:

1. Download the files to the application server. (This was explained before. As an addition, function modules <b>"C13Z_FILE_UPLOAD_BINARY"</b> and <b>"C13Z_FILE_DOWNLOAD_BINARY"</b> can be used if you have them.)

2. Call the UNIX script. It is possible to define external OS commands via the transaction <b>"SM69"</b>. There, you can define a UNIX command line that will do the zipping task. Then, you can execute the command by using the FM <b>"SXPG_EXECUTE_COMMAND".</b> Moreover you can schedule that external command to be executed at background using the transaction <b>"SM36"</b>.

I would like to learn whether this process works...

*--Serdar

Message was edited by: Serdar Simsekler

Former Member
0 Kudos

Hello,

Thank you very much for the solutions provided. Now, some details on how I achieved the needed functionality.

1. I downloaded the files on the Application server using OPEN/CLOSE DATASET. Here, the internal table given should have all the fields with datatype as C.

2. Using the following UNIX command, I zipped the files.

gzip file1 file2

    • we need to give the complete filepaths as per Unix.

This command was put in a variable w_folder_z.

The following command was used.

CALL 'SYSTEM' ID 'COMMAND' FIELD w_folder_z

ID 'TAB' FIELD i_result.

Here, i_result is the internal table with single field of char 100 type.

And when the files are successfully zipped, the SY-SUBRC value is 1-.

The files can be opened by unzipping.

ssimsekler
Active Contributor
0 Kudos

Hi Sajith

It is good that your problem has been solved. You've used the way to call kernel function which is in fact not recommended. But if it applies good, it's OK.

*--Serdar

Former Member
0 Kudos

Hi Sajith Hari,

I have a similar requirement and I request you to please explain more clearly about the 2 nd part of the solution i.e How do we put the UNIX command and call it from SAP.

You posted the following:

Using the following UNIX command, I zipped the files.

gzip file1 file2

    • we need to give the complete filepaths as per Unix.

This command was put in a variable w_folder_z.

The following command was used.

CALL 'SYSTEM' ID 'COMMAND' FIELD w_folder_z

ID 'TAB' FIELD i_result.

Nut its nor working for me.

Thanks

Dan

Former Member
0 Kudos

Hi Hari,

Please provide code for zip the files on the application server.

it is very urgent.

Regards,

Subbarao