Skip to Content
author's profile photo Former Member
Former Member

how to dowload data in particular cell of designed excel sheet

hi everyone

i want to dowload the data in a excel sheet, but this excel sheet is designed in such a format that i have download each field of internal table in a specified cell only , <b>gui_download</b> function module simply download the data in excel sheet by taking the first cell for first field but i dont want that

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Jun 08, 2006 at 06:12 AM

    HI Neetu,

    In that case,

    you can change the internal table structure itself in such a way that the fields go into corresponding columns.

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2006 at 06:13 AM

    Hi,

    Take a look at this weblog

    /people/rich.heilman2/blog/2005/09/12/manipulate-excel-with-ole-abap

    /people/sap.user72/blog/2006/02/07/downloading-data-into-excel-with-format-options

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 08, 2006 at 06:34 AM

    Hi Neetu,

    you can use OLE in that case.

    REPORT  ZTEST_EXCEL             .
    
    INCLUDE ole2incl.
    
    DATA: application TYPE ole2_object,
           workbook TYPE ole2_object,
           sheet TYPE ole2_object,
           cells TYPE ole2_object.
    
    CONSTANTS: row_max TYPE i VALUE 256.
    DATA index TYPE i.
    
    
    DATA: BEGIN OF itab1 OCCURS 0,
     first_name(10),
     last_name(10),
     END OF itab1.
    
    START-OF-SELECTION.
     itab1-first_name = '123445'.
     itab1-last_name = 'tesst'.
     append itab1.
     clear itab1.
    
     
    
     itab1-first_name = '123446'.
     itab1-last_name = 'tesst'.
     append itab1.
     clear itab1.
    
     
    
      CREATE OBJECT application 'excel.application'.
      SET PROPERTY OF application 'visible' = 1.
      CALL METHOD OF application 'Workbooks' = workbook.
      CALL METHOD OF workbook 'Add'.
    
     
    
    * Create first Excel Sheet
    
      CALL METHOD OF application 'Worksheets' = sheet
                                   EXPORTING #1 = 1.
    
      CALL METHOD OF sheet 'Activate'.
      SET PROPERTY OF sheet 'Name' = 'Sheet1'.
    
      LOOP AT itab1.
        index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name
        CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
        SET PROPERTY OF cells 'Value' = itab1-first_name.
            index = index + 1. " 1 - column name
        CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.
        SET PROPERTY OF cells 'Value' = itab1-last_name.
      ENDLOOP.
    * Save excel speadsheet to particular filename
      CALL METHOD OF sheet 'SaveAs'
                     EXPORTING #1 = 'c:tempexceldoc1.xls'     "filename
                                #2 = 1.                          "fileFormat

    Regards

    vijay

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.