Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Form F4_GET_FILENAME
*&---------------------------------------------------------------------*
call method CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
exporting
DEFAULT_EXTENSION = 'xml'
DEFAULT_FILENAME = PV_FILE
changing
FILE_TABLE = LT_FILE_NAM
RC = LV_COUNT
exceptions
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Form READ_DIR_FILES
*&---------------------------------------------------------------------*
* Verzeichnis
if PV_DIR is not initial and R_DIR = 'X'.
call method CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
exporting
DIRECTORY = PV_DIR
FILTER = '*.XL*'
FILES_ONLY = 'X'
DIRECTORIES_ONLY = ' '
changing
FILE_TABLE = PT_FILES
COUNT = LV_COUNT
exceptions
CNTL_ERROR = 1
DIRECTORY_LIST_FILES_FAILED = 2
WRONG_PARAMETER = 3
ERROR_NO_GUI = 4
NOT_SUPPORTED_BY_GUI = 5
others = 6.
endif.
* Filenamen mit DIR
loop at PT_FILES assigning <FILES>.
concatenate PV_DIR PA_DELIM <FILES>
into <FILES>.
endloop.
* Einzel-File
if PV_FILE is not initial and R_FILE = 'X'.
LS_FILES = PV_FILE.
append LS_FILES to PT_FILES.
endif.
Code: Alles auswählen.
* Files abarbeiten
loop at GT_FILES into LS_FILES .
perform UPLOAD_EXCEL_FILE_MULTISHEET
using LS_FILES.
endloop.
Code: Alles auswählen.
*Form UPLOAD_EXCEL_FILE_MULTISHEET
* Excel Container vorbereiten
perform EXCEL_MULTI_INIT using LV_FILENAME
changing LV_FEHLER.
Code: Alles auswählen.
* Form EXCEL_MULTI_INIT
concatenate 'FILE://' PV_FILENAME into LV_DOCUMENT_URL.
call method C_OI_CONTAINER_CONTROL_CREATOR=>GET_CONTAINER_CONTROL
importing
CONTROL = GO_CONTA_CONTROL
ERROR = GO_ERROR.
if GO_ERROR->HAS_FAILED = 'X'.
* call method GO_ERROR->RAISE_MESSAGE
* exporting
* TYPE = 'E'.
exit.
endif.
create object GO_GUI_CUST_CONTA
exporting
CONTAINER_NAME = 'CUST_DUMMY'
exceptions
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6.
if SY-SUBRC <> 0.
* message E001(00) with 'Error while creating container'.
exit.
endif.
call method GO_CONTA_CONTROL->INIT_CONTROL
exporting
INPLACE_ENABLED = 'X'
R3_APPLICATION_NAME = 'EXCEL CONTAINER'
PARENT = GO_GUI_CUST_CONTA
importing
ERROR = GO_ERROR
exceptions
JAVABEANNOTSUPPORTED = 1
others = 2.
if GO_ERROR->HAS_FAILED = 'X'.
call method GO_ERROR->RAISE_MESSAGE
exporting
TYPE = 'E'.
exit.
endif.
call method GO_CONTA_CONTROL->GET_DOCUMENT_PROXY
exporting
DOCUMENT_TYPE = SOI_DOCTYPE_EXCEL_SHEET
importing
DOCUMENT_PROXY = GO_DOCUMENT_PROXY
ERROR = GO_ERROR.
if GO_ERROR->HAS_FAILED = 'X'.
call method GO_ERROR->RAISE_MESSAGE
exporting
TYPE = 'E'.
exit.
endif.
PV_FEHLER = 5.
call method GO_DOCUMENT_PROXY->OPEN_DOCUMENT
exporting
DOCUMENT_TITLE = 'Excel'
DOCUMENT_URL = LV_DOCUMENT_URL
OPEN_INPLACE = 'X'
importing
ERROR = GO_ERROR.
if GO_ERROR->HAS_FAILED = 'X'.
LV_FILENAME = PV_FILENAME.
message I018 with LV_FILENAME into LV_TEXT.
message LV_TEXT type 'I'.
leave list-processing.
exit.
endif.