Download table in excel sheet

Hi Experts,
I have a table with 10 columns.
Now I have a link called 'Download'. If I click 'Download' link it will download the whole table into the excel sheet.
Please suggest me hoew to download the whole gtable into excel sheet.
Thanking you.
Regards,
Anindita

If you do a search using the search string:
download table excel web dynpro abap
and look at the weblogs returned, you will find several that will help you.
Strangely enough - the obvious "WD ALV does this for you" didn't jump out of the list. So perhaps do some searching on using Web Dynpro ABAP ALV as well.
Good luck, and perhaps next time, do a little prework before posting, and you'll find we are a much more receptive audience.
Cheers,
Chris

Similar Messages

  • How to download internal table to excel sheet

    I have a requirement to download nearly 8 to 10 internal tables to excel sheets(for each internal table one excel sheet) without displaying the diolog box showing open and save buttons.
    scenario :
      I will enter the path name like this -   C:\myfolder\Custom_programs.xls.
                                                            C:\myfolder\Custom_tables.xls.
                                                            (File name does not exit..it has to created inside the    
                                                                specified folder)
      in submit button I populate 2 internal tables say it1 and it2. then I need to move the tables contents to the path I have specified above.
    attach_file_to_response method is not working for the above reqt since it is showing the dialog box.
    Please provide a suitable solution...

    Please ignore all the responders that are stating that you can use GUI_DOWNLOAD from Web Dynpro ABAP.  As you found out, this absolutely will not work, since this function module and other download logic like it depends upon a connection to the SAPGUI. People posting to use the GUI_DOWNLOAD from WDA need to learn a little more about the architecture of WDA before they go posting incorrect repsonses in the forum. I have little tollerance for people posting outright incorrect information in the WDA Forum.
    What you want to do - download silent - is not easily done from WDA.  There are rules about how web applications must behave in a browser.  Normal HTML/JavaScript does not allow silent downloads for security reasons.  Obviously there are many untrustworthy websites on the internet that you wouldn't want to allow to directly access your local machine.  WDA must live within these same browser limitations.
    SAP has done some work using a Java Applet to get around some of these security issues.  This funcitonality comes in NetWeaver 7.01.  It is the AcfUpDownload UI element:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b9157c878a2d67e10000000a42189c/frameset.htm
    However it is designer for usage with the Content or KPro server - so even it might not meet your needs.

  • Download data from internal table to excel sheet from the background

    Hello Experts,
    I have written a code where the data is stored in the internal table . Now when i run this code in the background i want this internal table data to get downloaded in the excel sheet. The function module GUI_DOWNLAOD is not supported in the background. So is there any other function module that can be used or is there any other way to do this
    Thanks in advance

    Hi Aditya,
    I would provide you 2 advice:
    1. save the file on the application server as text file and the fileds in it separated by TAB,you can download the file whenever you want and open it with excel.
    2.generate excel files and send it to the email address whatever you specify in the selection-screen.
    Thanks,
    Sam

  • How to export the data from table to excel sheet

    hi experts i have some problem am trying to export the data fro table to Excel sheet  in the view controller i have created one button wit public void onActionCLEAR(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionCLEAR(ServerEvent)
       //wdContext.nodeBapi_Salesorder_Getlist_Input().
       //wdContext.nodeBapi_Salesorder_Getlist_Input().invalidate();
        //@@end
      //@@begin javadoc:onActionExporToExcel(ServerEvent)
      /** Declared validating event handler. */
      //@@end
      public void onActionExporToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionExporToExcel(ServerEvent)
         try{
         FileOutputStream fos=new FileOutputStream("Test.xls");
          PrintStream ps=new PrintStream(fos);
          ps.println("<html><body><table border=1>");
          int size=wdContext.nodeBapi_Salesorder_Getlist_Input().size();
           Iterator attributes=wdContext.getNodeInfo().iterateAttributes();
           ps.println("<tr>");
           while(attributes.hasNext()){
            ps.println("<th>");
            DataAttributeInfo attrName=(DataAttributeInfo)attributes.next();
            ps.println(attrName.getName());
            ps.println("</th>");
           ps.println("</tr>");
          for(int i=0; i<wdContext.nodeBapi_Salesorder_Getlist_Input().size();i++)
            attributes=wdContext.getNodeInfo().iterateAttributes();
            ps.println("<tr>");
            IWDNodeElement ele=wdContext.getElementAt(i);
            while(attributes.hasNext()){
              ps.println("<td>");
              DataAttributeInfo attrName=(DataAttributeInfo)attributes.next();
              ps.println(""+ele.getAttributeAsText(attrName.getName()));
              ps.println("</td>");
            ps.println("</tr>");
           ps.println("</table></body></html>");
           ps.flush();
           ps.close();
           fos.close();
          catch(Exception e){
           wdComponentAPI.getMessageManager().reportException(e.getMessage(), false);
          finally{
         //return("Test.xls")  ;
        //@@end
      }h action and i have return the code
    its running sucessfully but am not able to perform the action plz help me

    Hi,
    You shouldn't use DataAttributeInfo as it is an internal object, if I'm correct.
    Use IWDAttributeInfo instead of DataAttributeInfo and it should work
    (See also API doc of IWDNodeInfo.iterateAttributes() at http://help.sap.com/javadocs/nwce/ce711sp02/wdr/com.sap.wdr/com/sap/tc/webdynpro/progmodel/api/IWDNodeInfo.html#iterateAttributes())
    Cheers,
    Robin

  • Gui_download for transferring the data from internal table to excel sheet.

    hi all,
    i am using gui_download for transferring the data from internal table to excel sheet.
    I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
    Thanks in advance.

    Hi Venkata,
    plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
      call function 'SAP_CONVERT_TO_XLS_FORMAT'
        exporting
    *   I_FIELD_SEPERATOR          =
    *   I_LINE_HEADER              =
          i_filename                 = p_file
    *   I_APPL_KEEP                = ' '
        tables
          i_tab_sap_data             = t_mbew
    * CHANGING
    *   I_TAB_CONVERTED_DATA       =
    * EXCEPTIONS
    *   CONVERSION_FAILED          = 1
    *   OTHERS                     = 2
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    Hope this helps,
    Erwan

  • Downloading data in excel sheet

    Hi All,
        I want to download data in excel sheet. My requirment is to use the same excle sheet to fill data.
    The next data should be entered in the column of the excel sheet. Is there a possible to write data in excel sheet at a particular row/column.
       Please let me know if this can be achevied?
    For Ex:
    Data: 10, 20, 30
    Excel sheet:
    10
    20
    30
    Data: 40, 50, 60
    Excel sheet:
    10          40
    20          50
    30          60
    Thanks & Regards,
    Rupali Ray

    Hi,
    This should be possible by OLE concept.
    Have a look at report RSDEMO01
    Regards

  • How can I download to one excel sheet from more than two table?

    Hi.
    as you know
    <SAP_BW_URL CMD='EXPORT' FORMAT='XLS' DATA_PROVIDER='DATAPROVIDER_T1' >
    this script can make download excel sheet which is same cotents of table or chart in web template.
    but if template has more than two tables how can we get excel sheet from tables?
    <SAP_BW_URL CMD='EXPORT' FORMAT='XLS' DATA_PROVIDER_1='DATAPROVIDER_T1' DATA_PROVIDER_2='DATAPROVIDER_T2'>
    I hope this gonna work but result was fail same as I expected.
    is there any way put two tables download one excel sheet?

    Welcome to SDN.
    Post this in Business Explorer forum for quicker resposne.
    SAP Business Explorer (SAP BEx)
    Regards
    Raja

  • Download internal table to Excel sheet

    Hi,
    I am trying a sampole program to download an internal table to excel and am
    uisng the Fm GUI_DOWNLOAD for the same. But how do I ensure that each column
    of internal will be aligned as columns in the excel sheet to. I a trying to do
    that with a separator but I am not able to figure out.
    Below is my code.
    REPORT  z_excel_download.
    DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.
    DATA : BEGIN OF it_file OCCURS 0,
           data(2000),
           END OF it_file.
    SELECT * FROM mara INTO TABLE it_mara UP TO 100 ROWS.
    LOOP AT it_mara.
      CONCATENATE it_mara-matnr
                  it_mara-ersda
                  it_mara-ernam
                  it_mara-pstat
                  it_mara-mtart
                  it_mara-mbrsh INTO it_file-data SEPARATED BY '/t'.
      APPEND it_file.
    ENDLOOP.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        filename                        = 'C:\Documents and Settings\XXXXXX\Desktop\test.xls'
      TABLES
        data_tab                        = it_file
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Thanks.

    Hi Varun,
    On SDN are plenty of post where you can find the answer to your problem.
    Please try the following code that I found here several years ago to resolve your problem.
    Regards,
    Eric
    REPORT Excel.
    TABLES:
      sflight.
    * header data................................
    DATA :
      header1 LIKE gxxlt_p-text VALUE 'Suresh',
      header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
    * Internal table for holding the SFLIGHT data
    DATA BEGIN OF t_sflight OCCURS 0.
            INCLUDE STRUCTURE sflight.
    DATA END   OF t_sflight.
    * Internal table for holding the horizontal key.
    DATA BEGIN OF  t_hkey OCCURS 0.
            INCLUDE STRUCTURE gxxlt_h.
    DATA END   OF t_hkey .
    * Internal table for holding the vertical key.
    DATA BEGIN OF t_vkey OCCURS 0.
            INCLUDE STRUCTURE gxxlt_v.
    DATA END   OF t_vkey .
    * Internal table for holding the online text....
    DATA BEGIN OF t_online OCCURS 0.
            INCLUDE STRUCTURE gxxlt_o.
    DATA END   OF t_online.
    * Internal table to hold print text.............
    DATA BEGIN OF t_print OCCURS 0.
            INCLUDE STRUCTURE gxxlt_p.
    DATA END   OF t_print.
    * Internal table to hold SEMA data..............
    DATA BEGIN OF t_sema OCCURS 0.
            INCLUDE STRUCTURE gxxlt_s.
    DATA END   OF t_sema.
    * Retreiving data from sflight.
    SELECT * FROM sflight
             INTO TABLE t_sflight.
    * Text which will be displayed online is declared here....
    t_online-line_no    = '1'.
    t_online-info_name  = 'Created by'.
    t_online-info_value = 'SURESH KUMAR PARVATHANENI'.
    APPEND t_online.
    * Text which will be printed out..........................
    t_print-hf     = 'H'.
    t_print-lcr    = 'L'.
    t_print-line_no = '1'.
    t_print-text   = 'This is the header'.
    APPEND t_print.
    t_print-hf     = 'F'.
    t_print-lcr    = 'C'.
    t_print-line_no = '1'.
    t_print-text   = 'This is the footer'.
    APPEND t_print.
    * Defining the vertical key columns.......
    t_vkey-col_no   = '1'.
    t_vkey-col_name = 'MANDT'.
    APPEND t_vkey.
    t_vkey-col_no   = '2'.
    t_vkey-col_name = 'CARRID'.
    APPEND t_vkey.
    t_vkey-col_no   = '3'.
    t_vkey-col_name = 'CONNID'.
    APPEND t_vkey.
    t_vkey-col_no   = '4'.
    t_vkey-col_name = 'FLDATE'.
    APPEND t_vkey.
    * Header text for the data columns................
    t_hkey-row_no = '1'.
    t_hkey-col_no = 1.
    t_hkey-col_name = 'PRICE'.
    APPEND t_hkey.
    t_hkey-col_no = 2.
    t_hkey-col_name = 'CURRENCY'.
    APPEND t_hkey.
    t_hkey-col_no = 3.
    t_hkey-col_name = 'PLANETYPE'.
    APPEND t_hkey.
    t_hkey-col_no = 4.
    t_hkey-col_name = 'SEATSMAX'.
    APPEND t_hkey.
    t_hkey-col_no = 5.
    t_hkey-col_name = 'SEATSOCC'.
    APPEND t_hkey.
    t_hkey-col_no = 6.
    t_hkey-col_name = 'PAYMENTSUM'.
    APPEND t_hkey.
    * populating the SEMA data..........................
    t_sema-col_no  = 1.
    t_sema-col_typ = 'STR'.
    t_sema-col_ops = 'DFT'.
    APPEND t_sema.
    t_sema-col_no = 2.
    APPEND t_sema.
    t_sema-col_no = 3.
    APPEND t_sema.
    t_sema-col_no = 4.
    APPEND t_sema.
    t_sema-col_no = 5.
    APPEND t_sema.
    t_sema-col_no = 6.
    APPEND t_sema.
    t_sema-col_no = 7.
    APPEND t_sema.
    t_sema-col_no = 8.
    APPEND t_sema.
    t_sema-col_no = 9.
    APPEND t_sema.
    t_sema-col_no = 10.
    t_sema-col_typ = 'NUM'.
    t_sema-col_ops = 'ADD'.
    APPEND t_sema.
    CALL FUNCTION 'XXL_FULL_API'
      EXPORTING
    *   DATA_ENDING_AT          = 54
    *   DATA_STARTING_AT        = 5
       filename                = 'TESTFILE'
       header_1                = header1
       header_2                = header2
       no_dialog               = 'X'
       no_start                = ' '
        n_att_cols              = 6
        n_hrz_keys              = 1
        n_vrt_keys              = 4
       sema_type               = 'X'
    *   SO_TITLE                = ' '
      TABLES
        data                    = t_sflight
        hkey                    = t_hkey
        online_text             = t_online
        print_text              = t_print
        sema                    = t_sema
        vkey                    = t_vkey
    EXCEPTIONS
       cancelled_by_user       = 1
       data_too_big            = 2
       dim_mismatch_data       = 3
       dim_mismatch_sema       = 4
       dim_mismatch_vkey       = 5
       error_in_hkey           = 6
       error_in_sema           = 7
       file_open_error         = 8
       file_write_error        = 9
       inv_data_range          = 10
       inv_winsys              = 11
       inv_xxl                 = 12
       OTHERS                  = 13
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  • How can i download data in excel sheet .

    Hi all
    My Requirement : In a selection screen after giving a VBELN,It will show all the related data from VBRP table through alv  . There are a customize icon ,after clicking the icon it will download all fetched data .
    Can any one help me .how can i download the fetched data through excel ?
    Regards
    Rajesh .

    Hi Rajesh,
    I understood your requirement as from ALV you want to download the data to an Excel sheet.
    In standard ALVs, you need to do this
    In other cases like Z programs etc, often Icon is provided  (as you said) like this
    You need to select Local File option here as shown below
    In both case you will get this pop-up
    Now when you continue you will get SAVE dialog-box, where you can give a name to your excel file and Save.
    Hope this is your query.
    Jogeswara Rao K

  • How to Restict number of rows to download data in excel sheet

    hi,
    my requirement is that i m showing top 50 seller in my dashboard. but when we click on download to excel then all 500 rows are downloading. i want to restrict downloading all data and want show only displayed data of dashboard in excel sheet.(ex if 50 top seller are selected then only 50 rows is downloaded.)
    Edited by: 941334 on Jun 18, 2012 6:15 AM

    Hi,
    Yes.my suggestion is you set each report design analysis page itself(just to -->edit analysis-->look at the table propeties -->here u can set it how ever you want(50 rows, 500 rows etc..analysis visible page) to show/download it as per your requirment.
    Changing instance confic will affect entire report.for controling this you can set dashboard/prompt filter then you control data downloading.
    Check Oracle Doc for more info
    http://docs.oracle.com/cd/E23943_01/bi.1111/e10541/answersconfigset.htm#CIHJGAAH
    -----------------------------------FYI------------------
    Just FYI:If you have bulk volum of data like more than 8MB then you have increase the download size
    steps configure bulk volumn data more than 8MB:
    go to you bi installed drive \oracle\instances\instance1\config\OracleBIJavaHostComponent\coreapplication_obijh1\
    2. Open config.xml file in an editor and search for the below lines
    <XMLP> <InputStreamLimitInKB>8192</InputStreamLimitInKB>
    <ReadRequestBeforeProcessing>true</ReadRequestBeforeProcessing> </XMLP>
    3. The default size is 8 MB, you can increase to the size you want. If you want to set unlimited, then replace 8192 with 0 (zero) but it’s not recommended (performance may impact) then Restart BI Service and test .
    Thanks
    Deva

  • Download Alv into excel sheet according to variant fields

    Hi All,
    I have more than 100 fields in the ALV report, now i want to download the report according to the fields are choosen in the variant. I am getting all the fields in excel sheet but i need some fileds that is selected in the variant.
    Thanks in advance.
    Rudhir

    use your own excel button and program this steps:

    * Get the frontend fieldcatalog
    CALL METHOD go_grid->get_frontend_fieldcatalog
    IMPORTING
    et_fieldcatalog = lt_fieldcat.
    DELETE lt_fieldcat WHERE no_out EQ 'X'.

    *create dynamic table with the frontend fieldcatalog
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = lt_fieldcat
    IMPORTING
    ep_table = lt_data
    EXCEPTIONS
    generate_subpool_dir_full = 1
    OTHERS = 2.
    IF sy-subrc EQ 0.
    ASSIGN lt_data->* TO <lt_table>.
    ENDIF.
    3° Fill the dynamic table
    4° export to excel using
    CALL FUNCTION 'XXL_SIMPLE_API'
    TABLES
    col_text = xmplt_v1
    data = <lt_table>
    online_text = xmplt_o1
    print_text = xmplt_p1
    EXCEPTIONS
    dim_mismatch_data = 1
    file_open_error       =2
    file_write_error      = 3
    inv_winsys            =4
    inv_xxl                   =5
    OTHERS                = 6.
    Check the complete example here

  • Download data to excel sheet

    hi all,
    i have a situation, i want to download the data of an alv grid display to a excel sheet, is there any other way of doin it other than choosing from the List menu, coz when i click the excel sheet button on the application tool bar i get a blank excel sheet, do i need to pass any parameters ??? can any one plz gimme the funtionality of this.
    thansk
    anupama

    Hi,
    I am giving u a sample code to download dat ato excel.
    try to use it.
    CONSTANTS:c_x(1)             TYPE c VALUE'X',
              lc_a(1)            TYPE c VALUE 'A',
              c_p2(2)            TYPE c VALUE 'P2',
              c_dir              TYPE string VALUE 'C:\',
              c_ext              TYPE string VALUE 'XLS'.
    DATA: fullpath TYPE string,              "Full path of the file
            filename TYPE string,              "Name of the excel file
            path     TYPE string,              "Path where the file will be stored
            user_action TYPE i ,               "To catch User Action
            l_title TYPE string.               "To display title
    * encoding TYPE abap_encoding.
      l_title = 'Save File'(006).
    * Open the save dialog
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = l_title
          default_extension    = c_ext
          initial_directory    = c_dir
        CHANGING
          filename             = filename
          path                 = path
          fullpath             = fullpath
          user_action          = user_action
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
    ** Check which button is pressed
      IF user_action <> cl_gui_frontend_services=>action_ok.
        MESSAGE i006.              "Action Cancelled By User
        EXIT.
      ENDIF.
    * Download error data collected from the internal table
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename                = fullpath
          filetype                = 'ASC'
          write_field_separator   = '#'
        CHANGING
          data_tab                = gi_final   "Your InterNal Table Name
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          not_supported_by_gui    = 22
          error_no_gui            = 23
          OTHERS                  = 24.
    * If selection is successful
      IF sy-subrc EQ 0.
        MESSAGE s004 . " File  created successfully
      ELSE.
        MESSAGE i005 . " File is not created successfully
      ENDIF.

  • Uploading internal table to Excel sheet

    Hi Experts,
    I am downloading data from Excel file which is saved on local desktop i.e. Presentation server into internal table.
    Changing internal table data and uploading it back to same Excel sheet
    Tried using FM 'MS_EXCEL_OLE_STANDARD_DAT'.
    Issues faced:
    1) New file is getting generated and existing one is not getting edited.
    2) While executing the program the newly created Excel file opens as a pop up. I want to avoid this.
    Please help.

    Hi
    PARAMETER P_file like RLGRAP-FILENAME
    data : begin of int_head occurs 0,
    Filed1(20) type c,                     " Header Data
    end of int_head.
    int_head-Filed1 = 'PLTNY'.
    APPEND int_head.
    CLEAR int_head.
    int_head-Filed1 = 'WERKS'.
    APPEND int_head.
    CLEAR int_head.
    int_head-Filed1 = 'KTEXT'.
    APPEND int_head.
    CLEAR int_head.
    Select plnty werks ktext from plko into CORRESPONDING FIELDS OF TABLE itab
    Where plnty = 'Q' .
    v_filetype = '.xls'. "I just manipulate the file name using XLS file type.
    v_filename = p_file.
    CONCATENATE p_file v_filetype INTO lv_filename.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename                = lv_filename
    filetype                = 'ASC'
    write_field_separator   = 'X'
    TABLES
    data_tab                = ITAB
    FIELDNAMES              = int_head
    EXCEPTIONS
    file_write_error        = 1
    no_batch                = 2
    gui_refuse_filetransfer = 3
    invalid_type            = 4
    no_authority            = 5
    unknown_error           = 6
    header_not_allowed      = 7
    separator_not_allowed   = 8
    filesize_not_allowed    = 9
    header_too_long         = 10
    dp_error_create         = 11
    dp_error_send           = 12
    dp_error_write          = 13
    unknown_dp_error        = 14
    access_denied           = 15
    dp_out_of_memory        = 16
    disk_full               = 17
    dp_timeout              = 18
    file_not_found          = 19
    dataprovider_exception  = 20
    control_flush_error     = 21
    OTHERS = 22.
    IF sy-subrc <> 0.
    ENDIF.
    ENDFORM.

  • Download to multiple excel sheets

    Hi all,
    How can we download data to different sheets in one excel using 2 internal tables.
    Thanks,
    Rajesh.

    Hi thanks for the reply,
    i almost solved the problem, except i need to save the excel file in a particular directory.
    what is the procedure. the following code dosen't do that.
    this is my code.
    data: begin of itab occurs 0,
          posnr like vbap-posnr,
          vbeln like vbak-vbeln,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into corresponding fields of table itab.
    data : V_COL   LIKE SY-TABIX.     " column number of the cell
    data : v_row  like sy-tabix.
    data : zmeng like vbap-zmeng.
    data : posnr1 like vbap-posnr.
    data : count(3) type n.
    DATA: gs_excel TYPE ole2_object ,
          H_CELL  TYPE OLE2_OBJECT,
    gs_wbooklist TYPE ole2_object ,
    gs_application TYPE ole2_object ,
    gs_wbook TYPE ole2_object ,
    gs_activesheet TYPE ole2_object ,
    gs_sheets TYPE ole2_object ,
    gs_newsheet TYPE ole2_object .
    DATA gv_sheet_name(20) TYPE c .
    DATA gv_outer_index LIKE sy-index .
    DATA gv_intex(2) TYPE c .
    DATA gv_line_cntr TYPE i . "line counter
    *PARAMETERS: p_sheets TYPE i .
    data : p_sheets TYPE i .
    START-OF-SELECTION .
    sort itab by posnr.
    loop at itab to 1.
    posnr1 = itab-posnr.
    endloop.
    count = 1.
    loop at itab.
    at new posnr.
    p_sheets = p_sheets + 1.
    endat.
    endloop.
    DO p_sheets TIMES .
    *--Forming sheet name
    gv_intex = sy-index .
    gv_outer_index = sy-index .
    CONCATENATE 'Excel Sheet #' gv_intex INTO gv_sheet_name .
    *--For the first loop, Excel is initiated and one new sheet is added
    IF sy-index = 1 .
    CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF gs_excel 'Visible' = 1 .
    GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooklist .
    GET PROPERTY OF gs_wbooklist 'Application' = gs_application .
    SET PROPERTY OF gs_application 'SheetsInNewWorkbook' = 1 .
    CALL METHOD OF gs_wbooklist 'Add' = gs_wbook .
    GET PROPERTY OF gs_application 'ActiveSheet' = gs_activesheet .
    SET PROPERTY OF gs_activesheet 'Name' = gv_sheet_name .
    *--For the rest of loops, other sheets are added
    ELSE .
    GET PROPERTY OF gs_wbook 'Sheets' = gs_sheets .
    CALL METHOD OF gs_sheets 'Add' = gs_newsheet .
    SET PROPERTY OF gs_newsheet 'Name' = gv_sheet_name .
    ENDIF .
    gv_line_cntr = 1 . "line counter
    sort itab by posnr.
      LOOP AT ITAB where posnr = posnr1.
        V_COL = v_col + 1.
        PERFORM FILL_CELL USING v_col 1 ITAB-vbeln.
        PERFORM FILL_CELL USING v_col 2 ITAB-posnr.
        zmeng = zmeng + ITAB-posnr.
        at end of posnr.
          v_col = v_col + 1.
          PERFORM FILL_CELL USING v_col 2 zmeng.
          clear v_row.
          clear zmeng.
        endat.
      ENDLOOP.
      delete itab where posnr = posnr1.
      loop at itab to 1.
        posnr1 = itab-posnr.
      endloop.
    clear v_col.
    enddo.
    *--Deallocating memory
    FREE: gs_excel, gs_wbooklist, gs_application, gs_wbook,
    gs_activesheet,gs_sheets, gs_newsheet.
    FORM FILL_CELL USING  ROW COL VAL.
      CALL METHOD OF gs_EXCEL 'Cells' = H_CELL
                     EXPORTING #1 = ROW #2 = COL.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_CELL 'Value' = VAL .
      PERFORM ERR_HDL.
    ENDFORM.                    " FILL_CELL
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        WRITE: / 'Error in processing Excel File:'.
        STOP.
      ENDIF.
    ENDFORM.
    please send your suggestions,
    rajesh.

  • Download to multiple excel sheets in the backgraoud

    Hi,
    I am trying to download data into multiple excel sheets in the background. I was able to create comma delimited csv file in the server, which can be opened as excel file. This is good when it does not have more that one worksheets.
    I have three internal table and to send these internal tables in different worksheets in the same excel file.
    Is it possible to have multiple sheets excel file from the csv file?

    Check the following thread !!
    Re: Downloading data into excel
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

Maybe you are looking for

  • Vendor Payment with reference to MIRO Invoice

    Dear SAP Gurus, This is my first posting in this site, I am working for a implementation project first time. I need your help in providing solution for client requirement. My client is posting a vendor invoice through MIRO & for the payment of the sa

  • 3D using Flash Player 10

    Hi All, I want to render the RSS feeds on a page using 3D effects. How can I use Flash Player 10 for that? I want to render feeds exactly following way : This is very far feed This feeds is a bit far. This is the nearest feed. This is not too far. Th

  • WINDOWS 8 SCREEN SAVER NOT TURNING ON

    I have a TouchSmart with Windows 8 and the screen saver will not turn on.  Will work in preview but will not function.  Have tried all available screen savers and applied all with no luck.  Any ideas out there?

  • Can I buy in app game options with my itunes credit?

    How do I purchase an in app option using my iTunes credit?

  • 1252 status blinks red,green,blue

    Hi, I'we connected a Cisco 1252 accesspoint to a 802.3af switch, 15.4w. And it blinks red, green, blue on the status. The accesspoint is autonomous using latest c1250-k9w7-tar.124-21a.JA1. 5Ghz radio is off/disabled. but im still getting this in the