2008 Jul 22 7:14 AM
hiu all,
i want the row color in alv report means color the moment types .
how tcan this possible in alv
regards,
sarang
2008 Jul 22 7:16 AM
Hi,
Go through the following links for better understanding:
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
Regards,
Shailaja
Use the Following code
REPORT ztest_alv_color.
TYPE-POOLS: slis.
DATA: BEGIN OF it_flight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
color TYPE lvc_t_scol,
END OF it_flight.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
layout TYPE slis_layout_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_FLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
UP TO 20 ROWS.
DATA: col TYPE lvc_s_scol,
coltab TYPE lvc_t_scol,
color TYPE lvc_s_colo.
color-col = '6'.
color-int = '0'.
color-inv = '0'.
LOOP AT it_flight.
IF it_flight-seatsocc NE it_flight-seatsmax.
col-fname = 'SEATSOCC'.
col-color = color.
APPEND col TO coltab.
CLEAR col.
it_flight-color = coltab.
ENDIF.
MODIFY it_flight.
ENDLOOP.
layout-coltab_fieldname = 'COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1.
2008 Jul 22 7:16 AM
Hi,
Go through the following links for better understanding:
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
Regards,
Shailaja
2008 Jul 22 7:40 AM
2008 Jul 22 7:18 AM
Hi,
Define one field type character in ur finla internal table and then pass color code to that field and modify internal table
st_final-color = 'C311'(027).
MODIFY it_final FROM st_final INDEX l_index TRANSPORTING color.
refer below code
st_sort-fieldname = 'LIFNR'.
st_sort-spos = 1.
st_sort-up = c_chk.
st_sort-subtot = c_chk.
APPEND st_sort TO it_sort.
CLEAR : st_sort.
IF NOT it_final[] IS INITIAL.
g_repid = sy-repid.
st_layout-colwidth_optimize = c_chk.
st_layout-info_fieldname = 'COLOR'.
*--Call the function module to display the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = st_layout
it_fieldcat = it_fieldcat[]
i_callback_user_command = 'USER_COMMAND'
i_default = c_chk
i_save = c_save
it_events = it_events
it_sort = it_sort
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Prashant
2008 Jul 22 7:19 AM
Hi,
Check this links:
http://www.sapdev.co.uk/reporting/alv/alvgrid.htm
Please search SDN forum.
Regards
Adil
2008 Jul 22 7:21 AM
hi
good
use this code in your report ,
PERFORM alv_color USING '' col_key 0 0 CHANGING <tabline>-color.
&----
*& Form alv_color
&----
set field color - last wins
----
FORM alv_color USING pv_fieldname TYPE fieldname
pv_color TYPE c
pv_intensify TYPE i
pv_inverse TYPE i
CHANGING pt_colors TYPE slis_t_specialcol_alv."#EC CALLED
FIELD-SYMBOLS:
<color> TYPE LINE OF slis_t_specialcol_alv.
DATA:
ls_colors TYPE LINE OF slis_t_specialcol_alv.
READ TABLE pt_colors ASSIGNING <color> WITH KEY
fieldname = pv_fieldname
BINARY SEARCH.
IF sy-subrc = 0.
<color>-color-col = pv_color.
<color>-color-int = pv_intensify.
<color>-color-inv = pv_inverse.
ELSE.
ls_colors-fieldname = pv_fieldname.
ls_colors-color-col = pv_color.
ls_colors-color-int = pv_intensify.
ls_colors-color-inv = pv_inverse.
INSERT ls_colors INTO pt_colors INDEX sy-tabix.
ENDIF." sy-subrc = 0.
ENDFORM. "alv_color
Thanks
mrutyun^
2008 Jul 22 7:24 AM
hi....
you can use the empahasise functionality...
for specific colours there are specific colour codes......
you can use thses codes and add colour to the row.
i_fieldcat-fieldname = 'BALANCE3'.
i_fieldcat-tabname = 'TTAB'.
i_fieldcat-seltext_l = 'BAL3'.
i_fieldcat-ref_fieldname = 'BALANCE3'.
i_fieldcat-ref_tabname = 'ZREVPR_PCO'.
i_fieldcat-do_sum = 'X'.
i_fieldcat-seltext_m = 'BALANCE3'.
i_fieldcat-seltext_s = 'BALANCE3'.
i_fieldcat-ddictxt = 'L'.
i_fieldcat-emphasize = 'C600'.
APPEND i_fieldcat.
CLEAR i_fieldcat.
i
2008 Jul 22 7:29 AM
Hi Sarang,
Check following examples......
http://saptechnical.com/Tutorials/ALV/ColorOnCondition/Program.htm
2008 Jul 22 7:29 AM
Use the Following code
REPORT ztest_alv_color.
TYPE-POOLS: slis.
DATA: BEGIN OF it_flight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
color TYPE lvc_t_scol,
END OF it_flight.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
layout TYPE slis_layout_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'IT_FLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = it_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_flight
UP TO 20 ROWS.
DATA: col TYPE lvc_s_scol,
coltab TYPE lvc_t_scol,
color TYPE lvc_s_colo.
color-col = '6'.
color-int = '0'.
color-inv = '0'.
LOOP AT it_flight.
IF it_flight-seatsocc NE it_flight-seatsmax.
col-fname = 'SEATSOCC'.
col-color = color.
APPEND col TO coltab.
CLEAR col.
it_flight-color = coltab.
ENDIF.
MODIFY it_flight.
ENDLOOP.
layout-coltab_fieldname = 'COLOR'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = layout
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_flight
EXCEPTIONS
program_error = 1.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |