Application Development 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: 

Download Header using GUI_DOWNLOAD . I want to download header information in notepad file

former_member809080
Participant
0 Kudos




TYPES: BEGIN OF st_spfli,
carrid TYPE s_carr_id,
connid TYPE s_conn_id,
countryfr TYPE land1,
cityfrom TYPE s_from_cit,
END OF st_spfli.

TYPES: BEGIN OF it_header ,
id_name(10),
id_country(20),
END OF it_header.

DATA: L_HEADER TYPE TABLE OF IT_HEADER,
WA_HEADER TYPE IT_HEADER.


DATA: WA_SPFLI TYPE ST_SPFLI,
IT_SPFLI TYPE TABLE OF ST_SPFLI.



SELECT-OPTIONS: s_carrid FOR wa_spfli-carrid .


START-OF-SELECTION.


select carrid
connid
countryfr
cityfrom from spfli into TABLE it_spfli
WHERE carrid in s_carrid.

loop at it_spfli INTO wa_spfli.

WRITE: / wa_spfli-carrid , wa_spfli-connid, wa_spfli-countryfr, wa_spfli-cityfrom .

ENDLOOP.


CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename ='C:\Users\Deepak\OneDrive\Desktop\YES.TXT'
FILETYPE = 'ASC'
* APPEND = 'X'
* WRITE_FIELD_SEPARATOR = '-'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
* SHOW_TRANSFER_STATUS = ABAP_TRUE
* VIRUS_SCAN_PROFILE = '/SCET/GUI_DOWNLOAD'
* IMPORTING
* FILELENGTH =
tables
data_tab = it_spfli
FIELDNAMES = L_HEADER
* 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.
* Implement suitable error handling here
ENDIF.


*
*
if SY-SUBRC = 0.

MESSAGE 'DATA DOWNLOAD SUCCESFULLY' TYPE 'I'.

ENDIF.
1 ACCEPTED SOLUTION

venkateswaran_k
Active Contributor
0 Kudos

Hi

I assume you are looking for header line in the notepad of your downloaded data.

    data IT_FINAL TYPE TABLE OF ST_SPFLI,
         WA_FINAL TYPE ST_SPFLI.

     "Header line
         WA_FINAL-CARRID = WA_SPFLI-CARRID.
         WA_FINAL-CONNID = WA_SPFLI-CONNID.
         WA_FINAL-COUNTRYFR = WA_SPFLI-COUNTRYFR.
         WA_FINAL-CITYFROM = WA-SPFLI-CITYFROM.
         APPEND WA_FINAL TO IT_FINAL.
    "Data line
    LOOP at it_spfli INTO wa_spfli.
         APPEND WA_FINAL TO IT_FINAL.
    ENDLOOP.
    "download
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*     BIN_FILESIZE                    =
      filename                        ='C:\Users\Deepak\OneDrive\Desktop\YES.TXT'
     FILETYPE                        = 'ASC'
    tables
      data_tab                        = it_spfli.

Regards,

Venkat

1 REPLY 1

venkateswaran_k
Active Contributor
0 Kudos

Hi

I assume you are looking for header line in the notepad of your downloaded data.

    data IT_FINAL TYPE TABLE OF ST_SPFLI,
         WA_FINAL TYPE ST_SPFLI.

     "Header line
         WA_FINAL-CARRID = WA_SPFLI-CARRID.
         WA_FINAL-CONNID = WA_SPFLI-CONNID.
         WA_FINAL-COUNTRYFR = WA_SPFLI-COUNTRYFR.
         WA_FINAL-CITYFROM = WA-SPFLI-CITYFROM.
         APPEND WA_FINAL TO IT_FINAL.
    "Data line
    LOOP at it_spfli INTO wa_spfli.
         APPEND WA_FINAL TO IT_FINAL.
    ENDLOOP.
    "download
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*     BIN_FILESIZE                    =
      filename                        ='C:\Users\Deepak\OneDrive\Desktop\YES.TXT'
     FILETYPE                        = 'ASC'
    tables
      data_tab                        = it_spfli.

Regards,

Venkat