2008 Jul 31 9:09 AM
hi,
I am tryin to display an alv grid by fetching data form the same tables at two diffrent dates , what i want to do is to compare the data which has changed within these dates for the same entry . The data which has changed has to highlighted with a specific color and the ones which have stayed the same over the span of time should remain the same .Trying to find ana efficeient way in which i can compare the data and dispaly it .
if any clarifications required please do ask.
Thanks in advance
2008 Jul 31 9:18 AM
Hi,
Just go through following code ....the code is for coloring particular cell ....u can put condition where the data is changing ...
REPORT ZASHU_ALV_CELL_COLOR.
TABLES: MARA , MAKT .
DATA: LAYOUT TYPE LVC_S_LAYO .
DATA: CONT1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER .
DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID .
DATA: FCAT1 TYPE LVC_T_FCAT .
DATA: WA_FCAT1 LIKE LINE OF FCAT1 .
TYPES: BEGIN OF TYPE_ITAB1 ,
MATNR LIKE MARA-MATNR ,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL ,
MAKTX LIKE MAKT-MAKTX ,
COL TYPE lvc_t_scol,
END OF TYPE_ITAB1 .
DATA: IT_ITAB1 TYPE STANDARD TABLE OF TYPE_ITAB1 WITH HEADER LINE .
DATA: LEN TYPE I.
LAYOUT-INFO_FNAME = 'COL' .
break devuser .
WA_FCAT1-TABNAME = 'IT_ITAB1' .
WA_FCAT1-FIELDNAME = 'MATNR' .
WA_FCAT1-COLTEXT = 'Material' .
WA_FCAT1-OUTPUTLEN = 18 .
APPEND WA_FCAT1 TO FCAT1 .
CLEAR WA_FCAT1 .
WA_FCAT1-TABNAME = 'IT_ITAB1' .
WA_FCAT1-FIELDNAME = 'MTART' .
WA_FCAT1-COLTEXT = 'Material Type' .
WA_FCAT1-OUTPUTLEN = 15 .
APPEND WA_FCAT1 TO FCAT1 .
CLEAR WA_FCAT1 .
WA_FCAT1-TABNAME = 'IT_ITAB1' .
WA_FCAT1-FIELDNAME = 'MATKL' .
WA_FCAT1-COLTEXT = 'Material Group' .
WA_FCAT1-OUTPUTLEN = 15 .
APPEND WA_FCAT1 TO FCAT1 .
CLEAR WA_FCAT1 .
WA_FCAT1-TABNAME = 'IT_ITAB1' .
WA_FCAT1-FIELDNAME = 'MAKTX' .
WA_FCAT1-COLTEXT = 'Description' .
WA_FCAT1-OUTPUTLEN = 25 .
APPEND WA_FCAT1 TO FCAT1 .
CLEAR WA_FCAT1 .
SELECT AMATNR AMTART AMATKL BMAKTX INTO TABLE IT_ITAB1 FROM MARA AS A INNER JOIN MAKT AS B ON AMATNR = BMATNR .
DESCRIBE TABLE IT_ITAB1 LINES LEN .
LEN = LEN .
*IT_ITAB1-COL = 'C601' .
MODIFY IT_ITAB1 INDEX LEN FROM IT_ITAB1
TRANSPORTING COL .
CALL SCREEN 100 .
&----
*& Module SHOWALV OUTPUT
&----
text
----
module SHOWALV output.
CREATE OBJECT cont1
EXPORTING
PARENT =
container_name = 'CUSTOM'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid1
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = CONT1
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
it_outtab = IT_ITAB1[]
IT_FIELDCATALOG = FCAT1
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endmodule. " SHOWALV OUTPUT
Thanks & Regards
Ashu Singh
2008 Jul 31 9:13 AM
yaa we can do it....
put a condition for that on the dates..
if the condition is set fill
it_fieldcat-emphasize = 'C111'.
it_fieldcat-fieldname = 'FIELD'.
it_fieldcat-reptext_ddic = 'description'.
if date1 = 'value'.
it_fieldcat-emphasize = 'C111'.
endif .
append it_fieldcat .
2008 Jul 31 9:18 AM
Hi,
Just go through following code ....the code is for coloring particular cell ....u can put condition where the data is changing ...
REPORT ZASHU_ALV_CELL_COLOR.
TABLES: MARA , MAKT .
DATA: LAYOUT TYPE LVC_S_LAYO .
DATA: CONT1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER .
DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID .
DATA: FCAT1 TYPE LVC_T_FCAT .
DATA: WA_FCAT1 LIKE LINE OF FCAT1 .
TYPES: BEGIN OF TYPE_ITAB1 ,
MATNR LIKE MARA-MATNR ,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL ,
MAKTX LIKE MAKT-MAKTX ,
COL TYPE lvc_t_scol,
END OF TYPE_ITAB1 .
DATA: IT_ITAB1 TYPE STANDARD TABLE OF TYPE_ITAB1 WITH HEADER LINE .
DATA: LEN TYPE I.
LAYOUT-INFO_FNAME = 'COL' .
break devuser .
WA_FCAT1-TABNAME = 'IT_ITAB1' .
WA_FCAT1-FIELDNAME = 'MATNR' .
WA_FCAT1-COLTEXT = 'Material' .
WA_FCAT1-OUTPUTLEN = 18 .
APPEND WA_FCAT1 TO FCAT1 .
CLEAR WA_FCAT1 .
WA_FCAT1-TABNAME = 'IT_ITAB1' .
WA_FCAT1-FIELDNAME = 'MTART' .
WA_FCAT1-COLTEXT = 'Material Type' .
WA_FCAT1-OUTPUTLEN = 15 .
APPEND WA_FCAT1 TO FCAT1 .
CLEAR WA_FCAT1 .
WA_FCAT1-TABNAME = 'IT_ITAB1' .
WA_FCAT1-FIELDNAME = 'MATKL' .
WA_FCAT1-COLTEXT = 'Material Group' .
WA_FCAT1-OUTPUTLEN = 15 .
APPEND WA_FCAT1 TO FCAT1 .
CLEAR WA_FCAT1 .
WA_FCAT1-TABNAME = 'IT_ITAB1' .
WA_FCAT1-FIELDNAME = 'MAKTX' .
WA_FCAT1-COLTEXT = 'Description' .
WA_FCAT1-OUTPUTLEN = 25 .
APPEND WA_FCAT1 TO FCAT1 .
CLEAR WA_FCAT1 .
SELECT AMATNR AMTART AMATKL BMAKTX INTO TABLE IT_ITAB1 FROM MARA AS A INNER JOIN MAKT AS B ON AMATNR = BMATNR .
DESCRIBE TABLE IT_ITAB1 LINES LEN .
LEN = LEN .
*IT_ITAB1-COL = 'C601' .
MODIFY IT_ITAB1 INDEX LEN FROM IT_ITAB1
TRANSPORTING COL .
CALL SCREEN 100 .
&----
*& Module SHOWALV OUTPUT
&----
text
----
module SHOWALV output.
CREATE OBJECT cont1
EXPORTING
PARENT =
container_name = 'CUSTOM'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT grid1
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = CONT1
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
IR_SALV_ADAPTER =
CHANGING
it_outtab = IT_ITAB1[]
IT_FIELDCATALOG = FCAT1
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endmodule. " SHOWALV OUTPUT
Thanks & Regards
Ashu Singh
2008 Jul 31 9:26 AM
Hi,
Try like this:
CLEAR FS_FIELDCAT .
FS_FIELDCAT-FIELDNAME = 'DISTANCE'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 3.
FS_FIELDCAT-KEY = ' '.
FS_FIELDCAT-EDIT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
LOOP AT T_SPFLI WHERE DISTANCE GT 600.
W_FIELDNAME = 'DISTANCE'.
FS_CELL-FIELDNAME = W_FIELDNAME .
FS_CELL-COLOR-COL = 5.
FS_CELL-NOKEYCOL = 'X'.
APPEND FS_CELL TO T_SPFLI-CELL.
MODIFY T_SPFLI TRANSPORTING CELL.
ENDLOOP.
In the above, the contents of the field u2018DISTANCEu2019 are colored depending on a condition (i.e., values greater than 600).
Regards,
Bhaskar
2008 Jul 31 9:31 AM
Hello,
You can use the EMPHASIZE field in the field cataloge. Give a value for this and append to the field catalog along with other properties.
Best Regards,
Sasidhar Reddy Matli.
2008 Jul 31 9:32 AM
hi,
Refer to the link.
http://www.sapdev.co.uk/sap-reporting/sap-alv/alvgrid_cellcolor.htm
Regards
Sumit Agarwal
2008 Jul 31 9:36 AM
Follow the simple sample code.
For conditonal coloring you have to use the color field in your Table. and populate the values dynamically using the conditon.
and mention that in the layout.
layout-coltab_fieldname = 'COLOR'.
REPORT ztest_alv_color.
TYPE-POOLS: slis.
DATA: BEGIN OF it_flight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
color TYPE lvc_t_scol,
END OF it_flight.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
layout TYPE slis_layout_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_FLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
UP TO 20 ROWS.
DATA: col TYPE lvc_s_scol,
coltab TYPE lvc_t_scol,
color TYPE lvc_s_colo.
color-col = '6'.
color-int = '0'.
color-inv = '0'.
LOOP AT it_flight.
IF it_flight-seatsocc NE it_flight-seatsmax.
col-fname = 'SEATSOCC'.
col-color = color.
APPEND col TO coltab.
CLEAR col.
it_flight-color = coltab.
ENDIF.
MODIFY it_flight.
ENDLOOP.
layout-coltab_fieldname = 'COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1.
2008 Jul 31 9:36 AM
Hi,
plz try this piece of code ;
TABLES:
SPFLI.
TYPE-POOLS:
SLIS.
PARAMETERS:
P_COL TYPE I ,
P_ROW TYPE I,
P_COLOR(4) TYPE C .
DATA:
T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FS_FIELDCAT LIKE LINE OF T_FIELDCAT,
FS_LAYOUT TYPE SLIS_LAYOUT_ALV ,
W_COLOR(4) ,
W_ROW TYPE I,
W_FIELDNAME(20),
W_PROG TYPE SY-REPID.
DATA:
BEGIN OF T_SPFLI OCCURS 0,
COLOR(4),
CHECKBOX ,
CELL TYPE SLIS_T_SPECIALCOL_ALV,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
CITYFROM TYPE SPFLI-CITYFROM,
CITYTO TYPE SPFLI-CITYTO,
DISTANCE TYPE SPFLI-DISTANCE,
END OF T_SPFLI.
DATA:
FS_CELL LIKE LINE OF T_SPFLI-CELL.
SELECT *
FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.
W_COLOR = P_COLOR.
T_SPFLI-COLOR = P_COLOR.
IF P_COL IS INITIAL AND P_ROW GT 0.
MODIFY T_SPFLI INDEX P_ROW TRANSPORTING COLOR.
ENDIF.
FS_FIELDCAT-FIELDNAME = 'CARRID'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 1.
FS_FIELDCAT-KEY = 'X'.
FS_FIELDCAT-HOTSPOT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT .
FS_FIELDCAT-FIELDNAME = 'CONNID'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 2.
FS_FIELDCAT-KEY = 'X'.
FS_FIELDCAT-HOTSPOT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT .
FS_FIELDCAT-FIELDNAME = 'DISTANCE'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 3.
FS_FIELDCAT-KEY = ' '.
FS_FIELDCAT-EDIT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT.
FS_FIELDCAT-FIELDNAME = 'CITYFROM'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 4.
FS_FIELDCAT-KEY = ' '.
APPEND FS_FIELDCAT TO T_FIELDCAT.
LOOP AT T_FIELDCAT INTO FS_FIELDCAT.
IF FS_FIELDCAT-COL_POS EQ P_COL.
FS_FIELDCAT-EMPHASIZE = P_COLOR.
W_FIELDNAME = FS_FIELDCAT-FIELDNAME.
IF P_ROW IS INITIAL AND P_COL GT 0.
MODIFY T_FIELDCAT FROM FS_FIELDCAT TRANSPORTING EMPHASIZE.
ENDIF.
ENDIF.
ENDLOOP.
FS_CELL-FIELDNAME = W_FIELDNAME .
FS_CELL-COLOR-COL = 6.
FS_CELL-NOKEYCOL = 'X'.
APPEND FS_CELL TO T_SPFLI-CELL.
IF P_ROW IS NOT INITIAL AND P_COL IS NOT INITIAL.
MODIFY T_SPFLI INDEX P_ROW TRANSPORTING CELL.
ENDIF.
FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.
FS_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
FS_LAYOUT-COLTAB_FIELDNAME = 'CELL'.
FS_LAYOUT-F2CODE = '&ETA'.
W_PROG = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROG
IS_LAYOUT = FS_LAYOUT
IT_FIELDCAT = T_FIELDCAT
TABLES
T_OUTTAB = T_SPFLI
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
this will surely help.
thanx,
dhanashri.
2008 Jul 31 9:40 AM
Hi,
Please refer to the following code.
regards,
Mayukh
Demo program to color particular row or column or cell of an ALV list using 'REUSE_ALV_LIST_DISPLAY'
REPORT ZALV_LIST1.
TABLES:
SPFLI.
TYPE-POOLS:
SLIS.
PARAMETERS:
P_COL TYPE I ,
P_ROW TYPE I,
P_COLOR(4) TYPE C .
DATA:
T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FS_FIELDCAT LIKE LINE OF T_FIELDCAT,
FS_LAYOUT TYPE SLIS_LAYOUT_ALV ,
W_COLOR(4) ,
W_ROW TYPE I,
W_FIELDNAME(20),
W_PROG TYPE SY-REPID.
DATA:
BEGIN OF T_SPFLI OCCURS 0,
COLOR(4),
CHECKBOX ,
CELL TYPE SLIS_T_SPECIALCOL_ALV,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
CITYFROM TYPE SPFLI-CITYFROM,
CITYTO TYPE SPFLI-CITYTO,
DISTANCE TYPE SPFLI-DISTANCE,
END OF T_SPFLI.
DATA:
FS_CELL LIKE LINE OF T_SPFLI-CELL.
SELECT *
FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE T_SPFLI.
W_COLOR = P_COLOR.
T_SPFLI-COLOR = P_COLOR.
IF P_COL IS INITIAL AND P_ROW GT 0.
MODIFY T_SPFLI INDEX P_ROW TRANSPORTING COLOR.
ENDIF.
FS_FIELDCAT-FIELDNAME = 'CARRID'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 1.
FS_FIELDCAT-KEY = 'X'.
FS_FIELDCAT-HOTSPOT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT .
FS_FIELDCAT-FIELDNAME = 'CONNID'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 2.
FS_FIELDCAT-KEY = 'X'.
FS_FIELDCAT-HOTSPOT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT .
FS_FIELDCAT-FIELDNAME = 'DISTANCE'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 3.
FS_FIELDCAT-KEY = ' '.
FS_FIELDCAT-EDIT = 'X'.
APPEND FS_FIELDCAT TO T_FIELDCAT.
CLEAR FS_FIELDCAT.
FS_FIELDCAT-FIELDNAME = 'CITYFROM'.
FS_FIELDCAT-REF_TABNAME = 'SPFLI'.
FS_FIELDCAT-COL_POS = 4.
FS_FIELDCAT-KEY = ' '.
APPEND FS_FIELDCAT TO T_FIELDCAT.
LOOP AT T_FIELDCAT INTO FS_FIELDCAT.
IF FS_FIELDCAT-COL_POS EQ P_COL.
FS_FIELDCAT-EMPHASIZE = P_COLOR.
W_FIELDNAME = FS_FIELDCAT-FIELDNAME.
IF P_ROW IS INITIAL AND P_COL GT 0.
MODIFY T_FIELDCAT FROM FS_FIELDCAT TRANSPORTING EMPHASIZE.
ENDIF.
ENDIF.
ENDLOOP.
FS_CELL-FIELDNAME = W_FIELDNAME .
FS_CELL-COLOR-COL = 6.
FS_CELL-NOKEYCOL = 'X'.
APPEND FS_CELL TO T_SPFLI-CELL.
IF P_ROW IS NOT INITIAL AND P_COL IS NOT INITIAL.
MODIFY T_SPFLI INDEX P_ROW TRANSPORTING CELL.
ENDIF.
FS_LAYOUT-INFO_FIELDNAME = 'COLOR'.
FS_LAYOUT-BOX_FIELDNAME = 'CHECKBOX'.
FS_LAYOUT-COLTAB_FIELDNAME = 'CELL'.
FS_LAYOUT-F2CODE = '&ETA'.
W_PROG = SY-REPID.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROG
IS_LAYOUT = FS_LAYOUT
IT_FIELDCAT = T_FIELDCAT
TABLES
T_OUTTAB = T_SPFLI
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
NOTE
Column and Row are colored with a coded color u2018Cxyzu2019.
Where C: Color (coding must begin with C)
X: Color Number
Y: Bold
Z: Inverse.