Application Development and Automation 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: 
Read only

problem with coloring alv rows

Former Member
0 Likes
506

Who can help with this report.I want to color the rows.I just can not make it.

REPORT ZCOLORTEST.

data: grid type ref to cl_gui_alv_grid,

container type ref to cl_gui_custom_container,

gs_layout type lvc_s_layo,

gt_fcat type lvc_t_fcat,

ok_code type sy-ucomm.

data:begin of tab_sflight occurs 0.

include structure sflight.

data:linecolor(4) type c.

data:end of tab_sflight.

call screen 100.

module status_0100 output.

select * from sflight into corresponding fields of table tab_sflight.

perform fillcolor.

set pf-status 'STATUS1'.

if container is initial.

create object container

exporting

container_name = 'CONTAINER'.

create object grid

exporting

i_parent = container.

perform prepare_field_catalog changing gt_fcat.

gs_layout-info_fname = 'linecolor'.

call method grid->set_table_for_first_display

exporting

is_layout = gs_layout

changing

it_outtab = tab_sflight[]

it_fieldcatalog = gt_fcat.

endif.

endmodule.

module user_command_0100 input.

case sy-ucomm.

when 'EXIT'.

leave program.

endcase.

endmodule.

form fillcolor.

loop at tab_sflight.

tab_sflight-linecolor = 'C300'.

modify tab_sflight.

endloop.

endform.

form prepare_field_catalog changing pt_fieldcat type lvc_t_fcat.

data ls_fcat type lvc_s_fcat.

call function 'LVC_FIELDCATALOG_MERGE'

exporting

i_structure_name = 'SFLIGHT'

changing

ct_fieldcat = pt_fieldcat[].

ls_fcat-fieldname = 'linecolor'.

append ls_fcat to pt_fieldcat.

endform.

Edited by: Alex Zhang on Aug 22, 2008 3:52 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
469

help

help

2 REPLIES 2
Read only

Former Member
0 Likes
470

help

Read only

0 Likes
469

"Make this line change , it shoulbe in caps.
gs_layout-info_fname = 'LINECOLOR'.

form prepare_field_catalog changing pt_fieldcat type lvc_t_fcat.
data ls_fcat type lvc_s_fcat.

call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SFLIGHT'
changing
ct_fieldcat = pt_fieldcat[].
"this is not required you can delete this code
*ls_fcat-fieldname = 'linecolor'.
*append ls_fcat to pt_fieldcat.
endform.