on 05-28-2009 2:48 AM
I implemented a file upload and download function in webdynpro abap.
but I think it's too heavy if there's no compression function.
So I've been searching the function but i couldn't find it.
is there anybody who knows the function?
thank you for reading.
Hi Jong,
I haven't yet worked on this kind of requirement. But there are quite a few classes for zipping & unzipping files. Am pasting them below for you.
CL_ABAP_GZIP Class for (De)Compression (GZIP)
CL_ABAP_GZIP_BINARY_STREAM Class for Data Compression (GZIP, Streaming)
CL_ABAP_GZIP_TEXT_STREAM Class for Text Compression (GZIP, Streaming)
CL_ABAP_UNGZIP_BINARY_STREAM Class for Data Decompression (UnGzip, Streaming)
CL_ABAP_UNGZIP_TEXT_STREAM Class for Text Decompression (UnGzip Text Streaming)
CL_ABAP_ZIP Zip Utility
CL_GEOCODER_ZIP5GOLD Geocoder for zip5gold database
CL_IGS_ZIPPER Internet Graphics Service: Zipper
CL_RSRD_CONVERTER_ZIP Converts Input Stream into a Zip Document
CL_UMC_ZIP_ITEM ZIP Item
CL_UMC_ZIP_OSTREAM ZIP Output Stream
IF_ABAP_GZIP_BINARY_HANDLER IF for Output Buffer Handler
IF_ABAP_GZIP_TEXT_HANDLER IF for Output Buffer Handler
IF_ABAP_UNGZIP_BINARY_HANDLER IF for Output Buffer Handler
IF_ABAP_UNGZIP_TEXT_HANDLER IF for Output Buffer Handler
Also if you can grab the SAP Press book, "Next generation ABAP Development" by Thomas there are a few pages describing how you can achieve the same. He was explaining about how students could fill in their assignments and upload them to the universities portal. It was in this context that he explained about compression techniques in ABAP. I was kind of lazy and skipped reading that part so am not able to explain it myself.... (I hope Thomas isn't reading this!)
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I solved the problem.
Thanks
Regards,
Jong.
data: lo_gzip type ref to cl_abap_gzip.
data: content type xstring.
data: content_len type i.
************************************************************************************
************************************************************************************
create object lo_gzip.
node_z009 = wd_context->get_child_node( name = 'Z009' ).
node_z009->get_static_attributes( importing static_attributes = l_z009 ).
wd_context->get_attribute( exporting name = 'DATA' importing value = l_z009-data ).
content_len = strlen( l_z009-data ).
lo_gzip->compress_text( exporting text_in = L_Z009-DATA TEXT_in_len = content_len compress_level = 6
importing gzip_out = content gzip_out_len = l_z009-len ).
L_Z009-DATA = CONTENT.
wd_comp_controller->upload( EXPORTING DATA = l_z009-data LEN = L_Z009-LEN ).
**********************************************************************************************************
ANOTHER METHOD
**********************************************************************************************************
DATA: LO_GZIP TYPE REF TO CL_ABAP_GZIP.
DATA: CONTENT TYPE XSTRING.
CREATE OBJECT LO_GZIP.
node_temp_z009 = wd_context->get_child_node( name = 'TEMP_Z009' ).
select * into table lt_temp_z009 from /dogok/009 where id_f = l_z002-id_f and number_f = l_z002-number_f.
LOOP AT LT_TEMP_Z009 INTO L_TEMP_Z009.
CONTENT = L_TEMP_Z009-DATA.
LO_GZIP->DECOMPRESS_TEXT( EXPORTING GZIP_IN = CONTENT GZIP_IN_LEN = L_TEMP_Z009-LEN
IMPORTING TEXT_OUT = L_TEMP_Z009-DATA TEXT_OUT_LEN = L_TEMP_Z009-LEN ).
MODIFY LT_TEMP_Z009 FROM L_TEMP_Z009.
ENDLOOP.
node_temp_z009->bind_table( lt_temp_z009 ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can of course use the CL_ABAP_GZIP or CL_ABAP_ZIP classes to process compressed files from the frontend - but keep in mind that you might not need to actually ZIP the contents. The HTTP protocol automatically uses GZIP based compression during Request/Response transmission. Most data passed back and forth with modern browsers will have transparent compression. You might be able to get slightly better compression ratios by using the a desktop application to ZIP the contents, but the amount will probably be slight.
Hi Jung,
you can check this below code and try to make a zip.
* open (top-)zip-archive
CALL METHOD lo_zip->load
EXPORTING
zip = lv_zip_file_head
EXCEPTIONS
zip_parse_error = 1
OTHERS = 2.
...
* create sub-zip-archives which contain the files you would assign to a folder
...
* add sub-zip-archive to top-zip-archive
CALL METHOD lo_zip->add
EXPORTING
name = lv_zip_filename
content = lv_zip_file.
* save zip-archive
CALL METHOD lo_zip->save
RECEIVING
zip = ev_zip_file.
or it can be done with
created a compressed zip file with two ways that using interface "cl_igs_zipper" and using interface "cl_abap_zip".
or check this thread too..
all the best...
Reagrds,
Mahesh.Gattu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jong,
This is more of an ABAP problem than a WDA one. Anyways.... Based on OSS note 644640 there is a class CL_ABAP_GZIP included in support package 29 for WAS 6.20. If you are in this package level, you can take a look on this class.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.