Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

GUI_DOWNLOAD

Former Member
0 Likes
458

Hello All,

I need to print the fieldnames when i was downloading the data by using GUI_DOWNLOAD function module. Can anybody explain how to use this function module for writing the fieldnames.

thanks and regards

Madhavi

Hello All,

I need to print the fieldnames when i was downloading the data by using GUI_DOWNLOAD function module. Can anybody explain how to use this function module for writing the fieldnames.

thanks and regards

Madhavi

3 REPLIES 3
Read only

Former Member
0 Likes
437

Hello,

U can use WS_DOWNLOAD like this:


L_T_HEADERS TYPE TABLE OF TEXT40.
IF SP_LOCAL = 'X'.
* Headings: TEXT-U01 ... TEXT-U28
    DO 28 TIMES.
      CLEAR: L_F_INDEX,L_F_NAME,L_F_HEADERS.
      L_F_INDEX = SY-INDEX.
      CONCATENATE 'TEXT-U' L_F_INDEX INTO L_F_NAME.
      ASSIGN (L_F_NAME) TO <FS_HEADER>.
      L_F_HEADERS = <FS_HEADER>.
      APPEND L_F_HEADERS TO L_T_HEADERS.
    ENDDO.

    CALL FUNCTION 'WS_DOWNLOAD'
         EXPORTING
              FILENAME                = SP_FILE
              FILETYPE                = 'DAT'
         TABLES
              DATA_TAB                = L_T_OUT
              FIELDNAMES              = L_T_HEADERS
         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 'I' NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      LEAVE PROGRAM.
    ELSE.
      DESCRIBE TABLE L_T_OUT LINES L_F_COUNT.
      MESSAGE I145 WITH L_F_COUNT SP_FILE.
    ENDIF.

REgrads,

VAsanth

Read only

former_member404244
Active Contributor
0 Likes
437

Hi,

in the GUI_DOWNLOAD FM u have to fill the tables parameter FIELDNAMES.

Regards,

nagaraj

Read only

0 Likes
437

The fieldnames table doesn't work in this function. If you define all your fields as text, you can insert headers as the first row in the data table.