Unzip File and Read Contents

Hi,
I want to unzip a file(called outer.zip) present on the Presentation server and read inner.zip file which lies within the outer.zip.
i wrote the following program, but i am getting an error in the last step .Can some one tell me themistake i am committing here:
TYPES : BEGIN OF sda_content,
  lv_buf(65535) type x,
  END OF sda_content .
DATA : ls_sda_content type sda_content ,
        lt_sda_content type table OF sda_content  .
DATA : lv_file_length type int4 .
DATA : x_buf TYPE xstring .
CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                      = 'C:\outer.zip'
   FILETYPE                      = 'BIN'
IMPORTING
   FILELENGTH                    = lv_file_length
  tables
    data_tab                      = lt_sda_content
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
  EXPORTING
    input_length       = lv_file_length
IMPORTING
   BUFFER             = x_buf
  tables
    binary_tab         = lt_sda_content
clear : lt_sda_content ,lv_file_length,x_buf .
data : cl_inst type ref to cl_abap_zip .
CREATE OBJECT cl_inst.
CALL METHOD cl_inst->load
   EXPORTING
     zip             = x_buf.
CALL METHOD cl_inst->get
  EXPORTING
    NAME                    = 'inner.zip'
  IMPORTING
    CONTENT                 = x_buf.
Thanks and Regards,
Gaurav

Hi Gaurav Rathi  ,
Even am facing some problem .I cannot open the ZIP file? Can you please tell me where exactly you have corrected your mistake?
Thanks
Dan

