Skip to Content
0
Former Member
Nov 12, 2008 at 10:42 AM

load text file

84 Views

Hi,

i try to upload a text file from the server and what i get is just the first line in the table of string,

(data_tab) .

i want to get all the data in the file into one string or big variable how i can do that?

Regards

DATA: file_physical TYPE fileextern,
        physical_path TYPE pathintern,
        file_format TYPE fileformat,
        data_tab TYPE  standard table  of string   .

CALL METHOD cl_gui_frontend_services=>gui_upload
    EXPORTING
      filename                = l_file
      filetype                = 'ASC'
*    has_field_separator     = SPACE
*    header_length           = 0
*    read_by_line            = 'X'
*    dat_mode                = SPACE
*    codepage                = SPACE
*    ignore_cerr             = ABAP_TRUE
*    replacement             = '#'
*    virus_scan_profile      =
*  IMPORTING
*    filelength              =
*    header                  =
    CHANGING
      data_tab                = data_tab
    EXCEPTIONS
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      not_supported_by_gui    = 17
      error_no_gui            = 18
      OTHERS                  = 19
          .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Regards