FILE ZIP

I need to create a ZIP file in a UNIX Server , SAP ECC 6.0, UNICODE. I´m using the functions CL_ABAP_GZIP and CL_ABAP_ZIP. The ZIP file contains an file txt that it needs to be in type ASC, but this functions generate this file with type BIN and not in a server. There are other functions to create this file txt with type ASC and the file zipped in a Server?
Edited by: Marcelo Henrique Ueno on Feb 14, 2008 4:48 PM

using ICSharpCode.SharpZipLib.Zip; 
Other than this too?
Can i get all possible options? 
Thank you
Priya VS

Similar Messages

  • Extracting compressed file (zip) using PL/SQL

    Hi!
    Can anyone help me on how to extract data out of a compressed file(ZIP) using pl sql.
    Regards,
    dhekz

    user8707902 wrote:
    Can anyone help me on how to extract data out of a compressed file(ZIP) using pl sql.Bear in mind that the Lempel-Zif-Welch (LZW) compression used in zip files may still have patent issue relating to Unisys (not sure of the patent has expired now or what, it's always been somewhat confusing). So, if you already have software written to zip/unzip files you should use that as it should be licenced already. If you write your own LZW compression/decompression routine for use in any commercial software you may be required to register and submit royalties to Unisys for the privilege. As I say, I don't know the latest, so you may be ok, but it's something to be aware of and check out if you intend to write your own and it's for commercial reasons.

  • The deployment package file (*.zip) was not found

    Hi,
    I was using my Visual Studio Online account and was pushing it to azure. The deployment failed and this was the result:
    Exception Message: The deployment package file (*.zip) was not found. Ensure that PackageAsSingleFile msbuild property is not set to False. (type FileNotFoundException)
    Exception Stack Trace:    at Microsoft.TeamFoundation.Deployment.Workflow.Activities.FindPackageAndParametersFile.Execute(CodeActivityContext context)
       at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
       at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
    Does anyone have a possible solution?
    I've contacted support and they suggested to turn the website off while deploying but that did not seem to resolve the issue.

    photon, you've had quite a few threads now in which you lead those willing to help you down all kinds of useless rabit trails.  Most of the problems have been "solved" with you giving a statement much like this last one that "I forgot to <do some basic step clearly outlined in the instructions>".
    We all make silly mistakes from time to time - but if you show a consistent pattern of failing to follow simple instructions, then I doubt arch is for you, and I doubt you will continue to get much leeway from this community.

  • Error at file zip receiver

    Hi,
    I am doing Idoc to file scenario with file zipped at receiver
    Below parameters were used in module
    AF_Modules/StrictXml2PlainBean
    AF_Modules/MessageTransformBean
    AF_Modules/TextCodepageConversionBean
    AF_Modules/PayloadZipBean
    CallSapAdapter
    AF_Modules/MessageTransformBean|Transform.ContentType|text/plain;charset="UTF-8";name="UPEM"
    AF_Modules/TextCodepageConversionBean|Conversion.charset|ISO-8859-1
    AF_Modules/PayloadZipBean|zip.filenameKey|contentType
    AF_Modules/PayloadZipBean|zip.mode|zipOne
    I am doing content conversion
    At receiver cc I'm getting below error:
    Message processing failed. Cause: com.sap.aii.af.service.util.configuration.ConfigurationExceptionSet: The following configuration errors were detected: - Either recordTypes or singleRecordType needs to be set
    regards,
    Anirudh
    Edited by: Anirudh Vyas on Feb 19, 2009 10:24 AM

    >
    Anirudh Vyas wrote:
    > Hi,
    >
    > I am doing Idoc to file scenario with file zipped at receiver
    >
    > Below parameters were used in module
    >
    > AF_Modules/StrictXml2PlainBean
    > AF_Modules/MessageTransformBean
    > AF_Modules/TextCodepageConversionBean
    > AF_Modules/PayloadZipBean
    > CallSapAdapter
    >
    >
    > AF_Modules/MessageTransformBean|Transform.ContentType|text/plain;charset="UTF-8";name="UPEM"
    > AF_Modules/TextCodepageConversionBean|Conversion.charset|ISO-8859-1
    > AF_Modules/PayloadZipBean|zip.filenameKey|contentType
    > AF_Modules/PayloadZipBean|zip.mode|zipOne
    >
    > I am doing content conversion
    >
    > At receiver cc I'm getting below error:
    >
    > Message processing failed. Cause: com.sap.aii.af.service.util.configuration.ConfigurationExceptionSet: The following configuration errors were detected: - Either recordTypes or singleRecordType needs to be set
    >
    > regards,
    > Anirudh
    >
    > Edited by: Anirudh Vyas on Feb 19, 2009 10:24 AM
    When using the AF_Modules/StrictXml2PlainBean you have to provide its parameters. The error points that mandatory parameters of the bean is not specified.
    Ref: http://help.sap.com/saphelp_nw04/helpdata/en/44/748d595dab6fb5e10000000a155369/content.htm

  • Upload image,file(zip,txt,word,excel...)

    how to upload image or file(zip,txt,word,excel,ppt and so on) to database,then show it by jsp page? Someone can give me a sample?

    there are some things to do:
    1) an HTML page (it can be generated via JSP or can be a plain HTML page) containing a form line this:
    2) a jsp or servlet that reads the file uploaded and writes it tio db
    3) a jsp that read from db and display the page
    it isn't complex, but quite long. Some suggestions:
    1)
    <form name="form1" action="..." method="post" enctype="multipart/form-data">
    <input type="file" name="file_name" value="">
    </form>
    2) You can use this library http://www.servlets.com/cos/index.html for getting the file. You can decide what to do about it (saving in the file system, in a db, ad so on). It is really a good library and well documented!
    3) set the content type of the result page appropriatly (see other threads in this forum about this topic!)
    -- Ivan

  • BI Publisher Multiple tray/ Renaming of file / Zipping of BI Publisher O/P

    Hi Team,
    I want to know, whether we can achieve the following task in embedded BI publisher or not.
    Also, if we can do, let me know what are the possible steps to achieve them:
    1. Multiple Tray selection
    Here multiple Tray means different tray available in a single printer i.e tray 1 can have A4 paper, tray 2 can have A3 paper , tray 3 can have pre- printed stationary etc. so our BIP output can be send to multiple tray.
    *2. Checking the groupings - how many levels*
    Embedded BIP can provide a maximum of upto 4 levels of grouping.
    our requirement demand to group upto 7 level, I have suggested that we can achieve this through manual coding in RTF.
    *3. Email Feature - HTML (body is dynamic).*
    BIP has this emailing facility where we can have dynamic body in a mail. We need to figure out what max no of character , we can have in the body.
    *4. Reports that are uploaded to different folders.*
    It means that PDF/RTF files should be able to be copied to different folders like C:\DMU, D:\CTA etc
    5. Inserting records into SQL
    We need to find way for connecting to database and inserting our BIP records.
    6. Renaming files for the Email and Doc Central.
    We need to find out methods where we can rename our BIP outputs.Generally BIP file name gets generated automatically with UBE engine when it generates XML file.
    *7. Integrate with Doc Central (PDFs and Common XML)*
    Client is having one DOC Central software where client keeps repository of all its documents. we need to figure out that can we integrate our JDE with DOC central for keeping our BIP outputs in it.
    *8.Zipping of the files and sending the documents by FTP.*
    we need to figure out ways where we can zip our BIP outputs and send it through FTP.
    Let me know possible ways to achieve above 8 constraints, any java/dot net program if require to meet those above 8 facilities are also welcome.
    Thanks!
    Deepak Mishra

    Hi ,
    Do not have an answer yet . but with some research and trials it seems this may not be possible.
    Regards,
    PKB

  • ALV report output to excel file, zip it and send to email

    my requirement is to run a report then the result will be sent to email. Attachment is an excel file that is zipped since file size is about 25MB
    I've search several forums and found a sap template in sending email with excel file attachment, it is BCS_EXAMPLE_7
    but it should be zipped, what i found is this CL_ABAP_ZIP, but with my understanding, the file needs to be in PDF format to be able to zip
    has anyone had the same requirement before?
    Would be thankful to your input guys, thanks!

    any ideas guys?

  • Windows Explorer misreads large-file .zip archives

       I just spent about 90 minutes trying to report this problem through
    the normal support channels with no useful result, so, in desperation,
    I'm trying here, in the hope that someone can direct this report to some
    useful place.
       There appears to be a bug in the .zip archive reader used by Windows
    Explorer in Windows 7 (and up, most likely).
       An Info-ZIP Zip user recently reported a problem with an archive
    created using our Zip program.  The archive was valid, but it contained
    a file which was larger than 4GiB.  The complaint was that Windows
    Explorer displayed (and, apparently believed) an absurdly large size
    value for this large-file archive member.  We have since reproduced the
    problem.
       The original .zip archive format includes uncompressed and compressed
    sizes for archive members (files), and these sizes were stored in 32-bit
    fields.  This caused problems for files which are larger than 4GiB (or,
    on some system types, where signed size values were used, 2GiB).  The
    solution to this fundamental limitation was to extend the .zip archive
    format to allow storage of 64-bit member sizes, when necessary.  (PKWARE
    identifies this format extension as "Zip64".)
       The .zip archive format includes a mechanism, the "Extra Field", for
    storing various kinds of metadata which had no place in the normal
    archive file headers.  Examples include OS-specific file-attribute data,
    such as Finder info and extended attributes for Apple Macintosh; record
    format, record size, and record type data for VMS/OpenVMS; universal
    file times and/or UID/GID for UNIX(-like) systems; and so on.  The Extra
    Field is where the 64-bit member sizes are stored, when the fixed 32-bit
    size fields are too small.
       An Extra Field has a structure which allows multiple types of extra
    data to be included.  It comprises one or more "Extra Blocks", each of
    which has the following structure:
           Size (bytes) | Description
          --------------+------------
                2       | Type code
                2       | Number of data bytes to follow
            (variable)  | Extra block data
       The problem with the .zip archive reader used by Windows Explorer is
    that it appears to expect the Extra Block which includes the 64-bit
    member sizes (type code = 0x0001) to be the first (or only) Extra Block
    in the Extra Field.  If some other Extra Block appears at the start of
    the Extra Field, then its (non-size) data are being incorrectly
    interpreted as the 64-bit sizes, while the actual 64-bit size data,
    further along in the Extra Field, are ignored.
       Perhaps the .zip archive _writer_ used by Windows Explorer always
    places the Extra Block with the 64-bit sizes in this special location,
    but the .zip specification does not demand any particular order or
    placement of Extra Blocks in the Extra Field, and other programs
    (Info-ZIP Zip, for example) should not be expected to abide by this
    artificial restriction.  For details, see section "4.5 Extensible data
    fields" in the PKWARE APPNOTE:
          http://www.pkware.com/documents/casestudies/APPNOTE.TXT
       A .zip archive reader is expected to consider the Extra Block type
    codes, and interpret accordingly the data which follow.  In particular,
    it's not sufficient to trust that any particular Extra Block will be the
    first one in the Extra Field.  It's generally safe to ignore any Extra
    Block whose type code is not recognized, but it's crucial to scan the
    Extra Field, identify each Extra Block, and handle it according to its
    type.
       Here are some relatively small (about 14MiB each) test archives which
    illustrate the problem:
          http://antinode.info/ftp/info-zip/ms_zip64/test_4g.zip
          http://antinode.info/ftp/info-zip/ms_zip64/test_4g_V.zip
          http://antinode.info/ftp/info-zip/ms_zip64/test_4g_W.zip
       Correct info, from UnZip 6.00 ("unzip -lv"):
    Archive:  test_4g.zip
     Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
    4362076160  Defl:X 14800839 100% 05-01-2014 15:33 6d8d2ece  test_4g.txt
    Archive:  test_4g_V.zip
     Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
    4362076160  Defl:X 14800839 100% 05-01-2014 15:33 6d8d2ece  test_4g.txt
    Archive:  test_4g_W.zip
     Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
    4362076160  Defl:X 14800839 100% 05-01-2014 15:33 6d8d2ece  test_4g.txt
    (In these reports, "Length" is the uncompressed size; "Size" is the
    compressed size.)
       Incorrect info, from (Windows 7) Windows Explorer:
    Archive        Name          Compressed size   Size
    test_4g.zip    test_4g.txt         14,454 KB   562,951,376,907,238 KB
    test_4g_V.zip  test_4g.txt         14,454 KB   8,796,110,221,518 KB
    test_4g_W.zip  test_4g.txt         14,454 KB   1,464,940,363,777 KB
       Faced with these unrealistic sizes, Windows Explorer refuses to
    extract the member file, for lack of (petabytes of) free disk space.
       The archive test_4g.zip has the following Extra Blocks: universal
    time (type = 0x5455) and 64-bit sizes (type = 0x0001).  test_4g_V.zip
    has: PWWARE VMS (type = 0x000c) and 64-bit sizes (type = 0x0001).
    test_4g_W.zip has: NT security descriptor (type = 0x4453), universal
    time (type = 0x5455), and 64-bit sizes (type = 0x0001).  Obviously,
    Info-ZIP UnZip has no trouble correctly finding the 64-bit size info in
    these archives, but Windows Explorer is clearly confused.  (Note that
    "1,464,940,363,777 KB" translates to 0x0005545500000400 (bytes), and
    "0x00055455" looks exactly like the size, "0x0005" and the type code
    "0x5455" for a "UT" universal time Extra Block, which was present in
    that archive.  This is consistent with the hypothesis that the wrong
    data in the Extra Field are being interpreted as the 64-bit size data.)
       Without being able to see the source code involved here, it's hard to
    know exactly what it's doing wrong, but it does appear that the .zip
    reader used by Windows Explorer is using a very (too) simple-minded
    method to extract 64-bit size data from the Extra Field, causing it to
    get bad data from a properly formed archive.
       I suspect that the engineer involved will have little trouble finding
    and fixing the code which parses an Extra Field to extract the 64-bit
    sizes correctly, but if anyone has any questions, we'd be happy to help.
       For the Info-ZIP (http://info-zip.org/) team,
       Steven Schweda

    > We can't get the source (info-zip) program for test.
       I don't know why you would need to, but yes, you can:
          http://www.info-zip.org/
          ftp://ftp.info-zip.org/pub/infozip/src/
    You can also get pre-built executables for Windows:
          ftp://ftp.info-zip.org/pub/infozip/win32/unz600xn.exe
          ftp://ftp.info-zip.org/pub/infozip/win32/zip300xn.zip
    > In addition, since other zip application runs correctly. Since it should
    > be your software itself issue.
       You seem to misunderstand the situation.  The facts are these:
       1.  For your convenience, I've provided three test archives, each of
    which includes a file larger than 4GiB.  These archives are valid.
       2.  Info-ZIP UnZip (version 6.00 or newer) can process these archives
    correctly.  This is consistent with the fact that these archives are
    valid.
       3.  Programs from other vendors can process these archives correctly.
    I've supplied a screenshot showing one of them (7-Zip) doing so, as you
    requested.  This is consistent with the fact that these archives are
    valid.
       4.  Windows Explorer (on Windows 7) cannot process these archives
    correctly, apparently because it misreads the (Zip64) file size data.
    I've supplied a screenshot of Windows Explorer showing the bad file size
    it gets, and the failure that occurs when one tries to use it to extract
    the file from one of these archives, as you requested.  This is
    consistent with the fact that there's a bug in the .zip reader used by
    Windows Explorer.
       Yes, "other zip application runs correctly."  Info-ZIP UnZip runs
    correctly.  Only Windows Explorer does _not_ run correctly.

  • Problem with file zipping!

    I have problem with my zip files. all that i need is a simple zipping of files. here's is what i am doing
    //this mehod takes 2 arugments, first argument is the file which is to be zipped and the second argument is the name of the zip file
    public void makeZIP(File fileToZip, String zfileName) throws IOException{
    try{
    byte[] buff = new byte[BUF_SIZE];//BUF_SIZE =128
    int cnt=0;
    FileInputStream swcConvFis = new FileInputStream(fileToZip);
    ZipEntry swcConvZipEntry = new ZipEntry(zfileName);
    ZipOutputStream swcConvZipOutputStream = new ZipOutputStream(swcConvFos);
    swcConvZipOutputStream.putNextEntry(swcConvZipEntry);
    while((cnt = swcConvFis.read(buff,0,BUF_SIZE)) != -1){
    swcConvZipOutputStream.write(buff,0,cnt);
    swcConvFis.close();
    swcConvZipOutputStream.closeEntry();
    }catch(NullPointerException npe){npe.printStackTrace();}
    whis code is a part of the servlet code that has to send the zipped file to the applet. What's happening is i am able to zip the files. but when i try to open the zip file it gives me a an error window saying " cannot open file: it does not appear to be valid archive."
    ofcourse the file is zipped on a linux machine and i am trying to open it in windows...it think this shouldn't be a problem though!!
    please somebody throw some light on this. i have searched the archives but not helpful sofar.
    thanks
    sri

    the outputToApplet is the ObjectOutputStream object.
    at the applet's reading end this is what i am doing
    ObjectInputStream intputFromServlet = new ObjectInputStream(connect.getInputStream());
    //code to read the output files from the servlet
    byte[] buff = new byte[BUF_SIZE];
    int cnt = 0;
    ArrayList getOutputFilesFromServlet = (ArrayList) inputFromServlet.readObject(); // at the servlet end i am writing outputToApplet.writeObject(send2Files), send2Files is an ArrayList object that has one .txt file and another .zip file
    System.out.println("total no.of files "+getOutputFilesFromServlet.size()); //shows 2
    Iterator getOutputFilesFromServletIterator = getOutputFilesFromServlet.iterator();
    while(getOutputFilesFromServletIterator.hasNext()){
                   File file = (File)getOutputFilesFromServletIterator.next();
    String fname = file.getName();
    System.out.println("received "+fname);//shows correct file names
                   try{
                        File nfile = new File(getOfile.getParent()+System.getProperty("file.separator")+fname);//puts the files in the requested directory on the client machine
                        FileOutputStream toFile = new FileOutputStream(nfile);
    //reading the files uploaded by the applet
                        while( (cnt = dump.read( buff )) > -1 ){
                             if(cnt<BUF_SIZE){
                             toFile.write( buff, 0, cnt );
                                  toFile.close();
                                  break;
                             toFile.write( buff, 0, cnt );
              }catch(Exception e){e.printStackTrace();}
    System.out.println("finished reading all files from the servlet....");
              }//while(it.next)
    not only the zip file even the other text file is not downloaded properly....(i.e) it shows some junk characters instead of the actual file context. so maybe there is mistake in the way that i am reading the files...but what i am doing at applet's end is just a mirror reflection of what i am doing at the servlet's end. you got me!! hope i am not confusing!
    any suggestions!!

  • Saving File - zip problem?

    If i use this set of coding, i can receive the file and the bytes and save it to the current directory, with the zip file, it just creates the file without saving the bytes, anyone knows what is wrong? Is there another way to go abt saving file objects to the current directory which includes all types of files?
    File file = new File("folder/Access.java");
              boolean flag = file.exists();
              System.out.println(flag);
              try
                                       FileOutputStream fos = new FileOutputStream(file.getName());
                   FileInputStream is = new FileInputStream(file);
                   long length = file.length();
                   if (length > Integer.MAX_VALUE) {
                // File is too large
            byte[] bytes = new byte[(int)length];
                  int offset = 0;
            int numRead = 0;
            while (offset < bytes.length
                   && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
                offset += numRead;
            if (offset < bytes.length) {
                throw new IOException("Could not completely read file "+file.getName());
            is.close();
            //return bytes;
            fos.write(bytes);
              }catch(IOException e)
                   e.printStackTrace();
              }Most code sample comes from javaalmanac.com.

    FileOutputStream fos = new FileOutputStream(file.getName());This gets an output stream to a file named Access.java in the current directory. However your first line of code suggests you might have expected to write to Access.java in the current directory's subdirectory named folder. If that is actually what you want, then try this instead:FileOutputStream fos = new FileOutputStream(file);PC&#178;

  • How to use .dbf files zipped into a .zip file from within a java program

    i have a .zip file containing several .dbf files.
    the zip file is automatically downloaded regularly and data from the .dbf files is inserted into the database.
    how do i facilitate automatic extraction of a zip file or how do i fetch data from the .dbf file? (this cannot be done manually)
    anu.

    you could write a little polling class checking the zip file. you can use the java.util.jar package to extract the zip file (http://java.sun.com/docs/books/tutorial/jar/api/index.html). you could also use Jakarta ant (http://ant.apache.org/manual/index.html) to do this job (core task "zip") and call ant's target file on a regular basis (dependend on the OS you use, you can set os tasks/schedules).

  • How to upload a PDF file, zip it and download the zipped file?

    Hi Experts,
    I have a requirement to upload a PDF file, convert that to a ZIP file and download it. If anyone has worked on this requirement, can you please guide me on this? Thanks.
    Avi

    Here you go.  Hope it helps.
    REPORT  zrich_0004.
    DATA: lt_data TYPE TABLE OF x255.
    DATA: ls_data LIKE LINE OF lt_data.
    DATA: lv_zip_content TYPE xstring.
    DATA: lv_size  TYPE i.
    DATA: lv_filename TYPE string.
    DATA: lv_path TYPE string.
    DATA: lv_fullpath TYPE string.
    DATA: lt_filetab TYPE TABLE OF file_table.
    DATA: ls_filetab LIKE LINE OF lt_filetab.
    DATA: lv_rc TYPE sy-subrc.
    DATA: lv_content TYPE xstring.
    DATA: lo_zip TYPE REF TO cl_abap_zip.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_up TYPE string DEFAULT 'C:\upload.pdf' .
    PARAMETERS: p_down TYPE string DEFAULT 'C:\download.zip' .
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_up.
      REFRESH lt_filetab. CLEAR ls_filetab.
      cl_gui_frontend_services=>file_open_dialog(
          CHANGING
            file_table              = lt_filetab
            rc                      = lv_rc
        EXCEPTIONS
          OTHERS                  = 5 ).
      READ TABLE lt_filetab INTO ls_filetab INDEX 1.
      IF sy-subrc = 0.
        p_up = ls_filetab-filename.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_down.
      CLEAR: lv_filename, lv_path, lv_fullpath.
      cl_gui_frontend_services=>file_save_dialog(
         CHANGING
           filename             = lv_filename
           path                 = lv_path
           fullpath             = lv_fullpath
         EXCEPTIONS
           OTHERS               = 4 ).
      p_down = lv_fullpath.
    START-OF-SELECTION.
      CREATE OBJECT lo_zip.
    * Read the data as a string
      cl_gui_frontend_services=>gui_upload(
        EXPORTING
          filename                = p_up
          filetype                = 'BIN'
        IMPORTING
          filelength = lv_size
        CHANGING
          data_tab                = lt_data
        EXCEPTIONS
          OTHERS                  = 19 ).
    * convert binary to xstring
      CLEAR lv_content .
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = lv_size
        IMPORTING
          buffer       = lv_content
        TABLES
          binary_tab   = lt_data
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.
    * Get the file name of the uploaded file
      DATA: lv_upfilename TYPE string.
      DATA: lv_tmp TYPE char1024.
      DATA: lv_tmp_file TYPE char1024.
      lv_tmp = p_up.
      CALL FUNCTION 'STRING_REVERSE'
        EXPORTING
          string  = lv_tmp
          lang    = sy-langu
        IMPORTING
          rstring = lv_tmp.
      SPLIT lv_tmp AT '\' INTO lv_tmp_file lv_tmp.
      CALL FUNCTION 'STRING_REVERSE'
        EXPORTING
          string  = lv_tmp_file
          lang    = sy-langu
        IMPORTING
          rstring = lv_tmp_file.
      lv_upfilename = lv_tmp_file.
    * add to zip file.
      lo_zip->add( name = lv_upfilename content = lv_content ).
      lv_zip_content   = lo_zip->save( ).
    * Conver the xstring content to binary
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          buffer        = lv_zip_content
        IMPORTING
          output_length = lv_size
        TABLES
          binary_tab    = lt_data.
    * download
      cl_gui_frontend_services=>gui_download(
          EXPORTING
            bin_filesize = lv_size
            filename     = p_down
            filetype     = 'BIN'
          CHANGING
            data_tab     = lt_data
          EXCEPTIONS
            OTHERS       = 24 ).
    Regards,
    Rich Heilman

  • Cannot use winzip to unzip the zip file zipped by java.util.zip

    Hi all,
    I use the followcode to create a zip file, and i downlaod it and try to use winzip to unzip this file but fail. The path is correct and i got the zip file. but it just cannot unzip.
    pls help
    thanks alot.
    Kin
              int count = 0;
              count = ContentDocuments.size();
              for (int i = 0; i < bb; i++)     {
                   System.out.println(filenames[i] + "");
              // Create a buffer for reading the files
              byte[] buf = new byte[10*1024*1024];
              try {      
                   String outFilename = MyDir + "zipfile/" + getContentID2()+".zip";
                   System.out.println("outFilename = " + outFilename);
                   ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
                   for (int i=0; i<filenames.length; i++) {           
                        FileInputStream in = new FileInputStream(filenames);
                        out.putNextEntry(new ZipEntry(filenames[i]));
                        int len;
                        while ((len = in.read(buf)) != -1) {               
                             out.write(buf, 0, len);
                        out.closeEntry();
                        in.close();
                   out.close();
              } catch (IOException e)     {
                   System.err.println("zipprocess " + e.getMessage());

    I've written a replacement zip file creator class. Not much tested but it seems to work, however I've yet to try it with the version of WINZIP that rejected my previous attempts. Oh, and the stored dates are garbage.
    * ZipOutputFile.java
    * Created on 25 March 2004, 13:08
    package zip;
    import java.io.IOException;
    import java.nio.ByteBuffer;
    * <p>Creates a ZIP archive in a file which WINZIP should be able to read.</p>
    * <p>Unfortunately zip archives generated by the standard Java class
    * {@link java.util.zip.ZipOutputStream}, while adhering to PKZIPs format specification,
    * don't appear to be readable by some versions of WinZip and similar utilities. This is
    * probably because they use
    * a format specified for writing to a non-seakable stream, where the length and CRC of
    * a file is writen to a special block following the data. Since the length of the binary
    * date is unknown this makes an archive quite complicated to read, and it looks like
    * WinZip hasn't bothered.</p>
    * <p>All data is Deflated. Close completes the archive, flush terminates the current entry.</p>
    * @see java.util.zip.ZipOutputStream
    * @author  Malcolm McMahon
    public class ZipOutputFile extends java.io.OutputStream {
        byte[] oneByte = new byte[1];
        java.io.RandomAccessFile archive;
        public final static short DEFLATE_METHOD = 8;
        public final static short VERSION_CODE = 20;
        public final static short MIN_VERSION = 10;
        public final static int  ENTRY_HEADER_MAGIC = 0x04034b50;
        public final static int  CATALOG_HEADER_MAGIC = 0x02014b50;
        public final static int  CATALOG_END_MAGIC = 0x06054b50;
        private final static short DISC_NUMBER = 0;
        ByteBuffer entryHeader = ByteBuffer.wrap(new byte[30]);
        ByteBuffer entryLater = ByteBuffer.wrap(new byte[12]);
        java.util.zip.CRC32 crcAcc = new java.util.zip.CRC32();
        java.util.zip.Deflater def = new java.util.zip.Deflater(java.util.zip.Deflater.DEFLATED, true);
        int totalCompressed;
        long MSEPOCH;
        byte [] deflateBuf = new byte[2048];
        public static final long SECONDS_TO_DAYS = 60 * 60 * 24;
         * Entry stores info about each file stored
        private class Entry {
            long offset;        // position of header in file
            byte[] name;
            long crc;
            int compressedSize;
            int uncompressedSize;
            java.util.Date date;
             * Contructor also writes initial header.
             * @param fileName Name under which data is stored.
             * @param date  Date to label the file with
             * @TODO get the date stored properly
            public Entry(String fileName, java.util.Date date) throws IOException {
                name = fileName.getBytes();
                this.date = date == null ? new java.util.Date() : date;
                entryHeader.position(10);
                putDate(entryHeader);
                entryHeader.putShort(26, (short)name.length);
                offset = archive.getFilePointer();
                archive.write(entryHeader.array());
                archive.write(name);
                catalog.add(this);
                crcAcc.reset();
                totalCompressed = 0;
                def.reset();
             * Finish writing entry data. Save the lenghts & crc for catalog
             * and go back and fill them in in the entry header.
            public void close() throws IOException {
                def.finish();
                while(!def.finished())
                    deflate();
                entryLater.position(0);
                crc = crcAcc.getValue();
                compressedSize = totalCompressed;
                uncompressedSize = def.getTotalIn();
                entryLater.putInt((int)crc);
                entryLater.putInt(compressedSize);
                entryLater.putInt(uncompressedSize);
                long eof = archive.getFilePointer();
                archive.seek(offset + 14);
                archive.write(entryLater.array());
                archive.seek(eof);
             * Write the catalog data relevant to this entry. Buffer is
             * preloaded with fixed data.
             * @param buf Buffer to organise fixed lenght part of header
            public void writeCatalog(ByteBuffer buf) throws IOException {
                buf.position(12);
                putDate(buf);
                buf.putInt((int)crc);
                buf.putInt(compressedSize);
                buf.putInt(uncompressedSize);
                buf.putShort((short)name.length);
                buf.putShort((short)0);  // extra field length
                buf.putShort((short)0);  // file comment length
                buf.putShort(DISC_NUMBER);  // disk number
                buf.putShort((short)0); // internal attributes
                buf.putInt(0);      // external file attributes
                buf.putInt((int)offset); // file position
                archive.write(buf.array());
                archive.write(name);
             * This writes the entries date in MSDOS format.
             * @param buf Where to write it
             * @TODO Get this generating sane dates
            public void putDate(ByteBuffer buf) {
                long msTime = (date.getTime() - MSEPOCH) / 1000;
                buf.putShort((short)(msTime % SECONDS_TO_DAYS));
                buf.putShort((short)(msTime / SECONDS_TO_DAYS));
        private Entry entryInProgress = null; // entry currently being written
        private java.util.ArrayList catalog = new java.util.ArrayList(12);  // all entries
         * Start a new output file.
         * @param name The name to store as
         * @param date Date - null indicates current time
        public java.io.OutputStream openEntry(String name, java.util.Date date) throws IOException{
            if(entryInProgress != null)
                entryInProgress.close();
            entryInProgress = new Entry(name, date);
            return this;
         * Creates a new instance of ZipOutputFile
         * @param fd The file to write to
        public ZipOutputFile(java.io.File fd) throws IOException {
            this(new java.io.RandomAccessFile(fd, "rw"));
         * Create new instance of ZipOutputFile from RandomAccessFile
         * @param archive RandomAccessFile
        public ZipOutputFile(java.io.RandomAccessFile archive) {
            this.archive = archive;
            entryHeader.order(java.nio.ByteOrder.LITTLE_ENDIAN);  // create fixed fields of header
            entryLater.order(java.nio.ByteOrder.LITTLE_ENDIAN);
            entryHeader.putInt(ENTRY_HEADER_MAGIC);
            entryHeader.putShort(MIN_VERSION);
            entryHeader.putShort((short)0);  // general purpose flag
            entryHeader.putShort(DEFLATE_METHOD);
            java.util.Calendar cal = java.util.Calendar.getInstance();
            cal.clear();
            cal.set(java.util.Calendar.YEAR, 1950);
            cal.set(java.util.Calendar.DAY_OF_MONTH, 1);
    //        def.setStrategy(Deflater.HUFFMAN_ONLY);
            MSEPOCH = cal.getTimeInMillis();
         * Writes the master catalogue and postamble and closes the archive file.
        public void close() throws IOException{
            if(entryInProgress != null)
                entryInProgress.close();
            ByteBuffer catEntry = ByteBuffer.wrap(new byte[46]);
            catEntry.order(java.nio.ByteOrder.LITTLE_ENDIAN);
            catEntry.putInt(CATALOG_HEADER_MAGIC);
            catEntry.putShort(VERSION_CODE);
            catEntry.putShort(MIN_VERSION);
            catEntry.putShort((short)0);
            catEntry.putShort(DEFLATE_METHOD);
            long catStart = archive.getFilePointer();
            for(java.util.Iterator it = catalog.iterator(); it.hasNext();) {
                ((Entry)it.next()).writeCatalog(catEntry);
            catEntry.position(0);
            catEntry.putInt(CATALOG_END_MAGIC);
            catEntry.putShort(DISC_NUMBER);
            catEntry.putShort(DISC_NUMBER);
            catEntry.putShort((short)catalog.size());
            catEntry.putShort((short)catalog.size());
            catEntry.putInt((int)(archive.getFilePointer() - catStart));
            catEntry.putInt((int)catStart);
            catEntry.putShort((short)0);
            archive.write(catEntry.array(), 0, catEntry.position());
            archive.setLength(archive.getFilePointer());  // truncate if old file
            archive.close();
            def.end();
         * Closes entry in progress.
        public void flush() throws IOException{
            if(entryInProgress == null)
                throw new IllegalStateException("Must call openEntry before writing");
            entryInProgress.close();
            entryInProgress = null;
         * Standard write routine. Defined by {@link java.io.OutputStream}.
         * Can only be used once openEntry has defined the file.
         * @param b  Bytes to write
        public void write(byte[] b) throws IOException{
            if(entryInProgress == null)
                throw new IllegalStateException("Must call openEntry before writing");
            crcAcc.update(b);
            def.setInput(b);
            while(!def.needsInput())
                deflate();
         * Standard write routine. Defined by {@link java.io.OutputStream}.
         * Can only be used once openEntry has defined the file.
         * @param b  Bytes to write
        public void write(int b) throws IOException{
            oneByte[0] = (byte)b;
            crcAcc.update(b);
            write(oneByte, 0, 1);
         *  Standard write routine. Defined by {@link java.io.OutputStream}.
         * Can only be used once openEntry has defined the file.
         * @param b  Bytes to write
         * @param off Start offset
         * @param len Byte count
        public void write(byte[] b, int off, int len) throws IOException{
            if(entryInProgress == null)
                throw new IllegalStateException("Must call openEntry before writing");
            crcAcc.update(b, off, len);
            def.setInput(b, off, len);
            while(!def.needsInput())
                deflate();
        * Gets a buffer full of coded data from the deflater and writes it to archive.
        private void deflate() throws IOException {
            int len = def.deflate(deflateBuf);
            totalCompressed += len;
            if(len > 0)
                archive.write(deflateBuf, 0, len);

  • I downloaded some pictures my daughter sent in a file. I named the file ".zip" and now I can't locate it in "My Pictures" How can I search for it?

    How do I search for a file I can't locate?

    { Ctrl + J } to open the Downloads window, then right-click that zip file and use '''Open Containing Folder'''.

  • Split file zip with cl_abap_zip

    Hi,
    I must to split a zip file in parts of 50 mb. How can I do? Can I use CL_ABAP_ZIP->splice?
    Thank you very much

    Hello friend,
    I am not sure whether this link helps. It seems the exporting parameter of method SPLICE has no such like split size.
    Rich's code for unzip works great - just need unzip
    Best Regards,
    Jerry
    Edited by: Jerry Wang on Sep 21, 2010 3:59 AM

Maybe you are looking for

  • 'Acknowledgement Not Possible'  Error message

    Iam doing IDOC-XI-File scenario . Iam able to write file successfully. But It lookslike creating acknowledgement. Since there is no routing possible, Iam getting this error in SXMB_Moni. A looked at File adapter as well. I have no clue. Lookslike I m

  • Is chaining pageflow actions allowed?

    Hi, I have 2 different actions which chain to a third action (which seperates the common logic): @jpf:forward name="success" path="showBookList.do" addBookToList(BookDetailsForm form) { // add a book return new Forward("success"); @jpf:forward name="

  • Read Session ID in WD

    Hi, what have I to do to read the Session ID of the actual session. (Session concept ?) Which libraries have to be included and how could be the code? best regards Mathias

  • Sorting of Dyanmic internal table

    Hi Gurus, I am having a dynamic internal table (it_mat) having  fields matnr uname field1,field2,field3 and field4. the field is upto fieldN. I want my table to sorted by this manner Sort it_mat by field4 field3 field2 field1. Sort it_mat by fieldN f

  • Urgent.e-mail attachement

    hai Java guys, i am doing a project based on web.how can i write coding in java for attaching a file