Append data to an excel table

I want to append new numerical data to an existing excel table.

If you are using ActiveX to write to an open Excel document, you can ask Excel how many rows are currently in the document.
From the reference for WorkSheet, wire a property node and select UsedRange. Cascade that into another property node and select Rows. Cascade that into another property node and select Count.
This will return the number of rows that have been written. Just add 1 and use that number for your starting address.
Michael
ABCDEF
Michael Munroe, ABCDEF
Certified LabVIEW Developer, MCP
Find and fix bad VI Properties with Property Inspector
Attachments:
Excel_Get_Used_Range.vi ‏48 KB

Similar Messages

  • Datapump : How to append data in an existing table

    Hello Everyone,
    We are new to Datapump.
    We try to extract data from one user/schema and to append it into another user/schema.
    First we tried Tt use the parameter table_exists_action=append during the importation but we receive this error (but the rows are appended):
    ORA-39152: Table "XXXXX"."YYYYY_ZZZ" exists. Data will be appended to existing table but all dependent metadata will be skipped due to table_exists_action of append
    Which I don't expect since the utility have been told to, indeed, append data.
    Next we tried to use CONTENT=DATA_ONLY on exportation and importation but the importation never end.
    How can we append data into a table's user/schema without having an error?
    Best regards.
    Carl

    IGNORE=Y during the import.it does the same operation. if the table already exists,it ignores and proceed with importing/appending data to the tables. same way, they do have indexes=n and constraints=n option.
    both export/import have equivalent options for fitering to our requirement and datapump has one step above classic import in which you can filter upto metadata object as well.

  • Appending data from amultiple internal tables

    Hi Experts,
    I need to append data from more than one internal tables to one internal table. But the internal tables has different structure.
    For example, I have internal tables I_A550 table which has field KNUMH, and I_A573 which has same filed KNUMH. Same way I have 25 tables, and all have KNUMH field.
    Now I have taken an internal table I_AXXX which has only one field KNUMH. I need to transfer data from all those 25 tables to I_AXXX.
    I wrote code as below.
    LOOP AT I_A550
       MOVE I_A550-KNUMH to I_AXXX-KNUMH.
       APPEND I_AXXX.
    ENDLOOP.
    LOOP AT I_A573.
        MOVE I_A573-KNUMH to I_AXXX-KNUMH.
        APPEND I_AXXX.
    ENDLOOP.
    But instead of writing 25 loops, is there any way we can simplify this?
    Thanks in advance.

    Hi,
    Just use field-symbols for your purpose as follows:-
    See the example below
    TYPES: BEGIN OF y_t_final,
           matnr TYPE matnr,
           END OF y_t_final.
    TYPES: y_tt_final TYPE STANDARD TABLE OF y_t_final.
    data : WA_mara type mara,
           wa_mard type mard.
    DATA : itab  TYPE STANDARD TABLE OF mara.
    DATA : itab1 TYPE STANDARD TABLE OF mard.
    DATA : it_final TYPE STANDARD TABLE OF y_t_final.
    DATA : wa_final TYPE y_t_final.
    wa_mara-matnr = '1'.
    append wa_mara to itab.
    wa_mard-matnr = '2'.
    append wa_mard to itab1.
    PERFORM f_loop USING  itab
                   CHANGING it_final.
    PERFORM f_loop USING  itab1
                   CHANGING it_final.
    The code inside the perform is as follow:-
    FORM f_loop  USING    p_itab TYPE ANY TABLE
                 CHANGING p_it_final TYPE y_tt_final.
      FIELD-SYMBOLS : <fs>     TYPE ANY TABLE,
                       <wa>    TYPE ANY,
                       <field> TYPE ANY.
      DATA: l_data TYPE REF TO data.
      ASSIGN p_itab TO <fs>.
      IF <fs> IS ASSIGNED.
        CREATE DATA l_data LIKE LINE OF <fs>.
        ASSIGN l_data->* TO <wa>.
        IF <wa> IS ASSIGNED.
          LOOP AT <fs> INTO <wa>.
            ASSIGN component 'MATNR' of structure <wa> TO <field>.
            IF <field> IS ASSIGNED.
              MOVE <field> TO wa_final-matnr.
              append wa_final to p_it_final.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDFORM.
    I hope you can understand the concept.
    Regards,
    Ankur Parab

  • Append data to a temporary table in Data Serices

    Folks,
    The job in data services that we have, has multiple work flows that try to append the data to the same target in multiple stages. I was wondering if there is a way to have a temporary table created within Data services where data can be appended to the temp table in each stage and at the end of all stages, the temporary table is mapped to the data target (BW datasource) in our case. I am not sure if data transfer transformation can be used for temp table storage, but can someone please advise if there is a way to do it.
    Best regards,
    Doniv

    Hi,
    For temp table just drag the table icon from the right side or menu pane.
    Connect to a query transform and run the job.
    You need to run the job atleast once for creating the table. After running the job once, double click the table and uncheck the two options i mentioned above from options.
    Then proceed with further runs to append the table with records.
    Hope this helps.
    Arun

  • Append data to a nested table within structure

    I am trying to write some code (not really an ABAPer but helping out) and my code is not quite working.
    i have a structure that is made up of up three tables and a structure.  it is part of an DIMP add on.
    I have typed my tables and structures and tables in line with target definition, however my data is not being passed across...
    i have tried a number of different ways of doing this, but have been unsuccessful.  I am sure i am close, but would like some guidance...
             LOOP AT gt_mpdcycle INTO gs_mpdcycle.
                APPEND gs_mpdcycle TO gs_create_mpd-cycledata.
                INSERT gs_create_mpd-cycledata INTO gs_create_mpd.
              ENDLOOP.
    the gs_create_mpd is typed to the overall structure...  the gt_mpdcycle is typed to table of mpdcycle and gs_mpdcycle is typed to mpdcycle structure.  the gs_create_mpd-mpdcycle is typed as type table of mpdcycle.
    i have also tried the following:
    gs_create_mpd-cycledata[] = gt_mpdcycle[].
    and
    INSERT gt_mpdcycle INTO gs_create_mpd-cycledata.
    does that make sense?  can someone suggest a way of doing this?

    I knew i was close!
              LOOP AT gt_mpdcycle INTO gs_mpdcycle.
                APPEND gs_mpdcycle TO gs_create_mpd-cycledata.
    *            INSERT gs_create_mpd-cycledata INTO gs_create_mpd.
              ENDLOOP.

  • How to append data from an internal table to an external table.

    HI everyone,
    I am trying to update an DB table type 'c'from the data captured in my internal table. can any one tell me as to how to do this.the contents of the DB table needs to be erased completly before i send in new data.
    Regards,
    Vj

    Assuming that you table has 1 character field(?) besides the MANDT field
    MANDT
    FIELD
    you need to update this db table with values from ITAB which I assume has one field of type c.
    To first delete all of the data from DB table.
    * Yes there are other ways of doing this.
    tables: ztable.
    select * from ztable.
    delete ztable.
    endselect.
    Then simply LOOP your internal table and update the table.
    loop at itab.
      ztable-field = itab-field.
      insert ztable.
    endloop.
    Regards,
    Rich Heilman

  • Selective excel table import/export

    I need to run an SQL script that will selectively (select * from <TABLE> where <"TransactionRunDate" older than 6 months from SystemDate>) remove all rows from three table and simultaneously write them into excel sheets. Then, I need an SQL script that can restore the data from these Excel tables into the Oracle tables (on demand)
    How can I do this without right clicking import/export on the GUI (SQLDeveloper), but with SQL script alone?
    Edited by: user10403078 on Oct 7, 2008 11:32 PM

    I would half agree with daniel and half not agree.
    You can't but you can. As for whether you should is a different matter.
    I say you can because it's possible to do something like you are looking for. You could even get it to write out Excel workbooks with worksheets using Microsofts office XML format and then use an ODBC connection to read the data back again into an Oracle database using Heterogeneous services, but it's complicated and not easily demonstrated with what little time I have.
    However, an alternative is to write the data out to CSV files and then use External tables to read those CSV files back again. Example...
    Firstly, here's my table with some data in it, some of which is more than 6 months old...
    SQL> select * from table1;
            ID CREATED_DATE        TXT
             1 13/12/2007 09:31:08 Old Fred
             2 01/02/2008 09:31:08 Old Bob
             3 22/03/2008 09:31:08 Old Jim
             4 11/05/2008 09:31:08 Young Fred
             5 30/06/2008 09:31:08 Young Bob
             6 19/08/2008 09:31:08 Young Jim
             7 08/10/2008 09:31:08 New Me
    7 rows selected.Now, I create a DELETE trigger on that table so if any rows are deleted this will fire. To allow for rows less than 6 months old to be deleted without being archived to file I put a check in the trigger too...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace trigger trg_del
      2  after delete on table1
      3  for each row
      4  declare
      5    v_dir  VARCHAR2(30) := 'TEST_DIR';
      6    v_file VARCHAR2(30) := 'table1_archive.csv';
      7    v_fh   UTL_FILE.FILE_TYPE;
      8  begin
      9    IF months_between(sysdate, :OLD.created_date) >= 6 THEN
    10      -- Only archive a deleted row if it's greater than 6 months old
    11      v_fh := UTL_FILE.FOPEN(v_dir, v_file, 'a', 32767);
    12      UTL_FILE.PUT_LINE(v_fh, TO_CHAR(:OLD.ID,'fm9999')||','||TO_CHAR(:OLD.CREATED_DATE,'YYYYMMDDHH24MISS')||',"'||:OLD.TXT||'"');
    13      UTL_FILE.FCLOSE(v_fh);
    14    END IF;
    15* end;
    SQL> /
    Trigger created.So now, I have a trigger that will write deleted rows of data out in CSV format to a file called table1_archive.csv.
    Now I can create an external table that can read that CSV file...
    SQL> ed
    Wrote file afiedt.buf
      1  CREATE TABLE table1_archive (
      2         id            NUMBER,
      3         created_date  DATE,
      4         txt           VARCHAR(200)
      5         )
      6  ORGANIZATION EXTERNAL (
      7    TYPE oracle_loader
      8    DEFAULT DIRECTORY TEST_DIR
      9      ACCESS PARAMETERS (
    10      RECORDS DELIMITED BY NEWLINE
    11      BADFILE 'bad_%a_%p.bad'
    12      LOGFILE 'log_%a_%p.log'
    13      FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    14      MISSING FIELD VALUES ARE NULL
    15      REJECT ROWS WITH ALL NULL FIELDS
    16        (id
    17        ,created_date date "yyyymmddhh24miss"
    18        ,txt)
    19      )
    20      LOCATION ('table1_archive.csv')
    21    )
    22  PARALLEL
    23  REJECT LIMIT 0
    24* NOMONITORING
    SQL> /
    Table created.
    {code}
    And now we can prove it works...
    Firstly, delete rows from the table that are 6 months or more old...
    {code}
    SQL> delete from table1
      2  where months_between(sysdate, created_date) >= 6;
    3 rows deleted.
    SQL> select * from table1;
            ID CREATED_DATE        TXT
             4 11/05/2008 09:31:08 Young Fred
             5 30/06/2008 09:31:08 Young Bob
             6 19/08/2008 09:31:08 Young Jim
             7 08/10/2008 09:31:08 New Me
    {code}
    So those rows have been deleted, now let's check they're in the archive CSV file...
    {code}
    SQL> select * from table1_archive;
            ID CREATED_DATE        TXT
             1 13/12/2007 09:31:08 Old Fred
             2 01/02/2008 09:31:08 Old Bob
             3 22/03/2008 09:31:08 Old Jim
    SQL>
    {code}
    There they are, and that CSV file can also be read by Excel if required.
    Let's just check that we don't archive rows that are deleted if they are less than 6 months old...
    {code}
    SQL> delete from table1 where id = 6;
    1 row deleted.
    SQL> select * from table1;
            ID CREATED_DATE        TXT
             4 11/05/2008 09:31:08 Young Fred
             5 30/06/2008 09:31:08 Young Bob
             7 08/10/2008 09:31:08 New Me
    SQL> select * from table1_archive;
            ID CREATED_DATE        TXT
             1 13/12/2007 09:31:08 Old Fred
             2 01/02/2008 09:31:08 Old Bob
             3 22/03/2008 09:31:08 Old Jim
    SQL>
    {code}
    So that row was deleted without being archived.  Just what I intended.

  • How to import data into a Z table from excel file?

    hi,
    i have a custom created Z table into which i want to import some data from an excel file. which function can i use to do so because SE16 allows me to insert data only one by one via a data entry screen. this is time consuming. i want to import data from excel file so that its faster.

    HI,
    this program uploads data from excel and modifies ztable,(inserts records into ztable), check this and modify according to ur requirement)
    This program uploads material number from excel sheet and does
    ******modifications to material number if required by the user
    ******and updates the table zmatnr with new material against the old material number
    REPORT  zmat_no message-id zebg.
    TYPE-POOLS  truxs.
    TABLES:zmatnr.
    DATA : itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    DATA row LIKE alsmex_tabline-row.
    data : g_matnr like mara-matnr.
    data : count type i.
    data : itab_count type i.
    data : gi_final like zmatnr occurs 0 with header line.
    *data : begin of gi_final occurs 0,
          mat_old like mara-matnr,
          mat_new like mara-matnr,
          end of gi_final.
    ***********************Selection Screen*************************
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETER : pfname LIKE rlgrap-filename OBLIGATORY.
    select-options : records for count.
    SELECTION-SCREEN END OF BLOCK b1.
    *********************At Selection Screen*************************
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfname.
      PERFORM search.
    START-OF-SELECTION.
    perform process.
    form process.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = pfname
          i_begin_col             = 1
          i_begin_row             = 2
          i_end_col               = 12
          i_end_row               = 65000
        TABLES
          intern                  = itab
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      describe table itab lines itab_count.
       row = 1.
      loop at itab.
        if itab-row <> row.
          append gi_final.
          clear gi_final.
        endif.
        case itab-col.
          when '1'.
          CLEAR G_MATNR.
          gi_final-OLD_MATNR = itab-value.
          CONCATENATE 'NEW' gi_final-old_matnr INTO itab-value.
            gi_final-new_MATNR = itab-value.
          endcase.
        row = itab-row.
      append gi_final.
      clear gi_final.
      endloop.
      CALL FUNCTION 'PROGRESS_INDICATOR'
      EXPORTING
        I_TEXT  = 'File Has Been Successfully Uploaded from Workstation ' .
      if not gi_final[] is initial.
        if not records-low is initial .
          if not records-high is initial.
            records-high = records-high + 1.
            DESCRIBE TABLE gi_final LINES count.
            IF records-high < count.
              DELETE gi_final FROM records-high TO count.
            ENDIF.
            IF records-low <> 1.
              IF records-low <> 0.
                DELETE gi_final FROM 1 TO records-low.
              ENDIF.
            ENDIF.
          endif.
        endif.
      endif.
      IF NOT GI_FINAL[] IS INITIAL.
        CALL FUNCTION 'PROGRESS_INDICATOR'
         EXPORTING
           I_TEXT  = 'Processing zmatnr table'
           I_OUTPUT_IMMEDIATELY = 'X'.
          if itab_count <> count.
             message i000 with 'records are not matching'.
             exit.
          else.
             modify zmatnr from table gi_final.
             message i000 with 'data base table modified successfully'.
          endif.
      endif.
    endform.
    *&      Form  search
          text
    -->  p1        text
    <--  p2        text
    FORM search .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          static    = 'X'
        CHANGING
          file_name = pfname.
    ENDFORM.                    " search
    regards
    siva

  • Excel Table with SharePoint Data Connection - Manual Text Entry Misaligned After Refresh

    Greetings!
    I have an Excel 2010 workbook that includes a table linked to my SharePoint 2013 site by a data connection. The SharePoint list feeds the table standard information that's managed on the SharePoint site, but I need the user of the Excel workbook to be able
    to enter text manually in the workbook to associate local information with the line-items coming from the SharePoint list. To do this, I've added extra columns to the end of the table.
    The user can enter information in the appropriate cells in the "extra" columns at the end of the table, but when I refresh the data connection, the addition of a new list item on the SharePoint side results in the user's manually entered text getting
    out of alignment with the row it's supposed to be associated with.
    Example
    Column 1(SP)
    Column 2(Extra)
    Row 1
    Item 1
    Row 2
    Item 2
    Text entered for Item 2
    Row 3
    Item 3
    Then, if I add a new item to the list in SharePoint, for example, something that would appear between the original items 1 & 2, after refreshing the table, I get the following:
    Column 1(SP)
    Column 2(Extra)
    Row 1
    Item 1
    Row 2
    New Item 1.5
    Text entered for Item 2
    Row 3
    Item 2
    Row 4
    Item 3
    The table's data connection is set to insert rows for new items, and I could swear I had this working properly once upon a time...but I can't seem to make it work now.
    Any thoughts on what would cause this?
    Thanks in advance!

    Hi Eric,
    >>but it seems that by extending the table itself to encompass both the SharePoint-sourced columns and the additional columns, that an association would be created between all columns for a given row in the table, no?<<
    From my understanding, the answer is no.
    Another example:
    I have an additional column named "Column2" and an external column named "ID" (see "before").
    After I add a new record and refresh this table, Excel will keep the last row in "column2" and add an empty cell in the second last row. (See "After")
    If I delete the eighth data and refresh this table, Excel will still keep the last row and remove the last second cell.
    In your case, if you insert a new record in the middle of the data and refresh this table, Excel will synchronized the external data and add a new cell in the additional column in the second last row.
    From my understanding, Excel will always change the second last row to suit for deleting or adding record.
    Hope this helps.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Excel Table with Data Connection Manual Text Entry Misaligned After Refresh

    Greetings!
    I have an Excel 2010 workbook that includes a table linked to my SharePoint 2013 site by a data connection. The SharePoint list feeds the table standard information that's managed on the SharePoint site, but I need the user of the Excel workbook to be able
    to enter text manually in the workbook to associate local information with the line-items coming from the SharePoint list. To do this, I've added extra columns to the end of the table.
    The user can enter information in the appropriate cells in the "extra" columns at the end of the table, but when I refresh the data connection, the addition of a new list item on the SharePoint side results in the user's manually entered text getting
    out of alignment with the row it's supposed to be associated with.
    Example
    Column 1(SP)
    Column 2(Extra)
    Row 1
    Item 1
    Row 2
    Item 2
    Text entered for Item 2
    Row 3
    Item 3
    Then, if I add a new item to the list in SharePoint, for example, something that would appear between the original items 1 & 2, after refreshing the table, I get the following:
    Column 1(SP)
    Column 2(Extra)
    Row 1
    Item 1
    Row 2
    New Item 1.5
    Text entered for Item 2
    Row 3
    Item 2
    Row 4
    Item 3
    The table's data connection is set to insert rows for new items, and I could swear I had this working properly once upon a time...but I can't seem to make it work now.
    Any thoughts on what would cause this?
    Thanks in advance!

    Yes, it is. I realized after posting the first time, that I'd assigned the question to the Visio forum. I wasn't sure how to reassign to the correct (Excel) forum, so I re-posted over there:
    http://social.msdn.microsoft.com/Forums/en-US/b3bbe00c-94c0-48d4-bed9-fbd08d707b1d/excel-table-with-sharepoint-data-connection-manual-text-entry-misaligned-after-refresh?forum=exceldev

  • Appending data from one table to another

    Hello
    How to append data from one table t1 to another table t2.
    t1 and t2 have the same structures .
    t2 contains already data so i don't want do delete it and create it as select * from t1.
    If there is a mean to add t1 content without altering t2 content.
    Thanks in advance

    insert into t2
      select * from t1

  • Looking for example to export data from a DynPro table to Excel file

    Hello,
    I have a certain content in a table.
    I would like to export this content to Excel file and let the user save it on his PC. I tried to use the Office Controller but with no success.
    Have someone already made something like this and can show me an example?

    Hi
    I already explained this in another post. Anyway i will cut and paste the same for you.Here you go.Sample way to create a Excel file and then download it to a local pc using a FileUI Download element.
    We are developing a generic component for the same requirement which will download data to a excel from any table.
    Anyway here is something which will give you some kind of idea as to how you can write the data from WebDynpro to a excel file.
    For running this application
    Ensure that the requisite JAR files are set for the Excel API's. See the blog link below.
    Steps :
    All your files in the machine running the WAS will be created in the default location
    Alias : webdynpro/resources
    Path : <Drive>:/usr/sap/J2E/JC00/j2ee/cluster/server0/temp/webdynpro/web
    You can open your Visual Administrator and go to HTTP provider service and then create your own Alias. say
    Alias : myAlias
    Path : <Drive>:/mydirectory/myfiles
    Once this is done restart your WebAS.
    The code explained will perform the following.
    There is a button UI element and a Download UI element. On click of the Action associated with the button ui element
    The code below will create a excel file in the location mentioned.
    On click of the download UI element you can view the excel file that was created.
    Now create a New project in your NWDS
    Follow the blog for importing the necessary jar files for Excel
    /people/perumal.kanthan/blog/2005/03/21/reading-excel-data-from-java-using-hssf-api
    Once that is done you can create say a button in your Webdynpro and associate it with a action.
    Then you can write some code like the one below.
    //Declare this in the end between the Begin others block.
      private FileOutputStream out = null;
      private HSSFWorkbook workBook = null;
      private HSSFSheet hsSheet = null;
      private HSSFRow row = null;
      private HSSFCell cell = null;
      private HSSFCellStyle cs = null;
      private HSSFCellStyle cs1 = null;
      private HSSFCellStyle cs2 = null;
      private HSSFDataFormat dataFormat = null;
      private HSSFFont f = null;
      private HSSFFont f1 = null;
    //Code to create the Excel.
      public void onActionExportToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionExportToExcel(ServerEvent)
        try
          out = new FileOutputStream("C:/mydirectory/myfiles/testexcel.xls");
          workBook = new HSSFWorkbook();
          hsSheet = workBook.createSheet("My Sheet");
          cs = workBook.createCellStyle();
          cs1 = workBook.createCellStyle();
          cs2 = workBook.createCellStyle();
          dataFormat = workBook.createDataFormat();
          f =  workBook.createFont();
          f1 = workBook.createFont();
           f.setFontHeightInPoints((short) 12);
    //          make it blue
           f.setColor( (short)HSSFFont.COLOR_NORMAL );
    //           make it bold
    //          arial is the default font
           f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    //          set font 2 to 10 point type
           f1.setFontHeightInPoints((short) 10);
    //          make it red
           f1.setColor( (short)HSSFFont.COLOR_RED );
    //          make it bold
           f1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
          f1.setStrikeout(true);
          cs.setFont(f);
          cs.setDataFormat(dataFormat.getFormat("#,##0.0"));
    //       set a thick border
         cs2.setBorderBottom(cs2.BORDER_THICK);
    //       fill w fg fill color
         cs2.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND);
        cs2.setFillBackgroundColor((short)HSSFCellStyle.SOLID_FOREGROUND);
    //       set the cell format to text see HSSFDataFormat for a full list
         cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
         cs2.setFont(f1);
         cs2.setLocked(true);
         cs2.setWrapText(true);
         row = hsSheet.createRow(0);
         hsSheet.createFreezePane(0,1,1,1);
        for(int i=1; i<10;i++)
           cell = row.createCell((short)i);
          cell.setCellValue("Excel Column "+i);
          cell.setCellStyle(cs2);
         workBook.write(out);
         out.close();
    //Read the file that was created.
         FileInputStream fin = new FileInputStream("C:/mydirectory/myfiles/testexcel.xls");
         byte b[] = new byte[fin.available()];
         fin.read(b,0,b.length);
         fin.close();
         wdContext.currentContextElement().setDataContent(b);
        catch(Exception e)
          wdComponentAPI.getComponent().getMessageManager().reportException("Exception while reading file "+e,true);  
        //@@end
    You can now add a Download UI Element to the layout.
    Create a Context Attribute say "dataContent" and this should be of Type Binary.
    The Data property of the File UI download element should be mapped to dataContent.
    In the init method write code like
    This is done for the download element.
         IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute("dataContent");   
         IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();
    //In addition the FileDownload UI element needs for defined resource types  
         binaryType.setFileName("testexcel.xls");
         binaryType.setMimeType(WDWebResourceType.XLS);
    Hope that helps you. Anyway its a sample and it should be helpful for you to see how you can modify it and of course maintain some standards in coding unlike the test sample given above :).
    Let me know if you require further clarifications
    regards
    ravi

  • How to export data from a Dynpro table to Excel file?

    Hi
    Here I go again. I read the post <b>Looking for example to export data from a DynPro table to Excel file</b> and put the code lines into a Web Dynpro Project where we need to export a dynpro table to Excel file but exactly at line 23 it doesn't recognize <b>workBook = new HSSFWorkbook();</b>
    1     //Declare this in the end between the Begin others block.
    2     
    3     private FileOutputStream out = null;
    4     private HSSFWorkbook workBook = null;
    5     private HSSFSheet hsSheet = null;
    6     private HSSFRow row = null;
    7     private HSSFCell cell = null;
    8     private HSSFCellStyle cs = null;
    9     private HSSFCellStyle cs1 = null;
    10     private HSSFCellStyle cs2 = null;
    11     private HSSFDataFormat dataFormat = null;
    12     private HSSFFont f = null;
    13     private HSSFFont f1 = null;
    14     
    15     //Code to create the Excel.
    16     
    17     public void onActionExportToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    18     {
    19     //@@begin onActionExportToExcel(ServerEvent)
    20     try
    21     {
    22     out = new FileOutputStream("C:/mydirectory/myfiles/testexcel.xls");
    23     workBook = new HSSFWorkbook();
    24     hsSheet = workBook.createSheet("My Sheet");
    25     cs = workBook.createCellStyle();
    26     cs1 = workBook.createCellStyle();
    27     cs2 = workBook.createCellStyle();
    28     dataFormat = workBook.createDataFormat();
    29     f = workBook.createFont();
    30     f1 = workBook.createFont();
    31     f.setFontHeightInPoints((short) 12);
    32     // make it blue
    33     f.setColor( (short)HSSFFont.COLOR_NORMAL );
    34     // make it bold
    35     // arial is the default font
    36     f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    37     
    38     // set font 2 to 10 point type
    39     f1.setFontHeightInPoints((short) 10);
    40     // make it red
    41     f1.setColor( (short)HSSFFont.COLOR_RED );
    42     // make it bold
    43     f1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    44     f1.setStrikeout(true);
    45     cs.setFont(f);
    46     cs.setDataFormat(dataFormat.getFormat("#,##0.0"));
    47     
    48     // set a thick border
    49     cs2.setBorderBottom(cs2.BORDER_THICK);
    50     
    51     // fill w fg fill color
    52     cs2.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND);
    53     cs2.setFillBackgroundColor((short)HSSFCellStyle.SOLID_FOREGROUND);
    54     // set the cell format to text see HSSFDataFormat for a full list
    55     cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
    56     cs2.setFont(f1);
    57     cs2.setLocked(true);
    58     cs2.setWrapText(true);
    59     row = hsSheet.createRow(0);
    60     hsSheet.createFreezePane(0,1,1,1);
    61     for(int i=1; i<10;i++)
    62     {
    63     cell = row.createCell((short)i);
    64     cell.setCellValue("Excel Column "+i);
    65     cell.setCellStyle(cs2);
    66     }
    67     workBook.write(out);
    68     out.close();
    69     
    70     //Read the file that was created.
    71     
    72     FileInputStream fin = new FileInputStream("C:/mydirectory/myfiles/testexcel.xls");
    73     byte b[] = new byte[fin.available()];
    74     fin.read(b,0,b.length);
    75     fin.close();
    76     
    77     wdContext.currentContextElement().setDataContent(b);
    78     }
    79     catch(Exception e)
    80     {
    81     wdComponentAPI.getComponent().getMessageManager().reportException("Exception while reading file "+e,true);
    82     }
    83     //@@end
    84     }
    I don't know why this happen? Any information I will appreciate it.
    Thanks in advance!!!
    Tokio Franco Chang

    After test the code lines appears this error stacktrace:
    [code]
    java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
         at com.sap.tc.webdynpro.progmodel.api.iwdcustomevent.ExportToExcel.onActionAct1(ExportToExcel.java:232)
         at com.sap.tc.webdynpro.progmodel.api.iwdcustomevent.wdp.InternalExportToExcel.wdInvokeEventHandler(InternalExportToExcel.java:147)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
         at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:252)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:392)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)
    Thanks in advance!!!
    Tokio Franco Chang
    [/code]

  • Want to copy/append data in one table to another

    Hi,
    I have two similar tables Alo_table and Alo_table_test with different indexes, partitions etc.
    Alo_table has some data. I want to copy/append this data in to Alo_table_test for further testing. How to copy/append data without changing the other settings from Alo_table to Alo_table_test?
    Thanks in advance,
    S

    May be you are Looking for MERGE statement
    It will Insert New Record if not Found to your Destinamtion table or Update if Record Found
    MERGE INTO bonuses B
    USING (
      SELECT employee_id, salary
      FROM employee
      WHERE dept_no =20) E
    ON (B.employee_id = E.employee_id)
    WHEN MATCHED THEN
      UPDATE SET B.bonus = E.salary * 0.1
    WHEN NOT MATCHED THEN
      INSERT (B.employee_id, B.bonus)
      VALUES (E.employee_id, E.salary * 0.05);

  • A question in appending data to excel

    Hi,
    Just a quick question, when I tried to use "write file" component of transactions to append data (eg. 00012345) to .csv file, Excel automatically converted  it from "00012345" to "12345" . Anyone can tell me how to modify the expression in the Link Editor to resolve this problem?
    Thanks..

    Be sure that the value is in quotation marks, as in "000012345", in the CSV file.  This might give Excel the "hint" that it is to be treated as a string, not a number.

