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

traffic light

Former Member
0 Likes
738

Hi guys

I have an internal table with field text

whick wil contain values ok and not ok

i want to dispaly output using traffic signal

if it s ok i have to dispaly light as green and for not ok

have to display as red..

can u help me guys?

senthil

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
609

INCLUDE <ICON>.

field-symbols: <I>.

data: result(2).

assign ICON_GREEN_LIGHT to <I>.

if result = 'OK'.

assign ICON_GREEN_LIGHT to <I>.

else.

assign ICON_RED_LIGHT to <I>.

endif.

write: <I> as icon.

Hi guys

I have an internal table with field text

whick wil contain values ok and not ok

i want to dispaly output using traffic signal

if it s ok i have to dispaly light as green and for not ok

have to display as red..

can u help me guys?

senthil

3 REPLIES 3
Read only

RaymondGiuseppi
Active Contributor
0 Likes
609

You have to add a column in your internal table defined for traffic light

This field is of type Char 1, and can contain the following values:

  • 1 Red

  • 2 Yellow

  • 3 Green

<b>OO-ALV</b>

The name of the traffic light field is supplied in the <b>layout-excp_fname</b> used by <b>method set_table_for_first_display.</b>

<b>Reuse ALV</b>

The name of the trafic lights should be filled in field<b> lights_fieldname</b> of <b>is_layou</b>t parameter

Regards

Read only

Former Member
0 Likes
610

INCLUDE <ICON>.

field-symbols: <I>.

data: result(2).

assign ICON_GREEN_LIGHT to <I>.

if result = 'OK'.

assign ICON_GREEN_LIGHT to <I>.

else.

assign ICON_RED_LIGHT to <I>.

endif.

write: <I> as icon.

Read only

Former Member
0 Likes
609

Hi senthil,

1. Its simple

2. We have to use the layout of alv also.

and one extra field in the internal table.

3. Just copy paste in new program.

REPORT abc.

TYPE-POOLS : slis.

DATA : alvly TYPE slis_layout_alv.

DATA : alvfc TYPE slis_t_fieldcat_alv.

DATA : BEGIN OF itab OCCURS 0,

lt TYPE i,

matnr LIKE mara-matnr,

END OF itab.

END-OF-SELECTION.

itab-lt = 1.

APPEND itab.

itab-lt = 2.

APPEND itab.

itab-lt = 3.

APPEND itab.

itab-lt = 1.

APPEND itab.

itab-lt = 3.

APPEND itab.

itab-lt = 3.

APPEND itab.

itab-lt = 3.

APPEND itab.

*----


alvly-lights_fieldname = 'LT'.

alvly-lights_tabname = 'ITAB'.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_inclname = sy-repid

CHANGING

ct_fieldcat = alvfc.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = alvfc

is_layout = alvly

i_save = 'A'

TABLES

t_outtab = itab.

regards,

amit m.