Skip to Content
0
Jan 26, 2023 at 05:08 AM

Error XLSX parsing in RAP

242 Views

The following error occurs when I was parsing the XLSX file using the xco_cp_xlsx class.

image.png

The source code is below.

READ ENTITIES OF zi_upload IN LOCAL MODE

ENTITY zi_upload

ALL FIELDS WITH CORRESPONDING #( keys )

RESULT DATA(lt_result).

data(lo_read_access) = xco_cp_xlsx=>document->for_file_content( lt_result[ 1 ]-Attachment

)->read_access( ).

data(lo_first_worksheet) = lo_read_access->get_workbook(

)->worksheet->at_position( 1 ).

*

DATA(lo_pattern_1) = xco_cp_xlsx_selection=>pattern_builder->simple_from_to(

)->from_column( xco_cp_xlsx=>coordinate->for_alphabetic_value( 'A' )

)->to_column( xco_cp_xlsx=>coordinate->for_alphabetic_value( 'B' )

)->from_row( xco_cp_xlsx=>coordinate->for_numeric_value( 2 )

)->to_row( xco_cp_xlsx=>coordinate->for_numeric_value( 2 )

)->get_pattern( ).

types: begin of ty_row,

Material type string,

Quantity type string,

end of ty_row,

tty_row type table of ty_row with DEFAULT KEY.

data: lt_row type tty_row.

try.

data(lo_colums) = lo_first_worksheet->select( lo_pattern_1 )->row_stream( )->operation->write_to( ref #( lt_row )

)->if_xco_xlsx_ra_operation~execute( ).

catch CX_XCO_DEP_WRAPPED_EXCEPTION into data(error).

data(lv_msg) = error->get_longtext( ).

endtry.

error message is "System expected end of element '{http://schemas.openxmlformats.org/spreadsheetml/2006/main}si'."

I couldn't find a solution.

How can I solve this?

Attachments

image.png (17.7 kB)