diff --git a/src/zcl_excel_common.clas.abap b/src/zcl_excel_common.clas.abap index 07271ae..96dd3ea 100644 --- a/src/zcl_excel_common.clas.abap +++ b/src/zcl_excel_common.clas.abap @@ -1056,7 +1056,6 @@ CLASS zcl_excel_common IMPLEMENTATION. * Assign structure and X-structure ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO . ASSIGN COMPONENT wa_component-name OF STRUCTURE e_targetx TO . -* At least one field in the structure should be marked - otherwise continue with next field * maybe source is just a structure - try assign component... ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO . IF sy-subrc <> 0. @@ -1069,7 +1068,7 @@ CLASS zcl_excel_common IMPLEMENTATION. ENDIF. CASE wa_component-type_kind. - WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursio + WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = CHANGING e_target = e_targetx = ). @@ -1091,9 +1090,6 @@ CLASS zcl_excel_common IMPLEMENTATION. DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name LIKE wa_component-name, - check_class TYPE abap_bool, - lo_refdescr TYPE REF TO cl_abap_refdescr, - lo_classdescr TYPE REF TO cl_abap_classdescr, o_border TYPE REF TO zcl_excel_style_border. FIELD-SYMBOLS: TYPE any, @@ -1110,34 +1106,24 @@ CLASS zcl_excel_common IMPLEMENTATION. ASSIGN COMPONENT wa_component-name OF STRUCTURE i_sourcex TO . * At least one field in the structure should be marked - otherwise continue with next field CHECK CA abap_true. - CLEAR check_class. * maybe target is just a structure - try assign component... ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO . IF sy-subrc <> 0. * not - then it is an attribute of the class - use different assign then + IF 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. + e_target = o_border. + ENDIF. CONCATENATE 'E_TARGET->' wa_component-name INTO attribute_name. ASSIGN (attribute_name) TO . - IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps - IF IS INITIAL. - check_class = abap_true. - ENDIF. + IF sy-subrc <> 0. + EXIT. + ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps ENDIF. CASE wa_component-type_kind. WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion - IF check_class = abap_true. - TRY. - lo_refdescr ?= cl_abap_typedescr=>describe_by_data( ). - lo_classdescr ?= lo_refdescr->get_referenced_type( ). - CASE lo_classdescr->get_relative_name( ). - WHEN 'ZCL_EXCEL_STYLE_BORDER'. -* 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. - = o_border. - ENDCASE. - CATCH cx_sy_move_cast_error. - ENDTRY. - ENDIF. zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = i_sourcex = CHANGING e_target = ).