Professional Documents
Culture Documents
ABAP Development
As of Release 6.40 the class CL_ABAP_ZIP is also available to read or create ZIP files.Therefore, if We want to process
compressed files or folders, we must use CL_ABAP_ZIP, as the system creates or reads the headers or trailers required for
file processing here only.
Here is one working sample program. The report sends output to spool and based on spool, spool is converted to PDF, PDF
file is Zipped using CL_ABAP_ZIP and downloaded finally.
REPORT ztest_zip_repoutout.
DATA:g_val TYPE c,
w_pripar TYPE pri_params,
w_arcpar TYPE arc_params,
input_length TYPE i,
content_x TYPE xstring,
content_s TYPE string,
spool_no LIKE tsp01-rqident,
it_pdf TYPE TABLE OF tline WITH HEADER LINE,
wa_pdf LIKE LINE OF it_pdf,
file_tab TYPE STANDARD TABLE OF solisti1,
bin_file TYPE xstring,
bytecount TYPE i,
zip TYPE xstring,
path_table TYPE TABLE OF char1024.
DATA: BEGIN OF it_t001 OCCURS 0,
bukrs TYPE t001-bukrs,
butxt TYPE t001-butxt,
END OF it_t001.
DATA:g_zipper TYPE REF TO cl_abap_zip.
DATA:file_name TYPE string VALUE 'Report_output.pdf'.
DATA:file_path TYPE string VALUE 'C:\temp\pdf_report.ZIP'.
START-OF-SELECTION.
PERFORM get_data.
PERFORM print_data CHANGING spool_no.
PERFORM convert_spool_2_pdf.
PERFORM convert_binary_2_xstring.
PERFORM zipping_pdf_file.
PERFORM download_zip_file.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
FORM get_data .