Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV underlining a column and coloring font in a column

Former Member
0 Kudos

Hello Friends,

I have 2 questions

1) How do I underline a column in ALV? I am using ALV objects.

2) How do I color the font (just the font, not cell) in a column in ALV report?

Thank you,

Chandra

4 REPLIES 4

former_member188685
Active Contributor
0 Kudos

Hi Chandra,

for that

In ALv two steps You need to Do.

1.You Should populate the events table

with END_OF_LIST.

X_EVENTS-NAME = SLIS_EV_END_OF_LIST.

X_EVENTS-FORM = 'MODIFY_LIST'.

APPEND X_EVENTS TO IT_EVENTS.

CLEAR X_EVENTS.

2. create a form with that Name

*&---------------------------------------------------------------------*
*&      Form  MODIFY_LIST
*&---------------------------------------------------------------------*
*      Modify the Report
*----------------------------------------------------------------------*
FORM MODIFY_LIST.
  DATA: L_LINES TYPE I,
        L_FLAG.
  CLEAR IT_NODATA. REFRESH IT_NODATA.
  LOOP AT IT_FINAL WHERE FLAG = 'X'.
    IT_NODATA-IND = SY-TABIX + 6.
    APPEND IT_NODATA.
    CLEAR IT_NODATA.
  ENDLOOP.
  DESCRIBE TABLE IT_FINAL LINES L_LINES.
  L_LINES  = L_LINES + 6.
  DO L_LINES TIMES.
    READ TABLE IT_NODATA WITH KEY IND = SY-INDEX.
    IF SY-SUBRC = 0.
      READ LINE SY-INDEX INDEX SY-LSIND.
      IF SY-SUBRC = 0.
        MODIFY LINE SY-INDEX INDEX SY-LSIND
                   FIELD FORMAT  IT_FINAL-MATNR COLOR 6
                                 IT_FINAL-POSNR COLOR 6.
                                 IT_FINAL-VBELN 

      ENDIF.
    ENDIF.
  ENDDO.
ENDFORM.
                    "MODIFY_LIST

I don't know about Underline.

Regards

vijay

former_member188685
Active Contributor
0 Kudos

Hi,

Regarding Undeline can you explain what is the requiremnets.

regards

vijay

0 Kudos

For that column, do something like this in the field catalog. Pay attention to the 4th char in the code. This is what makes the color of the font and not the cell.

  clear wa_fieldcat.
  move w_position to wa_fieldcat-col_pos.
  move 'MATKL'    to wa_fieldcat-fieldname.
  move 'MARA'     to wa_fieldcat-ref_table.
  move 'MATKL'    to wa_fieldcat-ref_field.
* Color column
    move 'C6<b>01</b>'     to wa_fieldcat-emphasize.
  append wa_fieldcat to it_fieldcat.

*****************************************************************
* Colour code :                                                 *
* Colour is a 4-char field where :                              *
*              - 1st char = C (color property)                  *
*              - 2nd char = color code (from 0 to 7)            *
*                                  0 = background color         *
*                                  1 = blue                     *
*                                  2 = gray                     *
*                                  3 = yellow                   *
*                                  4 = blue/gray                *
*                                  5 = green                    *
*                                  6 = red                      *
*                                  7 = orange                   *
*              - 3rd char = intensified (0=off, 1=on)           *
*              - 4th char = inverse display (0=off, 1=on)       *
*                                                               *
* Colour overwriting priority :                                 *
*   1. Line                                                     *
*   2. Cell                                                     *
*   3. Column                                                   *
*****************************************************************


REgards,

Rich HEilman

former_member188685
Active Contributor
0 Kudos

Hi If you are looking for Fonts color then

Modify the List in END-of-LIST.

That is the solution for Normal list.

Regards

vijay