Naming of Excel sheets or tab in SSRS

I am making a report in SSRS that will be exported to Excel. It displays data from all departments in organization. 
The first sheet of the report will have a static name for e.g. "Master Report" and it will display data of all departments in single sheet.
Other sheets will have dynamic name depending on department and will display data of that particular department.
So it will become something like as shown in picture below.
I have already made the Master Report and now I want to display those individual department reports but problem is how do I name those sheets? Both these reports will use different data set. If I set the **InitialPageName** property of report to "Master
Report" then it sets this name for all sheets. If I use an expression for e.g. **=First(Fields!Dept_Title.Value, "ALL_DEPARTMENTS")** then it picks up first department name and then use it for all sheets because as I told above, there are two
different data sets.  
Using subreport is of no help either because it doesn't show subreports InitialPageName as Excel sheet name and always uses Main reports name.
How to solve this issue?

How did you implement the individual department reports?  Do they all have the same layout?  If yes then you can just group the tablix on the Department label field and use that field in the expression for InitialPageName.
Have a read through following article, it's using that technique: Naming Excel Sheets Dynamically
[SSRS]
For a more complicated layout you could nest a subreport inside the tablix.  But complicated
layouts usually don't export well to Excel (I mean in a practical way for further analysis by using Excel) so be careful with that...
SQL Server MVP, MCITP/MCTS SQL Server 2008
Check out my articles at BI: Beer Intelligence

