Skip to Content

problem with gui_download when using DBF FILE type.

Good Day Experts.

I am trying to download excel file using function module GUI_DOWNLOAD.

declared a table it_string type table string.

initially I appending my header to it_string. and then passing my internal table to it .

this is how I am passing data into it_string.

so in gui_download I am passing parameters as below. but I am not getting data into the excel file.

I tried both ways passing field separator as 'X' and '#'.

please guide me where I am wrong.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jun 02, 2014 at 08:52 AM

    Hi,

    Make sure that the data is uploading into the internal table it_string,debug and check once.

    Please check the following link,it may be helpful

    Downloading internal tables to Excel - ABAP Development - SCN Wiki

    Thanks & Regards,

    Sravanthi Polu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 02, 2014 at 09:32 AM

    Hello Surendra,

    Can you please upload your code sample. Thanks.

    What i manage to find is using this function module WS_DOWNLOAD.

    The file is downloaded in the directory --> C:/

    Here is the code sample :

    TABLES: usr03,dd02l.

    DATA: zx030l LIKE x030l.

    DATA BEGIN OF zdfies OCCURS 0.

    INCLUDE STRUCTURE dfies.

    DATA END OF zdfies.

    DATA: BEGIN OF flditab OCCURS 0,

    fldname(11) TYPE c,

    END OF flditab.

    DATA itabusr03 LIKE usr03 OCCURS 0 WITH HEADER LINE.

    DATA tname LIKE dd02l-tabname.

    SELECT * FROM usr03 INTO TABLE itabusr03.

    tname = 'USR03'.

    PERFORM getfieleds.

    PERFORM dwdbffile.

    ********************************************

    FORM getfieleds.

    CALL FUNCTION 'GET_FIELDTAB'

    EXPORTING

    langu = sy-langu

    only = space

    tabname = tname

    withtext = 'X'

    IMPORTING

    header = zx030l

    TABLES

    fieldtab = zdfies

    EXCEPTIONS

    internal_error = 01

    no_texts_found = 02

    table_has_no_fields = 03

    table_not_activ = 04.

    CASE sy-subrc.

    WHEN 0.

    LOOP AT zdfies.

    flditab-fldname = zdfies-fieldname.

    APPEND flditab.

    ENDLOOP.

    WHEN OTHERS.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-subrc.

    ENDCASE.

    ENDFORM. "GETFIELEDS

    ***********************************

    FORM dwdbffile.

    CALL FUNCTION 'WS_DOWNLOAD'

    EXPORTING

    * filename = 'C:\USR03.DBF'

    filename = 'C:\USR03.XLS'

    filetype = 'DBF'

    TABLES

    data_tab = itabusr03

    fieldnames = flditab

    EXCEPTIONS

    file_open_error = 1

    file_write_error = 2

    invalid_filesize = 3

    invalid_type = 4

    no_batch = 5

    unknown_error = 6

    invalid_table_width = 7

    gui_refuse_filetransfer = 8

    customer_error = 9

    OTHERS = 10.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    ENDFORM. "DWDBFFILE




    Thanks and Kind Regards,

    Yovish.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 02, 2014 at 10:11 AM

    Hi Surendra ,

    Few things -

    1. Use New line Character - Concatenate wa_string cl_abap_char_utilities=>New_line to wa_string before append wa_string to it_string.

    2. Are able to download the xls file ? First try with XLS file format

    3. As you mentioned 'First appending Header to It_string' , Not able to see part in attached screenshot

    Thanks & Regards,


    Arun

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 03, 2014 at 06:22 AM

    Good Day

    thanks for the replies to all.

    I have resolve the issue by making all fields in table as characters and passed my header as first record.

    but I couldn't achieve it by creating a dynamic table as table type string. I debugged it and noticed the data is going fine. it is going as below example

    aal0#comany#1234# as I concatenated every field separated by tab.

    but the output is coming as null.

    loop at itab_w assigning <dyn_wa>.

    do
    .

    assign component sy-index of structure <dyn_wa> to <dyn_field>.

    if sy-subrc = 0.

    exit.

    endif.

    if sy-index = 1.

    l_str = <dyn_flied>.

    else.

    concatenate l_str <dyn_field> into l_str separated by cl_abap_chat_utilities=>horizontal_tab.

    endif.

    endo.

    append l_str to it_str.

    endloop.

    in call function gui_download I am passing the file type as 'DBF'

    file name 'c:\ testdata.xls'.

    field separator = '#'

    tables

    data_tab = it_str

    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.