mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 16:46:11 +08:00
Update zcl_excel_common.clas.abap
This commit is contained in:
parent
fba955bc5c
commit
c4fd6fe0b7
|
@ -1056,7 +1056,6 @@ CLASS zcl_excel_common IMPLEMENTATION.
|
|||
* Assign structure and X-structure
|
||||
ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO <field>.
|
||||
ASSIGN COMPONENT wa_component-name OF STRUCTURE e_targetx TO <fieldx>.
|
||||
* 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 <attribute>.
|
||||
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 = <attribute>
|
||||
CHANGING e_target = <field>
|
||||
e_targetx = <fieldx> ).
|
||||
|
@ -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: <field> TYPE any,
|
||||
|
@ -1110,34 +1106,24 @@ CLASS zcl_excel_common IMPLEMENTATION.
|
|||
ASSIGN COMPONENT wa_component-name OF STRUCTURE i_sourcex TO <fieldx>.
|
||||
* At least one field in the structure should be marked - otherwise continue with next field
|
||||
CHECK <fieldx> 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 <attribute>.
|
||||
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 <attribute>.
|
||||
IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps
|
||||
IF <attribute> 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( <attribute> ).
|
||||
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.
|
||||
<attribute> = o_border.
|
||||
ENDCASE.
|
||||
CATCH cx_sy_move_cast_error.
|
||||
ENDTRY.
|
||||
ENDIF.
|
||||
zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = <field>
|
||||
i_sourcex = <fieldx>
|
||||
CHANGING e_target = <attribute> ).
|
||||
|
|
Loading…
Reference in New Issue
Block a user