<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Zip a zipped file through ABAP code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454929#M1999864</link>
    <description>&lt;P&gt;Why are you using CALL METHOD? That's been unnecessary for well over a decade.Far better to use the short form - much easier to read.&lt;/P&gt;</description>
    <pubDate>Sat, 21 Aug 2021 11:31:37 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2021-08-21T11:31:37Z</dc:date>
    <item>
      <title>Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454913#M1999848</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
  &lt;P&gt;My requirement is, I have data in internal table and from that I need to create .csv file and then zip this file. Once this file is zipped, then I need to zip this zipped File and download it to the presentation server. I am able to do the first zip by using class CL_ABAP_ZIP (methods are add and save). But how to zip this zipped file again? If I use the same method then what I need to pass in the content parameter as we can only pass xstring. Please provide your suggestions on the same.&lt;/P&gt;
  &lt;P&gt;IT_TABLE-&amp;gt;.CSV File-&amp;gt;ABC.ZIP (This part is done).&lt;/P&gt;
  &lt;P&gt;Now&lt;/P&gt;
  &lt;P&gt;ABC.ZIP-&amp;gt;XYZ.ZIP (How to achieve this)&lt;/P&gt;
  &lt;P&gt;Best Regards&lt;/P&gt;
  &lt;P&gt;Sumit&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 07:13:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454913#M1999848</guid>
      <dc:creator>former_member765848</dc:creator>
      <dc:date>2021-08-20T07:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454914#M1999849</link>
      <description>&lt;P&gt;Out of curiosity, why do you need to zip it twice? It won't shrink further, on the contrary it will grow.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 07:19:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454914#M1999849</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2021-08-20T07:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454915#M1999850</link>
      <description>&lt;P&gt;You probably didn't do the first ZIP correctly because the output MUST BE an xstring variable. And consequently you can ZIP it again.&lt;/P&gt;&lt;P&gt;NB: I don't understand why you "need to zip this zipped file"....&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 07:22:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454915#M1999850</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-08-20T07:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454916#M1999851</link>
      <description>&lt;P&gt;Zipping a zipped file won't compress the file further. It can be useful if you need to put a bunch of zipped files into one zip file.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 07:54:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454916#M1999851</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2021-08-20T07:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454917#M1999852</link>
      <description>&lt;P&gt;I know this sounds bit weired, but that's the requirement from the client side hence I need to zip the file once and then zip that zipped folder (compressed folder) which contains the file.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 08:04:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454917#M1999852</guid>
      <dc:creator>former_member765848</dc:creator>
      <dc:date>2021-08-20T08:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454918#M1999853</link>
      <description>&lt;P&gt;Because it would like one archive file for all the compressed file. &lt;/P&gt;&lt;P&gt;It could be so simple to do it with command line, if you run in Linux : tar cvzf new_archive.tar.bz  /directory&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 08:19:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454918#M1999853</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2021-08-20T08:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454919#M1999854</link>
      <description>&lt;P&gt;You say "but that's the requirement from the client", so you don't discuss a weird request? Most of the time a weird request is in fact a request badly expressed and finally the client will be unhappy that you understood incorrectly and that you didn't ask for confirmation.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 10:10:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454919#M1999854</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-08-20T10:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454920#M1999855</link>
      <description>&lt;P&gt;Sandra, we discussed it number of times and client already setup a process where they need to receive the file in zipped folder, they will unzipped it and then another zipped file will be there which contains the data. So now it's our task to zip the already zipped file. &lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 10:50:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454920#M1999855</guid>
      <dc:creator>former_member765848</dc:creator>
      <dc:date>2021-08-20T10:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454921#M1999856</link>
      <description>&lt;P&gt;SAVE and ADD both take xstrings. GET returns an xstring.&lt;/P&gt;&lt;P&gt;I don't see what the issue is. You've got a program like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data csv_file type xstring.
csv_file = get_csv_file( ).
data zipped_file type xstring.
zipped_file = zip( csv_file).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;so all you need is&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data double_zipped_file type xstring.
double_zipped_file = zip( zipped_file ).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Aug 2021 11:31:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454921#M1999856</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2021-08-20T11:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454922#M1999857</link>
      <description>&lt;P&gt;Thanks for confirming that there is a good reason to "double zip".&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 11:53:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454922#M1999857</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-08-20T11:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454923#M1999858</link>
      <description>&lt;P&gt;&lt;IMG alt="" style="color: inherit;" /&gt;&lt;/P&gt;&lt;P&gt;This is the program I have prepared and first zipped folder I have created is 'TEST_ZIP.ZIP', so Matt where I need to write the code for zipping the file again and how to achieve it, what all I need to pass. do I need to pass lv_xstring, if yes then how I am going to ZIP 'TEST_ZIP.ZIP' again in another compressed folder let's say 'TEST_REZIPPED.ZIP'.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 12:41:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454923#M1999858</guid>
      <dc:creator>former_member765848</dc:creator>
      <dc:date>2021-08-20T12:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454924#M1999859</link>
      <description>&lt;P&gt;CREATE OBJECT go_zip.&lt;BR /&gt;* Add teh X String as a Zip file&lt;BR /&gt; CALL METHOD go_zip-&amp;gt;add&lt;BR /&gt; EXPORTING&lt;BR /&gt; name = 'Test_ZIP'&lt;BR /&gt; content = lv_xstring.&lt;BR /&gt;&lt;BR /&gt; CALL METHOD go_zip-&amp;gt;save&lt;BR /&gt; RECEIVING&lt;BR /&gt; zip = lv_xstring.&lt;BR /&gt;&lt;BR /&gt;* Convert Xstring to Binary Table&lt;BR /&gt; CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'&lt;BR /&gt; EXPORTING&lt;BR /&gt; buffer = lv_xstring&lt;BR /&gt; TABLES&lt;BR /&gt; binary_tab = lt_bin.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;* Download the Binary table&lt;BR /&gt; CALL FUNCTION 'GUI_DOWNLOAD'&lt;BR /&gt; EXPORTING&lt;BR /&gt; filename = 'C:\Users\SumitKumar\Documents\Test_Files\TEST_ZIP.ZIP'&lt;BR /&gt; filetype = 'BIN'&lt;BR /&gt; TABLES&lt;/P&gt;&lt;P&gt;data_tab = lt_bin.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 12:43:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454924#M1999859</guid>
      <dc:creator>former_member765848</dc:creator>
      <dc:date>2021-08-20T12:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454925#M1999860</link>
      <description>&lt;P&gt;You don't need to download the first zip, it's already stored in lv_xstring.&lt;/P&gt;&lt;P&gt;Your code to create the first ZIP file (containing lv_xstring):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(go_zip) = NEW cl_abap_zip( ).
