Code: Alles auswählen.
REPORT ZTEST14.
data filename type string.
data itab type table of string.
filename = 'C:\addon.csv'.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = filename
* 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 = itab
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.
*Dann dein Loop at itab into ....
split etc.
Code: Alles auswählen.
constants: htab(1) value %_horizontal_tab. " ab Rel.4.7
* ...
split itab at htab into .....
Code: Alles auswählen.
* x'09' = Tabulator
data h_tab type x value '09'.
data b(30).
data : a1(10),
a2(10),
a3(10).
concatenate 'a' 'b' 'c' into b separated by h_tab.
split b at h_tab into a1 a2 a3.
write: / a1,a2,a3.
...
Code: Alles auswählen.
data htab(1).
data crlf(2).
* in 4.7 gibt es Konstanten dafür
CLASS cl_abap_char_utilities DEFINITION LOAD.
crlf = cl_abap_char_utilities=>cr_lf.
htab = cl_abap_char_utilities=>horizontal_tab.
Code: Alles auswählen.
CREATE DATA reftabelle TYPE (wa_tabellenname).