Maybe you are looking for

  • Bluetooth sync with clarion stereo

     I recently purchased a Bluetooth device for my Clarion car stereo. It synced fine,but  they can hear me, I can't hear the other end of the conversation. Everything is hooked up right as far as connecctions go,I was just wondering if there is a certa

  • I need help for my fading out,in animation : how to add a link to your animation ?

    i really want to know how to add link to your animation . well when i passe the mouse over my animation it stops and when i leave it the animation continue... but what i want when the mouse over the animation i want to click on the animation and to b

  • Report written to a file.

    Hi: I am temporarily working for a company that is still using forms 4.5 and report 2.5 for its GUI interfaces. I was wondering if it is possible to use run_product to run a reports that creates a file in a format like pdf(Acrobat) or rtf (Rich Text

  • Extreme Syncing Problems

    Whenever I try to sync my ipod (second Generation), bad things happen. First off, When itunes opens up, it normally says that it cannot connect to itunes store. Though when I go to the store part of itunes it works fine. Second, I always get a proble

  • Best way to change the actual physical dimensions of an avi file?

    Hey all, So I'm trying to figure something out, and it seems like it SHOULD be a simple thing... but I haven't been able to find the answer. I'm importing an avi file (from Poser 9) into AE 5.5. The dimensions are 1200x900. There need to be 48 copies