Update zcl_excel_common.clas.abap

defined exit when unbound reference (border) in class_to_struct
instead "Should not happen" exit
This commit is contained in:
Bernd 2024-10-21 15:07:48 +02:00 committed by GitHub
parent 6dcfbcf4e3
commit b036ad8750
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1075,6 +1075,9 @@ CLASS zcl_excel_common IMPLEMENTATION.
DESCRIBE FIELD i_source TYPE type_kind.
flag_class = boolc( type_kind = cl_abap_typedescr=>typekind_oref ).
* Only borders will be passed as unbound references.
CHECK flag_class = abap_false OR i_source IS NOT INITIAL. " Exit if unbound reference
descr ?= cl_abap_structdescr=>describe_by_data( e_target ).
LOOP AT descr->components INTO wa_component.
@ -1086,10 +1089,6 @@ CLASS zcl_excel_common IMPLEMENTATION.
IF flag_class = abap_false.
* source is a structure - use assign component
ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO <attribute>.
ELSEIF i_source IS INITIAL.
CLEAR <field>.
CLEAR <fieldx> WITH abap_true.
CONTINUE.
ELSE.
* then it is an attribute of the class - use different assign then
CONCATENATE 'i_source->' wa_component-name INTO attribute_name.
@ -1130,6 +1129,7 @@ CLASS zcl_excel_common IMPLEMENTATION.
DESCRIBE FIELD e_target TYPE type_kind.
flag_class = boolc( type_kind = cl_abap_typedescr=>typekind_oref ).
IF flag_class = abap_true AND e_target IS INITIAL.
* Only borders will be passed as unbound references. But since we want to set a value we have to create an instance
CREATE OBJECT o_border.