Code: Alles auswählen.
TYPES: BEGIN OF t_structure,
steps TYPE i,
name LIKE ...,
...
END OF t_structure.
DATA it_excel TYPE STANDARD TABLE OF t_structure.
DATA wa_excel LIKE LINE OF it_excel.
Code: Alles auswählen.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
Code: Alles auswählen.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = pc_file
filetype = 'ASC'
TABLES
data_tab = it_excel
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
* NO_BATCH = 5
unknown_error = 6
* INVALID_TABLE_WIDTH = 7
* GUI_REFUSE_FILETRANSFER = 8
* CUSTOMER_ERROR = 9
* NO_AUTHORITY = 10
OTHERS = 11
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT it_excel INTO wa_excel.
IF it_excel CN '; '.
SPLIT it_excel AT ';' INTO
wa_excel-steps
wa_excel-name
...
.
APPEND wa_excel.
CLEAR wa_excel.
ENDIF.
Code: Alles auswählen.
IT_EXCEL muss ein zeichenartiges Datenobjekt sein (Datentyp C,N,D,T oder String)
Code: Alles auswählen.
DATA: BEGIN OF t_structure,
steps(3) TYPE c,
....
END OF t_structure.
DATA: BEGIN OF it_excel OCCURS 0.
INCLUDE STRUCTURE t_structure.
DATA: END OF it_excel.
DATA: BEGIN OF line OCCURS 0,
a(256).
DATA: END OF line.
...
*&---------------------------------*
*& gewaehlte Datei uploaden *
*&---------------------------------*
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = pc_file
filetype = 'ASC'
TABLES
data_tab = line
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
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT line .
IF line CN '; '.
SPLIT line AT ';' INTO
it_excel-steps
...
.
APPEND it_excel.
CLEAR it_excel.
ENDIF.
ENDLOOP.