2022 Nov 11 2:10 AM
Hi i have a xlsx and csv data
when i use the csv file the internal table is
but in xlsx the data is
is there a function module needed after the gui_upload?
for the csv data i know i can solve it using split but i dont want to use split. i don't know if there is a function module for that.
for the xlsx i dont know why the data turns into different characters can someone explain please. and if there is a function module i need to use
TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
parameters: p_file type string.
DATA: i_tab TYPE STANDARD TABLE OF t_datatab.
DATA: lv_rc TYPE i,
lt_files TYPE filetable.
at selection-screen on value-request for p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog(
CHANGING
file_table = lt_files
rc = lv_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5
).
IF lv_rc GT 0.
READ TABLE lt_files INDEX 1 INTO p_file.
ENDIF.
start-of-selection.
call method cl_gui_frontend_services=>gui_upload(
EXPORTING
filename = p_file
filetype = 'ASC'
has_field_separator = 'X'
* header_length = 0
* read_by_line = 'X'
* dat_mode = space
codepage = '4110'
* ignore_cerr = abap_true
* replacement = '#'
* virus_scan_profile =
* IMPORTING
* filelength =
* header =
CHANGING
data_tab = i_tab
).
2022 Nov 11 6:24 AM
An Xlsx file is not a flat file, you cannot open it using a Notepad.exe on your Windows system. (Like a PDF, a Word doc, .....)
If you need to read a real Excel file (not a CSV) the better is to use the Abap2Xlsx
2022 Nov 11 6:24 AM
An Xlsx file is not a flat file, you cannot open it using a Notepad.exe on your Windows system. (Like a PDF, a Word doc, .....)
If you need to read a real Excel file (not a CSV) the better is to use the Abap2Xlsx
2022 Nov 11 9:28 AM
XLSX is a special format. The first layer is a ZIP file (and so you can open it like any ZIP file). Inside the ZIP file, you have essentially XML files. It's documented by Microsoft (Office Open XML).
As the format is quite complex, there was a community project: abap2xlsx (which reads and writes XLSX files)