03-26-2008 5:46 AM
Hi all,
I am using Trafiic Lights in my ALV to display the status, but the Header part is displaying as "Exception".
How can i change my col header corresponding to the Trafiic Lights.
Can any body halp me to change.
Regards,
Srinivas
03-26-2008 6:36 AM
Hi srini,
In traffic light colums in ALV, you would have filled the field catalog.In field catatalog, corresponding to the entry for traffic lights add the sel_text in fied catalog
Thanks arjun
04-17-2008 5:17 PM
Hi,
please refer the standard program for traffice lights
BCALV_GRID_04
Reward points if usefull
Regards
Fareedas
04-18-2008 4:40 AM
Hi Srinivas Rao,
If u have posted ur code, I would have tried what to do, not to get text for trafic lights field. But I have sample program, It is showing traffice lights column heading.
Just execute this program.
I hope that it solves ur problem.
Regards,
Venkat.O
REPORT zvenkat_alv_traffic_lights .
*&---------------------------------------------------------
"Includes
*&---------------------------------------------------------
INCLUDE <icon>.
INCLUDE <symbol>.
*&---------------------------------------------------------
*& Declaration part
*&---------------------------------------------------------
"Types
TYPES:
BEGIN OF t_lights,
matnr TYPE mard-matnr,
werks TYPE mard-werks,
lgort TYPE mard-lgort,
lights TYPE char4, "Variable is needs to be declared with length 4 char
END OF t_lights.
"Work Areas
DATA:
w_lights TYPE t_lights.
"Internal tables
DATA:
i_lights TYPE STANDARD TABLE OF t_lights.
*&---------------------------------------------------------------------*
* ALV Declarations
*----------------------------------------------------------------------*
* Types Pools
TYPE-POOLS:
slis.
* Types
TYPES:
t_fieldcat TYPE slis_fieldcat_alv,
t_events TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
* Workareas
DATA:
w_fieldcat TYPE t_fieldcat,
w_events TYPE t_events,
w_layout TYPE t_layout.
* Internal Tables
DATA:
i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
i_events TYPE STANDARD TABLE OF t_events.
*&---------------------------------------------------------------------*
*& start of selection
*&---------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM get_data.
*&---------------------------------------------------------------------*
*& end-of-selection.
*&---------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM build_fieldcatlog.
PERFORM build_layout.
PERFORM list_display.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
FORM get_data .
SELECT matnr
werks
lgort
FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_lights
UP TO 10 ROWS.
IF i_lights[] IS INITIAL.
"Dummy data
DO 10 TIMES.
w_lights-matnr = sy-index.
w_lights-werks = sy-index + 1.
w_lights-lgort = sy-index + 2.
APPEND w_lights TO i_lights.
CLEAR w_lights.
ENDDO.
ENDIF.
"Just pass 1=red or 2=yellow or 3=green to lights fields
LOOP AT i_lights INTO w_lights .
IF sy-tabix BETWEEN 1 AND 3.
w_lights-lights = '1'.
ELSEIF sy-tabix BETWEEN 4 AND 7.
w_lights-lights = '2'.
ELSEIF sy-tabix BETWEEN 8 AND 10.
w_lights-lights = '3'.
ENDIF.
MODIFY i_lights FROM w_lights INDEX sy-tabix TRANSPORTING lights.
ENDLOOP.
ENDFORM. " get_data
*&---------------------------------------------------------------------*
*& Form build_fieldcatlog
*&---------------------------------------------------------------------*
FORM build_fieldcatlog .
CLEAR:w_fieldcat,i_fieldcat[].
w_fieldcat-fieldname = 'MATNR'.
w_fieldcat-seltext_m = 'MATNR'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'WERKS'.
w_fieldcat-seltext_m = 'WERKS'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'LGORT'.
w_fieldcat-seltext_m = 'LGORT'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM. " build_fieldcatlog
*&---------------------------------------------------------------------*
*& Form build_layout
*&---------------------------------------------------------------------*
FORM build_layout .
w_layout-colwidth_optimize = 'X'.
w_layout-zebra = 'X'.
w_layout-lights_fieldname = 'LIGHTS'.
w_layout-lights_tabname = 'I_LIGHTS'.
ENDFORM. " build_layout
*&---------------------------------------------------------------------*
*& Form list_display
*&---------------------------------------------------------------------*
FORM list_display .
DATA:
l_program TYPE sy-repid.
l_program = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = l_program
is_layout = w_layout
it_fieldcat = i_fieldcat
TABLES
t_outtab = i_lights
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.
ENDFORM. " list_display
04-18-2008 8:32 AM
Hi,
Try this code....
Demo program for displaying lights (Red, Yellow and Green):
TYPES: BEGIN OF ty_alv,
lights(1) TYPE c, "Exception, Holding the value of the lights
text(20) TYPE c, "some text
END OF ty_alv.DATA: gs_alv TYPE ty_alv,
gt_alv TYPE TABLE OF ty_alv,
gr_alv TYPE REF TO cl_salv_table,
gr_columns TYPE REF TO cl_salv_columns_table.START-OF-SELECTION.
gs_alv-lights = '1'. "Color red
gs_alv-text = 'RED SIGNAL'.
APPEND gs_alv TO gt_alv. gs_alv-lights = '2'. "Color yellow
gs_alv-text = 'YELLOW SIGNAL'.
APPEND gs_alv TO gt_alv. gs_alv-lights = '3'. "Color green
gs_alv-text = 'GREEN SIGNAL'.
APPEND gs_alv TO gt_alv. CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = gt_alv. gr_columns = gr_alv->get_columns( ). gr_columns->set_exception_column( value = 'LIGHTS' ). CALL METHOD gr_alv->display.
Regards,
kavitha.
11-25-2013 11:06 AM
ls_layout-lights_rollname = 'ZM_STATUS'. " Data element with description = required column heading