go_zip-&amp;gt;add( name = 'file name in ZIP file' content = lv_xstring ).
DATA(zip_xstring) = go_zip-&amp;gt;save( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The ZIP file is zip_xstring.&lt;/P&gt;&lt;P&gt;Add this code to create the "ZIP ZIP" file:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(go_zip2) = NEW cl_abap_zip( ).
go_zip2-&amp;gt;add( name = 'ZIP file name in ZIP file' content = zip_xstring ).
DATA(zip2_xstring) = go_zip2-&amp;gt;save( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And now you can download the ZIP ZIP file.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 13:10:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454925#M1999860</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-08-20T13:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454926#M1999861</link>
      <description>&lt;P&gt;Thanks for your reply Sandra, but still not working. It is creating a compressed folder but as soon as I double click on it, it is showing me the .csv file which is not expected. Once I double click on the first compressed folder (.zip folder) then it should show me another compressed folder and then the .csv file. I tried your code, but still not getting the expected result. I am attaching the code below:&lt;/P&gt;&lt;P&gt;   CALL METHOD go_zip-&amp;gt;add&lt;BR /&gt; EXPORTING&lt;BR /&gt; name = 'Test_ZIP'&lt;BR /&gt; content = lv_xstring.&lt;BR /&gt;****************************************************&lt;BR /&gt;* CALL METHOD go_zip-&amp;gt;save&lt;BR /&gt;* RECEIVING&lt;BR /&gt;* zip = lv_xstring.&lt;BR /&gt;DATA(zip_xstring) = go_zip-&amp;gt;save( ).&lt;BR /&gt;&lt;BR /&gt;DATA(go_zip2) = NEW cl_abap_zip( ).&lt;BR /&gt;go_zip2-&amp;gt;add( name = 'TEST_REZIP' content = zip_xstring ).&lt;BR /&gt;DATA(zip2_xstring) = go_zip2-&amp;gt;save( ).&lt;BR /&gt;&lt;BR /&gt; CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'&lt;BR /&gt; EXPORTING&lt;BR /&gt; buffer = zip2_xstring&lt;BR /&gt; TABLES&lt;BR /&gt; binary_tab = lt_bin.&lt;/P&gt;&lt;P&gt;   CALL FUNCTION 'GUI_DOWNLOAD'&lt;BR /&gt; EXPORTING&lt;BR /&gt; filename = 'C:\Users\SumitKumar\Documents\Test_Files\TEST_ZIP.ZIP'&lt;BR /&gt; filetype = 'BIN'&lt;BR /&gt; TABLES&lt;BR /&gt; data_tab = lt_bin.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 14:50:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454926#M1999861</guid>
      <dc:creator>former_member765848</dc:creator>
      <dc:date>2021-08-20T14:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454927#M1999862</link>
      <description>&lt;P&gt;Code for "double zipping" a UTF-8 text containing "ABCD".&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(go_zip) = NEW cl_abap_zip( ).
DATA(lv_xstring) = CONV xstring( '41424344' ). " UTF-8 text "ABCD"
go_zip-&amp;gt;add( name = 'file name in ZIP file.txt' content = lv_xstring ).
DATA(zip_xstring) = go_zip-&amp;gt;save( ).
DATA(go_zip2) = NEW cl_abap_zip( ).
go_zip2-&amp;gt;add( name = 'ZIP file name in ZIP file.zip' content = zip_xstring ).
DATA(zip2_xstring) = go_zip2-&amp;gt;save( ).
DATA(lt_bin) = cl_bcs_convert=&amp;gt;xstring_to_solix( zip2_xstring ).
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename = 'C:\Users\Sandra.Rossi\Downloads\TEST_ZIP.ZIP'
    filetype = 'BIN'
    bin_filesize = xstrlen( zip2_xstring )
  TABLES
    data_tab = lt_bin.&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Aug 2021 15:52:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454927#M1999862</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-08-20T15:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454928#M1999863</link>
      <description>&lt;P&gt;Thanks a lot Sandra, its working now!!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 18:29:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454928#M1999863</guid>
      <dc:creator>former_member765848</dc:creator>
      <dc:date>2021-08-20T18:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Zip a zipped file through ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454929#M1999864</link>
      <description>&lt;P&gt;Why are you using CALL METHOD? That's been unnecessary for well over a decade.Far better to use the short form - much easier to read.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Aug 2021 11:31:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/zip-a-zipped-file-through-abap-code/m-p/12454929#M1999864</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2021-08-21T11:31:37Z</dc:date>
    </item>
  </channel>
</rss>

