TEXT_CONVERT_XLS_TO_SAP FM is throughing an error
I am uploading a xls file into internal table using TEXT_CONVERT_XLS_TO_SAP.
The file strusture is as below.
Row1: Customer City
Row 2: Customer City
Row2: 2000001 ABD
My requirement is to skip the first two row details, as they are just the field titles and i need not consider the first two row's.
I should pick the data from Third row onwards which is actual data.
I have to use this TEXT_CONVERT_XLS_TO_SAP FM only.
I have passed the
i_line_header = 'X'
in the function module it is deleting only one header hower to remove the other header what i have to do , because the FM is throughing an error conversion_failed.
Please help me .
You can do it as follows:
DATA:li_tab_raw_data TYPE truxs_t_text_data.
DATA: BEGIN OF i_tab OCCURS 0,
fld1(6) TYPE c,
END OF i_tab.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
i_tab_raw_data = li_tab_raw_data
i_filename = 'C:\temp\test1_xls.xls'
i_tab_converted_data = i_tab
CONVERSION_FAILED = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
LOOP AT i_tab.
IF sy-tabix EQ 1 OR sy-tabix EQ 2. "for first 2 rows
Or you can use following FM
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
filename = file
i_begin_col = 1
i_begin_row = 3 "to start from 3rd row
i_end_col = 2 "depends on # of col's
i_end_row = 65000
intern = iexcel
inconsistent_parameters = 1
upload_ole = 2
others = 3.