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

Download to Excel with Column Headings.

Hi All,

I have a very small issue.I want to download the Data from an internal table to an Excel Sheet Along with the Column heading of the corresponding Field...

I tried with ws_excel and gui_download... not reached to any conclusion,,,I cant go for OLE technique as i have huge amount of data in my internal table.

If anyone have faced the same problem ...please suggest something.

Thanks in advance,

Mayank.

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 12, 2005 at 09:36 AM

    Hi Mayank,

    I had once this requirement, and the only way to achieve it was to populate an internal table with the header in one row and the data in the following rows, and then download this <i>itab</i> via 'GUI_DOWNLOAD' as text separated by tabs.

    I hope it helps. BR,

    Alvaro

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 12, 2005 at 09:37 AM

    Hi,

    here's a poss. solution for csv-file.

    1) create fieldinfo with name of your itab-fields

    with RFC_GET_NAMETAB or LVC_FIELDCATALOG_MERGE

    2) before filling your output_tab with data:

    loop at fieldinfo.
     concatenate header fieldinfo-name ';' into header.
    endloop.
    append header to output_tab.

    regards Andreas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 12, 2005 at 10:07 AM

    Hi Har Mayank Sahai,

    you can use the XXL_SIMPLE_API function.

    With this function you can specified only one header.

    The import parameters are all optional.

    You can pass the ONLINE_TEXT and PRINT_TEXT table empty

    in the DATA table pass yuor internal table and in the last one table COL_TEXT you pass the header.

    I hope this help you

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 12, 2005 at 10:07 AM

    Hi,

    Once I also faced the same problem.It was solved by the below coding.In my coding i_download is the internal table with two fields werks and matnr .w_download is its workarea.

    PARAMETERS p_file LIKE rlgrap-filename.

    "File name

    • Local Variable declaration

    DATA lv_file TYPE string.

    lv_file = p_file.

    PERFORM f1710_populate_heading.

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    filename = lv_file

    filetype = 'ASC'

    write_field_separator = 'X'

    TABLES

    data_tab = i_download

    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 i000 WITH text-005. "File downloded successfully

    ELSE.

    CASE sy-subrc.

    WHEN 1.

    MESSAGE i000 WITH text-014.

    .....

    WHEN 21.

    MESSAGE i000 WITH text-071.

    ENDCASE.

    ENDIF.

    ENDFORM. " f1500_download_data

    *&----


    *& Form f1710_populate_heading

    *&----


    • Populate header records

    *----


    FORM f1710_populate_heading.

    CLEAR w_download.

    • Design the text element to handle maximum length of

    • the output

    w_download-werks = text-001.

    w_download-matnr = text-002.

    INSERT w_download INTO i_download INDEX 1.

    ENDFORM. " f1710_populate_heading

    Hope this is clear.

    If your problem is solved,could you please reward useful answers and close the thread.

    Rgds,

    J.Jayanthi

    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.