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: 

OO ALV key fields not colored, why

Former Member
0 Kudos

Hello all,

I have 3 key fields that are not highlighted. They are locked in place when scrolling occurs, so they are recognized as key fields. I thought that key fields were highlighted by default. Can anyone see why the following portion of code doesn't produce highlighted key fields/

Thanks

Bruce

call function 'LVC_FIELDCATALOG_MERGE'

exporting

i_bypassing_buffer = 'X'

i_structure_name = 'ZALV_ZFAPO039'

changing

ct_fieldcat = pt_fieldcat.

*******************************************

loop at pt_fieldcat into ls_fcat.

*

if ls_fcat-fieldname = 'LIFNR' or

ls_fcat-fieldname = 'PAYEE' or

ls_fcat-fieldname = 'WRBTR'.

ls_fcat-key = 'X'. " set ALV key field

ls_fcat-emphasize = 'X'. " highlight column

endif.

modify pt_fieldcat from ls_fcat.

*

Endloop.

********************************************

  • Set layout options:

ps_layout-zebra = 'X'.

*

call method g_grid->set_table_for_first_display

exporting

i_bypassing_buffer = 'X'

is_layout = ps_layout

it_toolbar_excluding = lt_exclude

changing

it_fieldcatalog = pt_fieldcat

it_outtab = pt_outtab.

*********************************************

  • set editable cells to ready for input

call method g_grid->set_ready_for_input

exporting

i_ready_for_input = 1.

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Bruce

The following line of coding is not required (indeed, it is not correct):


ls_fcat-emphasize = 'X'. " highlight column

Simply drop this line an the key columns should have the right colour.

Note: field EMPHASIZE takes the following values:

- 1 digit = 'C'

- 2 digit = 1-7 (color)

- 3 digit = 0 or 1 (1 = emphasize)

Example: 'C510' = green, intensified

Regards

Uwe

2 REPLIES 2

uwe_schieferstein
Active Contributor
0 Kudos

Hello Bruce

The following line of coding is not required (indeed, it is not correct):


ls_fcat-emphasize = 'X'. " highlight column

Simply drop this line an the key columns should have the right colour.

Note: field EMPHASIZE takes the following values:

- 1 digit = 'C'

- 2 digit = 1-7 (color)

- 3 digit = 0 or 1 (1 = emphasize)

Example: 'C510' = green, intensified

Regards

Uwe

Former Member
0 Kudos

Uwe,

This code would not color the fields, but locked the fields in place.

ls_fcat-key = 'X'. " set ALV key field

  • ls_fcat-emphasize = 'C410'.

This code colored the fields, but the field are not locked.

  • ls_fcat-key = 'X'.

ls_fcat-emphasize = 'C410'. " highlight column

Thanks for your answer. I have no explanation for why populating KEY with isn't coloring the colimns.

Bruce