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

Table Control

Hi,

How to download the displayed data from table control to local excel file.

Is there any function module?

I am new for module pool so send step by step

Regards,

Sudha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2007 at 10:35 AM

    Hi,

    Use GUI_DOWNLOAD.

    Reward if helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2007 at 10:41 AM

    HI,

    For every table control we have an internal table related to it, look at the PBO and PAI, you come to know which internal table is using to fill this table control, then use the GUI_DOWNLOAD function moduel to download this internal table data into Excel.

    its a simple way to do what is required

    CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'

    EXPORTING

    FILE_NAME = 'C:\test\yourfile.xls'

    • CREATE_PIVOT = 0

    • DATA_SHEET_NAME = ' '

    • PIVOT_SHEET_NAME = ' '

    • PASSWORD = ' '

    • PASSWORD_OPTION = 0

    TABLES

    • PIVOT_FIELD_TAB =

    DATA_TAB = itab " internal table to be passed

    • FIELDNAMES =

    EXCEPTIONS

    FILE_NOT_EXIST = 1

    FILENAME_EXPECTED = 2

    COMMUNICATION_ERROR = 3

    OLE_OBJECT_METHOD_ERROR = 4

    OLE_OBJECT_PROPERTY_ERROR = 5

    INVALID_PIVOT_FIELDS = 6

    DOWNLOAD_PROBLEM = 7

    OTHERS = 8

    Regards

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2007 at 10:48 AM

    Hi,

    First create a command button(FCT Code - 'WRITE') on the layout. then in the PAI of the layout write the code: & read the data from the tabe control or you can use the same internal table to download the data, used for displaying the data.

    DATA: v_file type string.
    
    Case sy-ucomm.
    When 'WRITE'.
    
    v_file = c:text.xls
    
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = v_file
          write_field_separator = 'X'
        TABLES
          data_tab                = itab
        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.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    
    endcase.
    

    Try the following func. module:

    If you are working on 4.7 or later version the try GUI_'GUI_DOWNLOAD' Or if you are working on 4.6 or lower version then try 'WS_DOWNLOAD'

    Reward points if helpful answer.

    Asvhender

    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.