11-28-2005 4:41 PM
Hi all,
I have an internal table with some lakhs of records. I am sending that data as an attachment in the mail. Now my mail server has a restriction on the size of file that is sent. So i need to ZIP the data in the internal table before sending it. Is there any function module to do this.
Thanking you'll in advance.
Arul Jothi
11-28-2005 4:50 PM
11-29-2005 4:16 AM
Hi all,
Thankx for ur reply.
I have the data in the internal table. I am using the standard function module SO_DOCUMENT_SEND_API1 to send that internal table data as attachment to a mail receipient. Now before sending the mail i need to compress the data in the internal table.
I must not store that data in the application server.
Arul Jothi
11-29-2005 7:48 AM
Hi,
Use extract dataset instead of itab.
The data will be saved in a compressed form in extract dataset..
Regards,
Abdul
11-29-2005 11:52 AM
>I must not store that data in the application server.
The example I gave using CL_ABAP_ZIP does not store the data on the application server. When you call method save, the data is only returned as a binary string.
If you have data in an internal table, you probably want to turn it into a single string. You can loop through the internal table and concatenate each row together separated by CL_ABAB_CHAR_UTILITIES=>CR_LF. This single string can then be compressed by CL_ABAP_ZIP.
11-29-2005 11:53 AM
11-28-2005 5:41 PM
You are going to need to create a ZIP binary stream in memory before you attach it to the mail. You can use the classes CL_ABAP_GZIP, however these only offer compression - not the headers and package information that a client application will need to open the ZIP file.
In recent support packages of WebAS 620 and 640 there is a class called CL_ABAP_ZIP (what release are you on?). This class can create the datasteam that a client application will understand (including the CRC check).
data: zip type ref to cl_abap_zip.
create object zip.
...
zip->add( name = <wa_dir>-filename
content = content ).
...
data: zip_results type xstring.
zip_results = zip->save( ).The CL_ABAP_ZIP class returns its content as a binary string. You can reformat this single binary string to a binary internal table (better for passing to any of the email functions as an attachment) using the following function module:
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = zip_results
tables
binary_tab = <wa_doc>-content_hex.
11-28-2005 5:44 PM