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 - add colour to columns, sorting columns

Former Member
0 Kudos

Hi Experts,

Using ALV oops......I am using field catalog merge FM.

After using that how do I use color & sort options.

How to add colors to columns

How to sort columns

Thanks in advance.

Edited by moderator to more meaningful title

6 REPLIES 6

uwe_schieferstein
Active Contributor
0 Kudos

Hello

You can use field LVC_S_FCAT-EMPHASIZE (in the fieldcatalog) to colour your columns.

If you want to sort your column before the first display you can use parameter IT_SORT (LVC_T_SORT) of method SET_TABLE_FOR_FIRST_DISPLAY (cl_gui_alv_grid).

Further reading: [An Easy Reference For ALV Grid Control|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]

Regards

Uwe

Former Member
0 Kudos

hi,

For colouring of coloumns, Append the field catlog like this.

wa_fieldcat-row_pos = 1.

wa_fieldcat-col_pos = 2.

wa_fieldcat-emphasize = 'C710'. * Green colour

append wa_fieldcat.

Former Member
0 Kudos

I cannot use that , because as I said I am using following FM to prepare field catalog.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

i_structure_name = 'ZSHHR207'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME =

CHANGING

ct_fieldcat = it_fdcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

How do I use color and sort options ?

0 Kudos

Hello Ravindar

Of course you can use the colouring options:


CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
  * I_BUFFER_ACTIVE =
    i_structure_name = 'ZSHHR207'
    * I_CLIENT_NEVER_DISPLAY = 'X'
    * I_BYPASSING_BUFFER =
    * I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = it_fdcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.

DATA: ls_fcat     TYPE lvc_s_fcat.

  LOOP AT it_fdcat INTO ls_fcat.
    CASE ls_fcat-fieldname.
      WHEN '...'.
         ls_fcat-emphasize = 'C410'.

      WHEN '...'.
         ls_fcat-emphasize = 'C600'.

      WHEN OTHERS.
         CONTINUE.
      ENDCASE.

    MODIFY it_fdcat FROM ls_fcat INDEX syst-tabix.
  ENDLOOP.

Regards

Uwe

Former Member
0 Kudos

Hi ravinder,

use this link.

Regards.

Punit

Former Member
0 Kudos

Answered