mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 05:04:11 +08:00
#252 Error while using grid object and reuse_alv table.
When you take the grid object from reuse_alv_grid_display FM then when cells were colored I received dump as the structure of color table was hardcoded to lvc_t_scol. When we have object from SLIS then there structure is differen so I prepared code to handle both situations.
This commit is contained in:
parent
f66f964996
commit
556ebdbc9b
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<CLAS CLSNAME="ZCL_EXCEL_CONVERTER_ALV" VERSION="1" LANGU="E" DESCRIPT="ALV grid interface implementation" CATEGORY="00" EXPOSURE="2" STATE="1" RELEASE="0" CLSABSTRCT="X" CLSCCINCL="X" FIXPT="X" UNICODE="X" CLSBCCAT="00" DURATION_TYPE="0 " RISK_LEVEL="0 ">
|
<CLAS CLSNAME="ZCL_EXCEL_CONVERTER_ALV" VERSION="1" LANGU="E" DESCRIPT="ALV grid interface implementation" CATEGORY="00" EXPOSURE="2" STATE="1" RELEASE="0" CLSABSTRCT="X" CLSCCINCL="X" FIXPT="X" UNICODE="X" CLSBCCAT="00" DURATION_TYPE="0 " RISK_LEVEL="0 " ZSAPLINK_PLUGIN_MAJOR_VERSION="0 " ZSAPLINK_PLUGIN_MINOR_VERSION="1 " ZSAPLINK_PLUGIN_BUILD_VERSION="0 " ZSAPLINK_PLUGIN_INFO1="ZSAPLINK_CLASS is part of the main ZSAPLINK project --> This plugin found there instead of ZSAPLINK_PLUGINS projects" ZSAPLINK_PLUGIN_INFO2="SAPLINK homepage: https://www.assembla.com/spaces/saplink/wiki" ZSAPLINK_PLUGIN_INFO3="Download from https://www.assembla.com/code/saplink/subversion/nodes" ZSAPLINK_PLUGIN_INFO4="and navigate to: trunk -> core -> ZSAPLINK -> CLAS -> ZSAPLINK_CLASS.slnk">
|
||||||
<implementing CLSNAME="ZCL_EXCEL_CONVERTER_ALV" REFCLSNAME="ZIF_EXCEL_CONVERTER" VERSION="1" EXPOSURE="2" STATE="1" RELTYPE="1" IMPABSTRCT="X" EDITORDER="0 "/>
|
<implementing CLSNAME="ZCL_EXCEL_CONVERTER_ALV" REFCLSNAME="ZIF_EXCEL_CONVERTER" VERSION="1" EXPOSURE="2" STATE="1" RELTYPE="1" IMPABSTRCT="X" EDITORDER="0 "/>
|
||||||
<localImplementation>*"* local class implementation for public class
|
<localImplementation>*"* local class implementation for public class
|
||||||
*"* use this source file for the implementation part of
|
*"* use this source file for the implementation part of
|
||||||
|
@ -285,7 +285,9 @@ TYPES: BEGIN OF ts_col_converter,
|
||||||
<fs_stab> TYPE ANY,
|
<fs_stab> TYPE ANY,
|
||||||
<fs> TYPE ANY,
|
<fs> TYPE ANY,
|
||||||
<fs_tcol> TYPE lvc_t_scol,
|
<fs_tcol> TYPE lvc_t_scol,
|
||||||
<fs_scol> TYPE lvc_s_scol.
|
<fs_scol> TYPE lvc_s_scol,
|
||||||
|
<ft_slis> type standard table,
|
||||||
|
<fs_slis> type any.
|
||||||
|
|
||||||
* Loop trough the table to set the color properties of each line. The color properties field is
|
* Loop trough the table to set the color properties of each line. The color properties field is
|
||||||
* Char 4 and the characters is set as follows:
|
* Char 4 and the characters is set as follows:
|
||||||
|
@ -320,24 +322,50 @@ TYPES: BEGIN OF ts_col_converter,
|
||||||
ENDIF.
|
ENDIF.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
IF ws_layo-ctab_fname IS NOT INITIAL.
|
if ws_layo-ctab_fname is not initial.
|
||||||
ASSIGN COMPONENT ws_layo-ctab_fname OF STRUCTURE <fs_stab> TO <fs_tcol>.
|
|
||||||
IF sy-subrc = 0.
|
assign component ws_layo-ctab_fname of structure <fs_stab> to <ft_slis>.
|
||||||
LOOP AT <fs_tcol> ASSIGNING <fs_scol>.
|
if sy-subrc = 0.
|
||||||
READ TABLE wt_colors INTO ls_color WITH TABLE KEY col = <fs_scol>-color-col
|
loop at <ft_slis> assigning <fs_slis>.
|
||||||
int = <fs_scol>-color-int
|
assign component 'COLOR' of structure <fs_slis> to <fs>.
|
||||||
inv = <fs_scol>-color-inv.
|
if sy-subrc = 0.
|
||||||
IF sy-subrc = 0.
|
if <fs> is not initial.
|
||||||
ls_con_col-rownumber = l_line.
|
field-symbols: <col> type any,
|
||||||
ls_con_col-columnname = <fs_scol>-fname.
|
<int> type any,
|
||||||
ls_con_col-fontcolor = ls_color-fontcolor.
|
<inv> type any,
|
||||||
ls_con_col-fillcolor = ls_color-fillcolor.
|
<fname> type any,
|
||||||
ls_con_col-nokeycol = <fs_scol>-nokeycol.
|
<nokeycol> type any.
|
||||||
INSERT ls_con_col INTO TABLE et_colors.
|
assign component 'COL' of structure <fs> to <col>.
|
||||||
ENDIF.
|
assign component 'INT' of structure <fs> to <int>.
|
||||||
ENDLOOP.
|
assign component 'INV' of structure <fs> to <inv>.
|
||||||
ENDIF.
|
read table wt_colors into ls_color with table key col = <col>
|
||||||
ENDIF.
|
int = <int>
|
||||||
|
inv = <inv>.
|
||||||
|
if sy-subrc = 0.
|
||||||
|
ls_con_col-rownumber = l_line.
|
||||||
|
assign component 'FNAME' of structure <fs_slis> to <fname>.
|
||||||
|
if sy-subrc ne 0.
|
||||||
|
assign component 'FIELDNAME' of structure <fs_slis> to <fname>.
|
||||||
|
if sy-subrc eq 0.
|
||||||
|
ls_con_col-columnname = <fname>.
|
||||||
|
endif.
|
||||||
|
else.
|
||||||
|
ls_con_col-columnname = <fname>.
|
||||||
|
endif.
|
||||||
|
|
||||||
|
ls_con_col-fontcolor = ls_color-fontcolor.
|
||||||
|
ls_con_col-fillcolor = ls_color-fillcolor.
|
||||||
|
assign component 'NOKEYCOL' of structure <fs_slis> to <nokeycol>.
|
||||||
|
if sy-subrc eq 0.
|
||||||
|
ls_con_col-nokeycol = <nokeycol>.
|
||||||
|
endif.
|
||||||
|
insert ls_con_col into table et_colors.
|
||||||
|
endif.
|
||||||
|
endif.
|
||||||
|
endif.
|
||||||
|
endloop.
|
||||||
|
endif.
|
||||||
|
endif.
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
endmethod.</source>
|
endmethod.</source>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user