Saturday, December 18, 2010
Set column color code to wa_fieldcat-emphasize to get column coloring.

REPORT ZTEST_NOTEPAD.
DATA: 
      BEGIN OF IT_T100 OCCURS 0,
        CHECKBOX LIKE ABGR-KZART,
        ARBGB    LIKE T100-ARBGB,
        MSGNR    LIKE T100-MSGNR,
        TEXT     LIKE T100-TEXT,
      END OF IT_T100.
DATA:PROGRAM TYPE SY-REPID VALUE SY-REPID.
TYPE-POOLS SLIS.
DATA:IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
     WA_FIELDCAT LIKE LINE OF IT_FIELDCAT.
DEFINE FIELDCATALOG.
  WA_FIELDCAT-FIELDNAME = &1.
  WA_FIELDCAT-TABNAME   = 'IT_T100'.
  WA_FIELDCAT-SELTEXT_M = &2.
  WA_FIELDCAT-EMPHASIZE = &3.  "highlight columns in color
  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR  WA_FIELDCAT.
END-OF-DEFINITION.

START-OF-SELECTION.
  SELECT * FROM T100 INTO TABLE IT_T100 UP TO 100 ROWS.

  FIELDCATALOG: 'CHECKBOX' 'CHECKBOX' 'C210',
  'ARBGB'    'ARBGB'    'C310',
  'MSGNR'    'MSGNR'    'C410',
  'TEXT'     'TEXT'     'C510'.
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = PROGRAM
      IT_FIELDCAT        = IT_FIELDCAT
    TABLES
      T_OUTTAB           = IT_T100.

  ->EMPHASIZE = 'Cxyz'.
  ->(X:'1'-'9'; Y,Z: '0'=OFF '1'=ON)
  ->'X' = COLUMN IS COLORED WITH THE DEFAULT COLUMN HIGHLIGHT COLOR.
  ->'Cxyz' = COLUMN IS COLORED WITH A CODED COLOR:
  ->C: COLOR (CODING MUST BEGIN WITH C)
  ->X: COLOR NUMBER
  ->Y: BOLD
  ->Z: INVERSE

1 comment:

  1. Hi, Excellent tutorials. Any thing on OOPS ALV will be very much appreciated.

    ReplyDelete

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.