*&---------------------------------------------------------------------*
*& Report ZEV_UPLOAD
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zev_upload MESSAGE-ID zfi.
TYPE-POOLS truxs.
SELECTION-SCREEN: BEGIN OF BLOCK a WITH FRAME TITLE TEXT-001.
PARAMETER: p_table LIKE dd02l-tabname,
p_file LIKE rlgrap-filename. " DEFAULT 'c:\temp\zcvaa.csv'.
SELECTION-SCREEN: END OF BLOCK a.
DATA: it_tab TYPE REF TO data.
DATA: gt_table TYPE REF TO cl_salv_table.
IF p_table+0(1) NE 'Z'.
MESSAGE s000 WITH 'CBO테이블만 가능합니다' DISPLAY LIKE 'E'.
EXIT.
ENDIF.
CREATE DATA it_tab TYPE TABLE OF (p_table).
FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE.
ASSIGN it_tab->* TO <fs_tab>.
DATA: it_type TYPE truxs_t_text_data.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
START-OF-SELECTION.
IF p_table+0(1) NE 'Z'.
MESSAGE e000 WITH 'CBO테이블만 가능합니다'.
EXIT.
ENDIF.
* uploading the data in the file into internal table
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_type
i_filename = p_file
TABLES
i_tab_converted_data = <fs_tab>
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid
TYPE sy-msgty
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
END-OF-SELECTION.
MODIFY (p_table) FROM TABLE <fs_tab>.
DESCRIBE TABLE <fs_tab> LINES DATA(dcr).
WRITE: dcr, 'lines got updated in table', p_table.
댓글 없음:
댓글 쓰기