Abap Excel to Internal Table

sap-abap-logo

REPORT Z_EXCEL_to_ITAB.
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.

TYPES: BEGIN OF t_datatab,
ebeln LIKE ymtil_cons_po-ebeln,
ebelp LIKE ymtil_cons_po-ebelp,
END OF t_datatab.

DATA: it_datatab TYPE STANDARD TABLE OF t_datatab,

 wa_datatab TYPE t_datatab.
DATA: it_raw 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.

 CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

 EXPORTING

 i_line_header        = 'X'

 i_tab_raw_data       = it_raw

 i_filename           = p_file

 TABLES

 i_tab_converted_data = it_datatab[]

 EXCEPTIONS

 conversion_failed    = 1

 OTHERS               = 2.

 IF sy-subrc <> 0.

 *  key in some message

 ENDIF.
END-OF-SELECTION.

 LOOP AT it_datatab INTO wa_datatab.

 * Do anything with the work area wa_datatab.

 ENDLOOP.
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)