Similar Messages

  • Excel sheet with tabs

    Hi all,
    I have an excel sheet with 2 spread sheets. 1 hidden and other visible.
    1) How to read the excel so that the hidden fields dont come into the internal table in which the data is read?
    2) when the data is read from the visible tab of the excel sheet, data from hidden tab is also getting added in the internal table.
    How to avoid it?
    Useful answers will be rewarded with points.
    please help!!!

    Hi,
    If you have 2 tabs in your excel sheet. Open one tab which you want to process save it. Now it should be process active tab only.
    thanks,
    Sriram.

  • SSRS/Powerview to compare SQL table and excel sheet

    I have a SQL table and an excel sheet with some data...
    I want to be able to compare the two and find out which Excel rows are missing in the SQL table...
    Would it be easier to do this report in SSRS or would it be better to do it in Excel PowerView?
    If so how do I go about it?
    Thanks in advance for your help...
    Dhananjay Rele

    Hi Dhananjay,
    According to your description, you want to compare the data of a SQL table and an excel sheet. To achieve this goal, we can create two tables in Reporting Services report, one for SQL table with SQL Server connection type, another for excel sheet with ODBC
    connection type.
    For more details about how to create the report, please see the following steps:
    Create a report server project with SQL Server Data Tools (SSDT) Business Intelligence Templates list.
    Create a new report definition file in Solution Explorer.
    Create a Data Source named DataSource1 with Microsoft SQL Server Type, then select the SQL table database from the corresponding server.
    Create a Data Source named DataSource2 with ODBC Type, then select the excel file.
    Create two datasets which returns the SQL data and Excel sheet data based on the two data source, one for DataSource1, another for DataSource2.
    Create two table next to each other based on the datasets on the design surface.
    References:
    Create a Basic Table Report (SSRS Tutorial)
    Create SSRS report using Excel Data Source Step by Step
    If there are any other questions, please feel free to ask.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Excel sheet with multiple tabs to be sent as email

    Hi Experts,
    I have a requirement to generate an Excel sheet with multiple tabs to be sent as email to a distribution list.
    Please help if you have any ideas on the same.
    Thanks,
    Preema

    [http://wiki.sdn.sap.com/wiki/display/ABAP/ToGetFieldDetailsSavedinVariantLayout|http://wiki.sdn.sap.com/wiki/display/ABAP/ToGetFieldDetailsSavedinVariantLayout]
    with this we can get the modified field catalog  based on layout variant
    without calling alv output function modules
    Thanks!   SDN.

  • In excel sheet tab name is not coming-urgent

    hi all,
    one small rewquirement. if u run this test program it opens a excel sheet which contains signle tab. here tab name is not coming. i dont no hot to display tabname here.anybody can  make the changes and send me the code.
    i am sending my code below.
    thanks,
    maheedhar.t
    REPORT  ytestvij MESSAGE-ID zv.
    TABLES sscrfields.
    TYPE-POOLS: icon.
    TYPES : BEGIN OF zfnames_ds,
            reptext TYPE reptext,
            END OF zfnames_ds.
    TYPE-POOLS ole2 .
    DATA: wa_fntxt TYPE smp_dyntxt.
    DATA : wa_t75_booking TYPE zvt75_booking_h,
            t_t75_booking TYPE STANDARD TABLE OF zvt75_booking_h.
    DATA : wa_fields TYPE dfies,
            t_fields TYPE STANDARD TABLE OF dfies.
    DATA : wa_fnames TYPE zfnames_ds,
            t_fnames TYPE STANDARD TABLE OF zfnames_ds.
    handles for OLE objects
    DATA: h_excel TYPE ole2_object,        " Excel object
          h_mapl TYPE ole2_object,         " list of workbooks
          h_map TYPE ole2_object,          " workbook
          h_zl TYPE ole2_object,           " cell
          h_f TYPE ole2_object.            " font
    DATA  h TYPE i.
    DATA : lin TYPE i.
    data: excel       type ole2_object,
          application type ole2_object,
          books       type ole2_object,
          book        type ole2_object,
          sheet       type ole2_object,
          cell        type ole2_object,
          column      type ole2_object.
    PARAMETERS : p_input TYPE localfile.
    Add button to application toolbar
    SELECTION-SCREEN FUNCTION KEY 1.  "Will have a function code of 'FC01'
    INITIALIZATION.
    Add displayed text string to buttons
      wa_fntxt-icon_id = icon_xls.
      wa_fntxt-icon_text = 'Input File template'.
      wa_fntxt-quickinfo = 'T75 Header Data'.
      sscrfields-functxt_01 = wa_fntxt.
    AT SELECTION-SCREEN.
      IF sscrfields-ucomm = 'FC01'.
    do nothing
        PERFORM open_excel.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_input.
      PERFORM get_filename USING p_input.
    START-OF-SELECTION.
    *set pf-status 'ONE'.
    END-OF-SELECTION.
      WRITE : lin.
    *&      Form  GET_FILENAME
          text
    -->  p1        text
    <--  p2        text
    FORM get_filename USING p_file TYPE rlgrap-filename . "localfile.
      DATA : w_rc TYPE i.
      DATA : wa_file_table TYPE file_table ,
              t_file_table TYPE STANDARD TABLE OF file_table.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
       EXPORTING
         WINDOW_TITLE            =
         DEFAULT_EXTENSION       =
         DEFAULT_FILENAME        =
         FILE_FILTER             =
         INITIAL_DIRECTORY       =
         MULTISELECTION          =
        CHANGING
          file_table              = t_file_table[]
          rc                      = w_rc
         USER_ACTION             =
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          OTHERS                  = 4
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT t_file_table INTO wa_file_table.
        p_file = wa_file_table-filename.
      ENDLOOP.
    ENDFORM.                    " GET_FILENAME
    *&      Form  open_excel
          text
    -->  p1        text
    <--  p2        text
    FORM open_excel.
    SELECT * FROM ZVT75_BOOKING_H
              INTO TABLE t_t75_booking
              UP TO 10 ROWS.
    start Excel
      CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
      PERFORM err_hdl.
      SET PROPERTY OF h_excel  'Visible' = 1.
      PERFORM err_hdl.
    get list of workbooks, initially empty
      CALL METHOD OF h_excel 'Workbooks' = h_mapl.
      PERFORM err_hdl.
    add a new workbook
      CALL METHOD OF h_mapl 'Add' = h_map.
      PERFORM err_hdl.
    output column headings to active Excel sheet
      PERFORM fill_cell USING 1 1 1 'Financial year'.
      PERFORM fill_cell USING 1 2 1 'Financial quarter'.
      PERFORM fill_cell USING 1 3 1 'Customer number'.
      PERFORM fill_cell USING 1 4 1 'Booking Year'.
      PERFORM fill_cell USING 1 5 1 'Financial quarter'.
      PERFORM fill_cell USING 1 6 1 'Contract type'.
      PERFORM fill_cell USING 1 7 1 'Sub Contract type'.
      PERFORM fill_cell USING 1 8 1 'Customer purchase order number'.
      PERFORM fill_cell USING 1 9 1 'Booking Amount'.
      PERFORM fill_cell USING 1 10 1 'Currency Key'.
    LOOP AT t_t75_booking into wa_t75_booking.
    copy items to active EXCEL sheet
       H = SY-TABIX + 1.
       PERFORM FILL_CELL USING H 1 0 wa_t75_booking-BOOKYEAR.
       PERFORM FILL_CELL USING H 2 0 wa_t75_booking-BOOKQTR.
       PERFORM FILL_CELL USING H 3 0 wa_t75_booking-.
       PERFORM FILL_CELL USING H 4 0 wa_t75_booking-BOOKYEAR.
       PERFORM FILL_CELL USING H 5 0 wa_t75_booking-BOOKQTR.
    ENDLOOP.
    disconnect from Excel
      FREE OBJECT h_excel.
      PERFORM err_hdl.
    ENDFORM.                    " open_excel
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM err_hdl.
    data test type sy-subrc.
    test = sy-subrc.
      IF test <> 0.
         Message e000(ZV) with 'Error in OLE-Automation:'.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    FORM fill_cell USING i j bold val.
      CALL METHOD OF h_excel 'Cells' = h_zl EXPORTING #1 = i #2 = j.
      set property of sheet 'Name'  = 'T75'.
      PERFORM err_hdl.
      SET PROPERTY OF h_zl 'Value' = val .
      PERFORM err_hdl.
      GET PROPERTY OF h_zl 'Font' = h_f.
      PERFORM err_hdl.
      SET PROPERTY OF h_f 'Bold' = bold .
      PERFORM err_hdl.
    ENDFORM.

    Hi,
    Look at the below thread, i posted complete code in this one, just copy that Program and past in your SAP and run the Program, it will create 3 sheets with the names also, then look at the Sheet name in the code, you will understand where to add the code
    Re: format an excel
    Regards
    Sudheer

  • Create link to excel sheet from ssrs

    Hi!
    I,m trying to create a link from SSRS to an excel sheet that is placed on a server (in my case the same server as Sql is running)
    \\csedb30\BusinessWarehouse\VDC\Actual\exceltest.xlsx.  I have made links to url sites and to other reports within reporting services, But this time i would like to use a
    textbook control in a report and when the user click on the texbox it should open up the excel sheet in the same way that a hyperlink works in excel. The problem seems to be that i have to link to a source on a server not a URL adress.
    Is there any solution to this.
    Best regards
    Arne 
    Arne Olsson

    Hi Arne,
    In this scenario, you just need to put    file:\\csedb30\BusinessWarehouse\Linktest.xlsx in the Go to URL expression. Don't put "=" in the expression,
    and the path will be underlined. And you need to redeploy the project to make it work. After you click the textbox, the path will be shown in the browser.
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • How can i create  excel sheet with multiple tabs using utl file?

    how can i create excel sheet with multiple tabs using utl file?
    any one help me?

    Jaggy,
    I gave you the most suitable answer on your own thread yesterday
    Re: How to Generating Excel workbook with multiple worksheets

  • Reading data in a tab in an excel sheet

    Hi,
    I would like to read the data in an excel sheet and upload into an internal table for processing. I was able to do it using function module ALSM_EXCEL_TO_INTERNAL_TABLE but I am not able to read a particular tab. My excel sheet has tabls like A, B, C and D and I want to read only tab C. But currently, it reads data in  tab A.
    regards,
    Srini.

    Pls check this and review it once. it works for 2 excel sheets in single excel file to read. Pls reward me if its helpful.  Thanks !
       FUNCTION z_uploading_from_2sheets.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(FILE_NAME) TYPE  RLGRAP-FILENAME
    *"     REFERENCE(START_ROW_SHEET1) TYPE  I
    *"     REFERENCE(START_COLUMN_SHEET1) TYPE  I
    *"     REFERENCE(START_ROW_SHEET2) TYPE  I
    *"     REFERENCE(START_COLUMN_SHEET2) TYPE  I
    *"     REFERENCE(END_ROW_SHEET1) TYPE  I
    *"     REFERENCE(END_COLUMN_SHEET1) TYPE  I
    *"     REFERENCE(END_ROW_SHEET2) TYPE  I
    *"     REFERENCE(END_COLUMN_SHEET2) TYPE  I
    *"  TABLES
    *"      IT_DATA1 STRUCTURE  ALSMEX_TABLINE
    *"      ALSMEX_TABLINE STRUCTURE  ALSMEX_TABLINE
    *"  EXCEPTIONS
    *"      INCONSISTENT_PARAMETERS
    *"      UPLOAD_OLE
      TYPES: ty_t_sender(1500) TYPE c.
      DATA: excel_tab TYPE TABLE OF ty_s_senderline,
      excel_tab1 TYPE TABLE OF ty_s_senderline.
      DATA: ld_separator TYPE c.
      DATA: application TYPE ole2_object,
      workbook TYPE ole2_object,
      sheet TYPE ole2_object,
      range TYPE ole2_object,
      worksheet TYPE ole2_object.
      DATA: h_cell TYPE ole2_object,
      h_cell1 TYPE ole2_object.
      DATA: ld_rc TYPE i.
      DATA: it_data TYPE STANDARD TABLE OF  alsmex_tabline.
    *MESSAGE DEFINATION
      DEFINE m_message.
    *Function Module To Upload Data From
    *Excel File Into Two Internal Tables
    *© 2005 SAP AG 6
        case sy-subrc.
          when 0.
          when 1.
            message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          when others. raise upload_ole.
        endcase.
      END-OF-DEFINITION.
    *PARAMETER CHECK.
      IF start_row_sheet1 > end_row_sheet1.
        RAISE inconsistent_parameters.
      ENDIF.
      IF start_column_sheet1 > end_column_sheet1.
        RAISE inconsistent_parameters.
      ENDIF.
      IF start_row_sheet2 > end_row_sheet2.
        RAISE inconsistent_parameters.
    *Function Module To Upload Data From Excel File Into Two Internal Tables
      ENDIF.
      IF start_column_sheet2 > end_column_sheet2.
        RAISE inconsistent_parameters.
      ENDIF.
      CLASS cl_abap_char_utilities DEFINITION LOAD.
      ld_separator = cl_abap_char_utilities=>horizontal_tab.
    *OPENING EXCEL FILE
      IF application-header = space OR application-handle = -1.
        CREATE OBJECT application 'Excel.Application'.
        m_message.
      ENDIF.
      CALL METHOD OF
          application
          'Workbooks' = workbook.
      m_message.
      CALL METHOD OF
          application
          'Workbooks' = workbook.
      m_message.
      CALL METHOD OF
          workbook
          'Open'
        EXPORTING
          #1       = file_name.
      m_message.
      CALL METHOD OF
          application
          'Worksheets' = sheet
        EXPORTING
          #1           = 1.
    *Function Module To Upload Data From Excel File Into Two Internal Tables
      m_message.
      CALL METHOD OF
          application
          'Worksheets' = sheet
        EXPORTING
          #1           = 1.
      m_message.
      CALL METHOD OF
          sheet
          'Activate'.
      m_message.
      GET PROPERTY OF application 'ACTIVESHEET' = sheet.
      m_message.
    *MARKING OF WHOLE SPREADSHEET
      CALL METHOD OF
          sheet
          'Cells' = h_cell
        EXPORTING
          #1      = start_row_sheet1
          #2      = start_column_sheet1.
      m_message.
      CALL METHOD OF
          sheet
          'Cells' = h_cell1
        EXPORTING
          #1      = end_row_sheet1
          #2      = end_column_sheet1.
      m_message.
      CALL METHOD OF
          sheet
          'RANGE' = range
        EXPORTING
          #1      = h_cell
          #2      = h_cell1.
      m_message.
      CALL METHOD OF
          range
          'SELECT'.
      m_message.
    *Function Module To Upload Data From Excel File Into Two Internal Tables
    *Copy marked area (SHEET1) into Clippboard
      CALL METHOD OF
          range
          'COPY'.
      m_message.
    *Read clipboard into ABAP
      CALL METHOD cl_gui_frontend_services=>clipboard_import
        IMPORTING
          data                 = excel_tab
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
      IF sy-subrc <> 0.
        MESSAGE a037(alsmex).
      ENDIF.
      PERFORM separated_to_intern_convert TABLES excel_tab it_data
      USING ld_separator.
      APPEND LINES OF it_data TO it_data1.
    *Function Module To Upload Data From Excel File Into Two Internal Tables
    *Clear the clipboard
      REFRESH excel_tab.
      CALL METHOD cl_gui_frontend_services=>clipboard_export
        IMPORTING
          data                 = excel_tab
        CHANGING
          rc                   = ld_rc
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
    *Working in Second Excel Work Sheet
      CALL METHOD OF
          application
          'Worksheets' = sheet
        EXPORTING
          #1           = 2.
      m_message.
      CALL METHOD OF
          sheet
          'Activate'.
      m_message.
    *Function Module To Upload Data From Excel File Into Two Internal Tables
      GET PROPERTY OF application 'ACTIVESHEET' = sheet.
      m_message.
    *Mark Sheet2
      CALL METHOD OF
          sheet
          'Cells' = h_cell
        EXPORTING
          #1      = start_row_sheet2
          #2      = start_column_sheet2.
      m_message.
      CALL METHOD OF
          sheet
          'Cells' = h_cell1
        EXPORTING
          #1      = end_row_sheet2
          #2      = end_column_sheet2.
      m_message.
      CALL METHOD OF
          sheet
          'RANGE' = range
        EXPORTING
          #1      = h_cell
          #2      = h_cell1.
      m_message.
      CALL METHOD OF
          range
          'SELECT'.
      m_message.
    *Copy Marked Area (Sheet2) into Clippboard
      CALL METHOD OF
          range
          'COPY'.
      m_message.
    *Function Module To Upload Data From Excel File Into Two Internal Tables
    *Read Clipboard into ABAP
      CALL METHOD cl_gui_frontend_services=>clipboard_import
        IMPORTING
          data                 = excel_tab1
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
      IF sy-subrc <> 0.
        MESSAGE a037(alsmex).
      ENDIF.
    *PERFORM separated_to_intern_convert TABLES excel_tab1 IT_DATA2
      PERFORM separated_to_intern_convert TABLES excel_tab1 it_data
      USING ld_separator.
    *Clear Clipboard.
      REFRESH: excel_tab1.
      APPEND LINES OF it_data TO it_data1.
      CALL METHOD cl_gui_frontend_services=>clipboard_export
    *Function Module To Upload Data From Excel File Into Two Internal Tables
      IMPORTING
      data = excel_tab1
      CHANGING
      rc = ld_rc
      EXCEPTIONS
      cntl_error = 1
      error_no_gui = 2
      not_supported_by_gui = 3
      OTHERS = 4
    *Leaving Application
      CALL METHOD OF
          application
          'QUIT'.
      m_message.
    * >>>>> Begin of change note 575877
    * to kill the Excel process it's necessary to free all used objects
      FREE OBJECT h_cell.       m_message.
      FREE OBJECT h_cell1.      m_message.
      FREE OBJECT range.        m_message.
      FREE OBJECT worksheet.    m_message.
      FREE OBJECT workbook.     m_message.
      FREE OBJECT application.  m_message.
    * <<<<< End of change note 575877
    ENDFUNCTION.

  • Query Name in Excel Sheet tab

    Hi Friends,
    Instead of display Sheet 1 in the Excel sheet tab(Bex), is there a way we can display Query Name in the excel sheet tab? please let me know.
    Thanks,
    KK

    Hi Kumar
    Can you please share how it was solved ?
    Ashish

  • Separate tab in excel sheet

    Hi All,
    I am writing a report to get data related to material master and download it to excel sheet.
    While downloading I need to use a separate tab in excel sheet for each area of the material master, for example, a tab for Basic 1, Basic 2, MRP1, etc…
    Regards,
    Gaurav

    Hi,  tyr this..
    while u r priting ur output give space between the feilds.
    for example....... u can write ur required field inplace of "text-000".
    WRITE:/2  text-002
            16  text-003 ,
            25  text-004 ,
            40  text-005 ,
            60  text-006 ,
            75  text-007 ,
            90  text-008 ,
           100 text-009 .

  • I am trying to Add In to my excel 2013 a tab on the tool bar  that would allow me to make a PDF from my spread sheet

    I am trying to Add In to my excel 2013 a tab on the tool bar  that would allow me to make a PDF from my spread sheet
    I went to add ins in the excel options ,& it shows the add in however the tab does not appear

    am trying to Add In to my excel 2013 a tab on the tool bar  that would allow me to make a PDF from my spread sheet
    I went to add ins in the excel options ,& it shows the add in however the tab does not appear

  • How to put information in the different tabs of same excel sheet

    Hi all,
    How to download information in the different tabs of same excel sheet.
    EG data.xls is the excel sheet name
    and sheet1 , sheet2 , sheet3 are different tabs of it.
    Is there any standad function module for this .
    If somebody is having idea abt it , Please guide.
    Regards,
    Shikha Jain

    Hi Shikha,
    You can do this by using the DOI interface for spreadsheets. Take a look at:
    http://help.sap.com/saphelp_47x200/helpdata/en/e9/0be83b408e11d1893b0000e8323c4f/frameset.htm
    Regards,
    John.

  • Can we create Multi Tabbed excel Sheet using Crystal Reports 2008

    Hi,
      We want to create a Crystal Report which will export the output as multiple Tab's ( we can use sub reports).  Can we create a Multi Tabbed excel Sheet using Crystal Reports 2008 ( not  Crystal reports Basic 2008). Please share any information/links on how to do that.
    Also if it is not supported please let us know which version supports it.
    Thanks,
    Vasu

    At least one of the 3rd-party Crystal Reports Desktop Scheduling tools listed at: http://www.kenhamady.com/bookmarks.html provides that functionality.  It allows you to burst a single report so that each Group at level 1 becomes a separate tab.  You can control the tab names (and tab colors) via fields/formulas inside the report.
    You can also automate the process of exporting to (and also replacing or appending to) specified tabs inside existing workbooks.

  • How export report into excel sheet automatically using SSRS 2010?

    Hi,
    I have created many reports using SQL Server Data Tool 2010 and at my work, we are using active batch to ran reports every month.
    Now question is, my boss want me to set up reports such a way that when active batch is ran, reports should be exported into excel sheet automatically with the default values given for parameters at some specific folder location. How can I export report
    into excel sheet automatically when active batch is executed?
    Please help me on this. Thanks for the help in advance.
    Vicky

    Check this:
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = 'C:/test.xls'
          filetype                = 'ASC'
          write_field_separator   = 'X'
        TABLES
          data_tab                = t_output
    Regards.

  • Urgent:download data in differnt tabs of excel sheet

    Hi,
    I want to save data from internal table to different worksheet of an excel sheet file without using ole. I am having thousands of record in my internal table. Currently I am doing this by using OLE but its response time is very high. Plz suggest any other method with which we can do it fast.
    rely will be suitably rewarded
    Edited by: amit manglik on Jan 28, 2008 10:23 AM
    Edited by: amit manglik on Jan 29, 2008 10:18 AM

    hi,
    Refer sample code:
    Multiple excel sheets generation in a workbook
    CREATE OBJECT EXCEL 'EXCEL.SHEET'.
    GET PROPERTY OF EXCEL 'Application' = APPLICATION.
    SET PROPERTY OF APPLICATION 'Visible' = 1.
    CALL METHOD OF APPLICATION 'Workbooks' = BOOKS.
    CALL METHOD OF BOOKS 'Add' = BOOK.
    CALL METHOD OF BOOK 'WORKSHEETS' = SHEET.
    CALL METHOD OF SHEET 'ADD'.
    Fill all the sheets with relavant data
    PERFORM SHEET1 TABLES ITAB1.
    PERFORM SHEET2 TABLES ITAB2.
    PERFORM SHEET3 TABLES ITAB3.
    PERFORM SHEET4 TABLES ITAB4.
    Quit the excel after use
    CALL METHOD OF EXCEL 'QUIT'.
    FREE OBJECT: COLUMN,SHEET,BOOK,BOOKS,APPLICATION,EXCEL. "NO FLUSH.
    CLEAR V_SHEET.
    FORM FILL_CELL USING ROW COL VAL.
    CALL METHOD OF SHEET 'cells' = CELL NO FLUSH
    EXPORTING #1 = ROW #2 = COL.
    SET PROPERTY OF CELL 'value' = VAL.
    FREE OBJECT CELL NO FLUSH.
    ENDFORM. " FILL_CELL
    FORM SHEET1 TABLES ITAB1 STRUCTURE ITAB1.
    V_SHEET = Sheet Name.
    V_NO = V_NO + 1.
    CALL METHOD OF BOOK 'worksheets' = SHEET NO FLUSH EXPORTING #1 = V_NO.
    SET PROPERTY OF SHEET 'Name' = V_SHEET NO FLUSH.
    PERFORM FILL_SHEET1 TABLES ITAB1 USING V_NO V_SHEET.
    CALL METHOD OF SHEET 'Columns' = COLUMN.
    FREE OBJECT SHEET.
    CALL METHOD OF COLUMN 'Autofit'.
    FREE OBJECT COLUMN.
    ENDFORM.
    Repeat above procedure for all sheets you want to add
    FORM FILL_SHEET1
    TABLES ITAB1 STRUCTURE ITAB1
    USING V_NO V_SHEET.
    ROW = 1.
    PERFORM FILL_CELL USING ROW 1 'Column1 Name'.
    PERFORM FILL_CELL USING ROW 2 'Column2 Name'.
    PERFORM FILL_CELL USING ROW 3 'Column3 Name'.
    ROW = ROW + 1.
    LOOP AT ITAB1.
    PERFORM FILL_CELL USING ROW 1 ITAB1-Column1.
    PERFORM FILL_CELL USING ROW 2 ITAB1-Column2.
    PERFORM FILL_CELL USING ROW 3 ITAB1-Column3.
    ROW = ROW + 1.
    ENDLOOP.
    ENDFORM.
    Repeat above procedure for all sheets you want to add
    Also follow this link, for a simillar kind of download program.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c05db2ca-569e-2910-0784-fc06cc3be31d
    Hope this helps, Do reward.

Maybe you are looking for

  • Selected fields not in order

    Hello All,   I am selecting few fields from a table with the field in the condition 'rollname' = XXX.The rollname is a field in the table DD04t.If for exapmle in the selection screen if i give values like 'MATNR' 'EBELN' 'EBELP'  the select statment

  • How to save data in a 4D array and make partial plots in real time?

    Hi, this is a little complex, so bear with me... I have a test system that tests a number of parts at the same time. The experiment I do consists of measuring a number of properties of the parts at various temperatures and voltages. I want to save al

  • How can I keep the column names in view on long spreadsheets?

    I want to be able to see the column header names on long spreadsheets. In Excel you can create multiple panes in the window so as to keep both column and row headers in view. Any way to do this in numbers?

  • Establishing database connection in stored procedures/functions

    Hi, any body knows how to do it.... Consider there is 2 database, Oracle_1 and Oracle_2. I want to fetch some table data in Oracle_2 from Oracle_1 database Stored procedure/functions through query staments and cursors. How to establish the Oracle_1 D

  • Timeout in control step(raise exception) of BPM

    All, Does timeout in the above control step means > The typical inactive timeout i.e. while using collecttime pattern, if IDOCS keep coming, the process is going to be active until the point there are no more IDOCs coming and then the exception time