Similar Messages

  • How to create a text file or XML file  and add content through  code into it...

    Hi Everyone,
    How to create a text file and add content through the code to the text file eform javascript ......orelse can we create a text file in life cycle designer...
    Else say how to create a new XML file through the code and how some content like Example "Hello World".

    You can create a text file as a file attachment (data object) using the doc.createDataObject and doc.setDataObjectContents:
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.450.html
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.528.html
    You can then export the file with the doc.exportDataObject method:
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.463.html
    This won't work with Reader if it hasn't been given the file attachment usage right with LiveCycle Reader Extensions.

  • How to import a csv file and read  in sap ui5?

    Hi,
    I want to import a file and read it contents to bind it to table.How to do it?
    Thanks in advance.

    I tried to do this all from within the application but found it easier to just start with a JSON file. But, you can use a JS library to convert your CSV into JSON from within the application like this one:
    archan937/csonv.js · GitHub
    I just converted my CSV to JSON. Once you have that, all you need to do is instantiate a model for it and bind to table.
      onInit: function () {
        var oModel = new sap.ui.model.json.JSONModel("PATH TO YOUR JSON FILE");
        this.getView().setModel(oModel);
      <Table id="idProductsTable"
        inset="false"
        items="{
          path: '/ProductCollection',
          sorter: {
            path: 'Name'
        }">
    The UI5 demo kit is a good resource. I believe it'll be same/similar for SAPUI5:
    OpenUI5 SDK - Demo Kit
    See here for example of defining your model and binding to a table:
    sap.m Explored

  • Read a csv file and read the fiscal yr in the 4th pos?

    Hello ABAP Experts,
    how to write a code for read a csv file and read the fiscal year in the 4th position.
    any suggestions or code highly appreciated.
    Thanks,
    BWer

    Hi Bwer,
    Declare table itab with the required fields...
    Use GUI UPLOAD to get the contents of the file (say abc.csv) in case if the file is on the presentation server...
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = 'c:\abc.csv'
       FILETYPE                        = 'ASC'
        WRITE_FIELD_SEPARATOR           = 'X'
      tables
        data_tab                        = itab
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       OTHERS                          = 22
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use OPEN DATASET in case if the file is on the application server..
    After that USE SPLIT command at comma to get the contents of the 4th field...
    Regards,
    Tanveer.
    <b>Please mark helpful answers</b>

  • How to create new .dat file and its contents?

    Hi There
    Can anybody let me know the procedure of how to create new .ctl or .dat file to load data to tables.
    i working on 2day dba chapter 8. it shows me how to creat table and use .dat file to load data. but doesnot giv any clue how new .dat file and its contents can be created. please help.
    thanks in advance.

    Thanks for ur help
    I ve created txt file in notepad and saved it as dat file. tried to load that data thru Enterprise manager. used load data from User files everything went well and job was showing suceeded but dont know why that data is not showing in the table. i ve tried it now for three four times. used right table and pathe but dont know. has anybody got idea why that ll be?
    Thanks

  • Part 2: Flat files and Business Contents: Any issues with this scenario?

    I will appreciate some clarification on the some points made in response to my previous post "Flat files and Business Contents: Any issues with this scenario?"
    1.
    " ...you’d better analyze those cubes for data redundancy and presence of data you’ll never use. " I will appreciate some clarification on the type of analysis you are referring to. Examples will help.
    2.
    "If you want to combine several found IOs in your custom dataprovider, then again you must know (or figure out) relationships between these IOs." I will appreciate some clarification on the type of relationship you are referring to. Examples will help.
    3.
    I am a bit confused with "..include into ODS structure ALL fields required for the cube" but you also noted noted that "...except navigational attributes and chars and KFs that are going to be determined in TRs or URs."
    If you exclude ALL these, haven't you excluded all the fields you included in the ODS structure?
    4.
    "Consider carefully the ODS’ key fields selection. Their combination should not allow data aggregation that you don’t need."
    I may be missing the point here, I understand that you need to select the fields which will form the unique ID for the records in the ODS under the Key Field (please correct me if I am wrong with the purpose of the Key Field), but I don't understand the discussion of "aggregation" in the context.
    Thanks in advance

    Hallo
    I try to give some exaplanation based on the previous answer.
    1. Data redundancy - make sure you do not store the same information. does not make sense to have data redundanty across you Data Warehouse. this is also a cost. just sotre the same information one time if you get all what you need.
    2. whatwhever you build you dp, which consist of IO, you need to know with kind of relation (1:1 or 1:n - n:n and so on) exist between them. that will help you when you model you infoprovider. For example I would never pit togheter IO (n:m) in the same dimension if you expect an high number of cardinality. Sometime an IO can be an attribute of another one (depend on relation. For example
    Business Partner and his Address. Usually you have a relation 1:1, in this case address is an attribute of BParten and store it in the Masterdata instead then DP
    3. Sometime when you load from ODS to CUBE, you can fill some IO (which are in the infocube and not in the ODS)through ABAP routine in TR-Start Routine of Update Rule. Does not make sense to include these IO in the ODS as they are NULL or Blank (the deault value). This can happen when for example, you first load in the ODS (Price and Quantity) and then you calculate Sell price later (Price * Quantity). of course it could be doen also in the Bex. Depends on other factors (Performance - Loaidng -Sizing)
    4. Make sure that the KEY definition of ODS is accordingly to the data otherwise you will aggregate the data and later maybe if you need the detail you miss it.
    for example: customer - product - Distr Chan - Sell Price
    if each Customer can buy each product for any Distrution Channel, then when you build your ODS(Customer - Product and Distribution must be KEY) otherwise (if you have only Customer - Product KEY for example) you will lose the details for Distribution Channel.
    I hope eveyrhting is clear
    Regards
    Mike

  • Feature Request: save metadata to file, and read metadata from file.

    Please have function to save metadata to file, and read metadata from file.
    This would allow us to write cross-platform plugins that can assure data is up-to-date in the xmp, or modify xmp and have it reinstated in the catalog.
    This would go nicely with the ability to save xmp for virtual copies, dng, and rgb formats.

    Perhaps someone with direct experience with publishing to Smugmug will chime in.  Short of that, some thoughts on your issues:
    Should I not bother to "Save Metadata to File", this seems to be what is messing up the SmugMug publish service?
    I very much doubt that it is messing up the publishing.  What gets saved to the file from the catalog is independent of what gets exported.  Saving metadata to the file is generally a good practice (in case you screw up your catalog backups).  Many, perhaps most, users set the preference Catalog Settings > Automatically Write Changes Into XMP.
    I would have expected it to behave like an export which would write synonyms, exclude keywords that should be excluded, etc, which seems to work ok in point 6 above.
    Yes, that's a reasonable expectation.
    You may have done this already, but double-check: Right-click the Smugmug publishing service in the left-hand column of the Library, select Edit Settings, and in the Metadata section verify that you have Include: All Metadata set.
    Did you download the Smugmug plugin from Smugmug? You might try this Smugmug plugin instead -- the author designed the publishing architecture of LR and has an excellent reputation. 
    Are the publish services more effort than they are worth? So I get SmugMug to work, what happens when I try Flickr?
    I think many users find the publishing services are generally worthwhile.  I publish regularly to Flickr (using the built-in Flickr plugin, which isn't completely reliable) and the Zenfolio plugin from Friedl. 

  • Accessing a file and reading its contents.

    Hi all,
    I created a Portal Application to access a file and display its contents in an iView .
    But it showing the exception like "File Not Found".
    In simple java application i could able to get the result. In portal application i couldn't .
    I have given the full path of the file location.
    I need a help regarding this?
    Regards,
    Eben

    IS the file on the portal server? It must be visible to the service user that runs the Java engine...

  • Extracting JAR files and reading their contents

    Hi,
    I have a JAR files which contains classes in different packages also a config file which is also in some package structure.
    I have to read that config file, which will inturn have other file names, i have to read the filename and read the actual content of the file spcified in the config file.
    Can some one help me out with a simple example... ?
    I have tried with java.util.zip... I can read the name of all the files in JAR to any depth.. but couldn't open and read the required file.
    Thanks in advance...
    Thanks & Regards,
    Gurushant Hanchinal

    Hello you can see the content of a jar file with this line
    jar tf filename.jarand extract with
    jar xf filename.jar

  • Upload unicode file and display content in a textarea

    Hi all,
    I am trying to do the following;
    1. upload a unicode file (file with some non-english characters)
    2. after uploading, read the uploaded file and show the content in a textarea in a jsp page.
    I use struts in my project. I use class org.apache.struts.upload.FormFile for uploading the file. The upload works fine. I do the upload with help of FormFile's getInputStream method. When i read and display the content in the textarea, the content is displayed junk. But i tried to open the uploaded file, its fine. I mean it is just as my source file. Please help me out for reading the uploaded unicode and displayed in a textarea.
    Below is the code that i use to upload the file;
    File tempFile = null;
    FileOutputStream fos = null;
    InputStream is = null;
    try {
         tempFile = "c:/ThaiText.txt";
         fos = new FileOutputStream(tempFile);
         is = theFile.getInputStream();
         // Transfer bytes from in to out
         byte[] buf = new byte[1024];
         int len;
         while ((len = is.read(buf)) > 0) {
              fos.write(buf, 0, len);
         logger.info("fileName$$=" + tempFile.getName());
    } catch (Exception e) {
            logger.error(e);
         throw e;
    } finally {
         closeOutputStream(fos);
    }Below is the code that i use for reading the uploaded file's content and store it to a string. I set this string to a form bean's string property.
    public static String readContentNonUTF8(String path) {
         FileInputStream fis = null;
         String value = "";
         try {
              fis = new FileInputStream(path);
              byte[] buf = new byte[1024];
              int len;
              while ((len = fis.read(buf)) > 0) {
                   String tmp = new String(buf, 0, len);
                   value = value.concat(new String(tmp.getBytes()));
         } catch (Exception e) {
              logger.error(e);
         } finally {
              try {
                   fis.close();
              } catch (Exception e) {
         return value;
    }

    Hi,
    Thanks for your reply. You meant that both method also can used to upload file and submit data? How about if i want to use the first method to upload file and submit data? How can i upload the file by using first method?

  • Upload excel file and display content in sapui5 table

    hi:all
       how to upload  excel files and display its contents in the view of sapui5  table ,then  'create ' these data into the abap database using odataservice.
         Do you have any solutions ? I appreciate for your help.

    Two possible way come to mind.
    1. ADF DI (desktop integration): sorry, don't know enough about it to give a how to :-(
    2. POI (http://poi.apache.org/) : open source project to read and write excel file with java. Using POI you can open the .xsl file, read it's contents and display it as af:table. For this you need to read the xsl into a data structure (this can be a temporary db table or a list of POJOs) and build a data control out of it. This you can drop on a page as table.
    Timo
    Edited by: Timo Hahn on 15.02.2010 13:59

  • Uploading Excel File and Reading Data from that File

    <b>Hi
    Can anyone Please tell me how to upload an Excel File in to the Web Dynpro Application and After that i want to read the data from that uploaded excel file in the Web Dynpro Application to the Web Dynpro table.
    Plz help me to solve this.......
    Regards
    Chandran</b>

    Hi,
    Upload Excel file using File Upload UI
    1)Add jxl jar folder in the lib folder of ur project.
    2)Go to properties of ur project and add jar to ur project.
    3)Using the File upload ui ,browse and upload the file.
    4)Write the read file in to ur server location using fileoutput stream.
    5)then using code u can read the excelfile from the server location itself.
    Here is the code:
         IWDAttributeInfo attInfo =wdContext.getNodeInfo().getAttribute("upload");
    /** get the name of excel file and storing it in the server with the same name and extention****/
    binaryType=IWDModifiableBinaryTypeattInfo.getModifiableSimpleType();
    fileuploaded = binaryType.getFileName();
    byte b[] = wdContext.currentContextElement().getUpload();
    File filename =new File("
    <Server name>
    <folde name>
    " + fileuploaded);
    try {
    FileOutputStream out = new FileOutputStream(filename);
    out.write(b);
    out.close();
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    /**Readind from the server**/
    int iRows = 0;
    try {     Workbook wb = null;
         Sheet sheet = null;
         wb = Workbook.getWorkbook(filename);
         sheet = wb.getSheet(0);
         int iColumns = sheet.getColumns();
          iRows = sheet.getRows();
         int i = 0;
        //get Cell contents by (COLUMN, ROW);
        for (int r = 0; r < iRows; r++) {
       for (int c = 0; c < iColumns; c++) {
         Cell cell = sheet.getCell(c, r);
         characterarray<i> = cell.getContents();
    //wdComponentAPI.getMessageManager().reportSuccess("Row"r characterarray<i>);
    i++;
    wb.close();
    Declare Globally
    //@@begin others
    String fileuploaded;
    IWDModifiableBinaryType binaryType;
    String characterarray[] = new String[1000];
    //@@end
    Also look at this blog too  /people/perumal.kanthan/blog/2005/03/21/reading-excel-data-from-java-using-hssf-api
    Thanks and Regards,
    Arun

  • Is there a way to select a certain box of elements from a csv file and read that into LabVIEW?

    Hello all, I was wondering if there was a way to select only a certain "box" of elements from a .csv file in LabVIEW? I have LabVIEW 2011 and my main goal is to take two arrays and graph them against each other. I can import the .csv file just fine and separate each row and each column to be its own, but say I have an 8X8 but want to graph the middle 4X5 or something like that. Is there any way to extract an array without starting at the beginning and without ending at the end? Thank you in advance.
    Solved!
    Go to Solution.

    Hi Szklanam,
    as a CSV file is just a TXT file with a different suffix you can read a certain number of lines of that file. So you can limit the number of rows in your resultung array. To limit the number of columns you still have to use ArraySubset, so maybe it's a lot easier to read the full CSV file and pick the interesting spots with ArraySubset...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Issue regarding open word file and read only mode using c# & MS-word interop

    i am programmatically open a word file for search and highlight keyword. my routine is working fine. the problem is when i am opening the file programmatically then a dialog come and ask me to open file in read only mode. the dialog look like below one
    actually i do not want to open the file in read only mode because people can open and like to change and save. so guide me what i can do to not to open the file in read only mode.
    here is my full code. just have a look and tell me what is wrong in my code or tell me any trick as a result i can open the file not in read only mode. here is my code.
    private void button1_Click(object sender, EventArgs e)
                object fileName = "";
                string filePath = "";
                string strSaveasPath = "";
                DialogResult result = openFileDialog1.ShowDialog();
                if (result == DialogResult.OK)
                    fileName = openFileDialog1.FileName;
                    //strSaveasPath = Path.GetDirectoryName(path.ToString());
                //fileName = "Z:\\C0000000003.doc";
                List<string> _list = new List<string>();
                _list.Add("tridip");
                _list.Add("arijit");
                //object fileName = "D:\\CVArchievePath\\C0000000001.doc";
                object textToFind = "test";
                object readOnly = false;
                Word.Application word = new Word.Application();
                Word.Document doc = new Word.Document();
                object missing = Type.Missing;
                try
                    doc = word.Documents.Open(ref fileName, ref missing, ref readOnly,
                                              ref missing,
    ref missing, ref missing,
                                              ref missing,
    ref missing, ref missing,
                                              ref missing,
    ref missing, ref missing,
                                              ref missing,
    ref missing, ref missing,
                                              ref missing);
                    doc.Activate();
                    object matchPhrase = false;
                    object matchCase = false;
                    object matchPrefix = false;
                    object matchSuffix = false;
                    object matchWholeWord = false;
                    object matchWildcards = false;
                    object matchSoundsLike = false;
                    object matchAllWordForms = false;
                    object matchByte = false;
                    object ignoreSpace = false;
                    object ignorePunct = false;
                    object highlightedColor = Word.WdColor.wdColorGreen;
                    object textColor = Word.WdColor.wdColorLightOrange;
                    object missingp = false;
                    Word.Range range = doc.Range();
                    foreach (string line in _list)
                        textToFind = line;
                        bool highlighted = range.Find.HitHighlight(ref textToFind,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing,
    ref missing);
                    System.Diagnostics.Process.Start(fileName.ToString());
                catch (Exception ex)
                    Console.WriteLine("Error : " + ex.Message);
                    //Console.ReadKey(true);
                finally
                    //doc.Close(missing, missing, missing);
                    if(doc!=null)
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(doc);
                    if (word != null)
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(word);
                    word = null;
                    doc = null;
                    GC.Collect();
                    GC.WaitForPendingFinalizers();

    I know it's a very old issue and I reached to this page looking for a solution. Finally, I have found a fix to this problem.
    The problem is that we create an instance of Word and do not close it correctly. This makes program believe that the file is already open and hence you're getting the respective message of file being locked by you.
    Set the visibility of your application to true and then when you close it both file and instance should close and you will not get the problem again.

  • Get user input and find file and read it.....argh

    Ok, so I have to write a program that asks a user for the name of the file they want opened and then it is to read it and then display the max score and the minimum score on the file. also to display the average score on the file. Along with that it is supposed to display how many As, Bs, Cs, Ds, and Fs were on the file IE: a: 1 b: 3 c: 0 d: 4 f: 1. etc.
    Also, the next part is to have the program open the input file and then write all the information to an output file. I was able to do this and have the output file show the peoples names and their score along wtih their grade adn then the whole score average at the end of the output file....
    My question is how do I do the first part by asking the user for the name of file and then for the program to find the file and then display the max, min, average and how many letter grades the class got?

    this is what i have so far and the code before didnt work with JCreator, came up with lots of errors......
    What do i have to do to get the max value and min value to display along with the amount of As, Bs, Cs, Ds, and Fs????
    import java.io.*;
    class extest
    public static void main(String [] args) throws IOException
    // First, open the input file
    TextReader filein = new TextReader(new FileInputStream("test.txt"));
    // Read our number
    int x;
    x = filein.readInt();
    String [] first=new String[x];
    String [] last=new String[x];
    int [] score=new int[x];
    // load data from the input file test1.txt
    for (int i=0; i<x; i++)
    first=filein.readWord();
    last[i]=filein.readWord();
    score[i]=filein.readInt();
         WriteTestFile(first, last, score, x);
    public static void WriteTestFile(String f[], String last[], int score[], int x)
    double average=0;
    // Next, open the output file
    try
    PrintWriter fileout = new PrintWriter(
    new FileWriter("grade.txt") );
    // OK, now write to the file
    fileout.println(x);
    for (int i=0; i<x; i++)
    average=average+score[i];
    if (score[i]>90)
    fileout.println(f[i]+" "+last[i]+" " + score[i] +": "+"A");
    else if (score[i]>80)
    fileout.println(f[i]+" "+last[i]+ " " + score[i] + ": "+"B");
    else if (score[i]>70)
    fileout.println(f[i]+" "+last[i]+ " " +score[i] + ": "+"C");
    else if (score[i]>60)
    fileout.println(f[i]+" "+last[i]+ " " +score[i] + ": "+"D");
    else
    fileout.println(f[i]+" "+last[i]+" " +score[i] + ": "+"F");
    fileout.println("The average score of the class is "+average/x);
    // we're done with the output file
    fileout.close();
    catch (IOException e)
    throw new RuntimeException(e.toString());
    System.out.println("***** Welcome to the Grade Program! *****");
         System.out.println("");
         System.out.println("Please enter the name of the file you want to open: ");
         TextReader input = new TextReader(System.in);
         String fileName = input.readLine();
    System.out.println("The average of the scores is: "+average/x);
    System.out.println("The maximum score is: ");
    System.out.println("The minimum score is: ");
    System.out.println("Number of scores by letter grade:");
    System.out.println("A: ");
    System.out.println("B: ");
    System.out.println("C: ");
    System.out.println("D: ");
    System.out.println("F: ");

Maybe you are looking for

  • Discrepancy in the table payr, need urgent help

    Dear All, i have one table payr in logical database. 2 fields of it i,e kunnr and vblnr When i goto se16 and select the data for say kunnr = '2901350' and vblnr = '20002000' Now what happens for this combination i get no data found. but say i enter o

  • Photoshop CS6 trial not downloading

    I recently downloaded a free trial of Creative Cloud. When I open Adobe Application Manager, I've been able to download/open/"try" Premiere Pro CS6, but when click "Try" in order to download a Photoshop CS6 trial, it automatically says "Download erro

  • Functions: Oracle VM Manager vs. Grid Control Oracle VM Management Update

    Hello guys, i have seen both tools .. and i have to say that some really basic functions are missing in the Oracle VM management addon for Grid Control 10.2.0.5 .. just some examples: - Renaming virtual machines (because of the prefix syntax is not v

  • ST22 Dumps: Shared Objects

    Hi SDN, in our SRM System, SRM Server 5.5, WAS700 ABAP, we get ST22 Short Dumps concerning "shared objects". This is the Dump Short Analysis: Runtime Errors         SYSTEM_NO_SHM_MEMORY                                     Date and Time          19.08

  • It will not launch on my PPC Mac running OS 10.5.8

    Trying to run FireFox 4.0b10 on my PPC G5 Mac running OS 10.5.8. Will it only run on an Intel Mac? Keep getting the error "Will not run on this machine".