2008 Jan 24 11:03 AM
Hello togehter,
I want to ZIP an ABAP created XML-File into a ZIP file. The ZIP-File I created has a couple MB but doesn't have any file inside.
If I does not ZIP the XML will be created the right way.
What is wrong in the code below?
data : lv_zip_file type xstring,
lv_xml type xstring,
lv_binary type xstring,
lv_binary_tab type xstring_table,
lr_zip type ref to cl_abap_zip.
This Table does have content
loop at lt_table assigning <tablename>.
ls_line-tablename = <tablename>.
create data lr_data type table of (ls_line-tablename).
assign lr_data->* to <data>.
select * from (ls_line-tablename) into table <data>.
call transformation id
source data = <data>
result xml ls_line-tabledata.
append ls_line to et_data.
endloop.
call transformation id
source data = et_data
result xml l_string.
create object lr_zip.
call function 'ECATT_CONV_STRING_TO_XSTRING'
exporting
im_string = l_string
importing
ex_xstring = lv_xml.
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = lv_xml
tables
binary_tab = lv_binary_tab.
lr_zip->add( name = iv_filename
content = lv_xml ).
Create a new zip file
lv_zip_file = lr_zip->save( ).
append lv_zip_file to lv_binary_tab.
cl_gui_frontend_services=>gui_download(
exporting
filename = l_file
filetype = 'BIN'
changing
data_tab = lv_binary_tab ).
Hello togehter,
I want to ZIP an ABAP created XML-File into a ZIP file. The ZIP-File I created has a couple MB but doesn't have any file inside.
If I does not ZIP the XML will be created the right way.
What is wrong in the code below?
data : lv_zip_file type xstring,
lv_xml type xstring,
lv_binary type xstring,
lv_binary_tab type xstring_table,
lr_zip type ref to cl_abap_zip.
This Table does have content
loop at lt_table assigning <tablename>.
ls_line-tablename = <tablename>.
create data lr_data type table of (ls_line-tablename).
assign lr_data->* to <data>.
select * from (ls_line-tablename) into table <data>.
call transformation id
source data = <data>
result xml ls_line-tabledata.
append ls_line to et_data.
endloop.
call transformation id
source data = et_data
result xml l_string.
create object lr_zip.
call function 'ECATT_CONV_STRING_TO_XSTRING'
exporting
im_string = l_string
importing
ex_xstring = lv_xml.
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = lv_xml
tables
binary_tab = lv_binary_tab.
lr_zip->add( name = iv_filename
content = lv_xml ).
Create a new zip file
lv_zip_file = lr_zip->save( ).
append lv_zip_file to lv_binary_tab.
cl_gui_frontend_services=>gui_download(
exporting
filename = l_file
filetype = 'BIN'
changing
data_tab = lv_binary_tab ).
2008 Jan 25 2:09 PM
2008 May 12 6:11 PM
please tell me how your problem is solved.because i am facing the same problem now.its urgent.
2010 Nov 23 9:48 AM
2011 Mar 16 7:53 PM
In my case it was because I had my filename as blank, when adding each file. Ended up with obviously an empty zip file.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |