Traffic lights on push button

Hi all,
          In my requirement i have a field as push button , now i require to put traffic lights on this push button.I am displaying alv grid through
class cl_gui_alv_grid
please help me with a sample code.
regards,
kushagra

Hi,
Pass below codes as texts for the push buttons:
@0A@ - Red
@09@ - Orange
@08@ - Green
Below code can help you understanding handling normally without pushbuttons:
DATA: ok_code TYPE syucomm.
TYPES: BEGIN OF ty_data,
         num TYPE i,
         icon TYPE icon_d,
       END OF ty_data.
DATA: wa_data TYPE ty_data,
      i_data TYPE TABLE OF ty_data.
DATA: i_fieldcat TYPE lvc_t_fcat,
      wa_fieldcat TYPE lvc_s_fcat.
DATA: g_cust_cont   TYPE REF TO cl_gui_custom_container,
      g_container   TYPE scrfname VALUE 'GRID1',
      g_grid        TYPE REF TO cl_gui_alv_grid.
START-OF-SELECTION.
  DO 10 TIMES.
    wa_data-num = sy-index.
    IF sy-tabix < 4.
      wa_data-icon = '@0A@'.
    ELSEIF sy-tabix < 7.
      wa_data-icon = '@09@'.
    ELSE.
      wa_data-icon = '@08@'.
    ENDIF.
    APPEND wa_data TO i_data.
  ENDDO.
END-OF-SELECTION.
  CALL SCREEN 100.
*&      Module  STATUS_0100  OUTPUT
*       text
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAINTITLE'.
  IF g_grid IS INITIAL.
    PERFORM display_list.
  ENDIF.
  CALL METHOD cl_gui_cfw=>flush.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&      Module  USER_COMMAND_0100  INPUT
*       text
MODULE user_command_0100 INPUT.
  DATA: l_event TYPE REF TO cl_gui_event.
  CASE ok_code.
    WHEN 'EXIT' OR 'BACK' OR 'CANC'.
      PERFORM exit_program.
  ENDCASE.
  CLEAR: ok_code.
  CALL METHOD cl_gui_cfw=>flush.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&      Form  DISPLAY_LIST
*       text
*  -->  p1        text
*  <--  p2        text
FORM display_list .
  IF g_cust_cont IS INITIAL.
* Create Custom Container
    CREATE OBJECT g_cust_cont
           EXPORTING container_name = g_container.
* Create Ojbect for Grid Display
    CREATE OBJECT g_grid
           EXPORTING i_parent = g_cust_cont.
* Build Field Catalog
    PERFORM build_catalog.
* Display Output in Grid Form
    CALL METHOD g_grid->set_table_for_first_display
      CHANGING
        it_fieldcatalog = i_fieldcat
        it_outtab       = i_data[].
  ELSE.
* Refresh Display
    CALL METHOD g_grid->refresh_table_display.
  ENDIF.
ENDFORM.                    " DISPLAY_LIST
*&      Form  BUILD_CATALOG
*       text
*  -->  p1        text
*  <--  p2        text
FORM build_catalog .
  PERFORM build_fld_catalog USING:
     1 'NUM'   'I_DATA'   space     'Number'   10,
     2 'ICON'   'I_DATA'   'X'     'Icon'      10.
ENDFORM.                    " BUILD_CATALOG
*&      Form  BUILD_FLD_CATALOG
*       text
*      -->P_1      text
*      -->P_0182   text
*      -->P_0183   text
*      -->P_C_X  text
*      -->P_0185   text
*      -->P_12     text
FORM build_fld_catalog  USING    p_col
                                 p_fld
                                 p_tab
                                 p_icon
                                 p_text
                                 p_len.
  CLEAR: wa_fieldcat.
  wa_fieldcat-col_pos = p_col.
  wa_fieldcat-fieldname = p_fld.
  wa_fieldcat-tabname = p_tab.
  wa_fieldcat-icon = p_icon.
  wa_fieldcat-scrtext_l = p_text.
  wa_fieldcat-outputlen = p_len.
  APPEND wa_fieldcat TO i_fieldcat.
ENDFORM.                    " BUILD_FLD_CATALOG
*&      Form  EXIT_PROGRAM
*       text
*  -->  p1        text
*  <--  p2        text
FORM exit_program .
  CALL METHOD g_grid->free.
  LEAVE TO SCREEN 0.
ENDFORM.                    " EXIT_PROGRAM

Similar Messages

  • How to show traffic lights on push button in ALV Grid?

    Hi Experts,
    I have an requirement where I have to show traffic lights on push button in ALV grid of a container. I am showing access sequence for each condition type in my grid. Now, if the access sequence contains 'PLANT', it should show 'green' on push button or else it should show 'red'. How I can I achieve this?
    Thanks in advance.

    Try This One.
    DATA: gs_fieldcat TYPE slis_fieldcat_alv,
              gt_fieldcat TYPE slis_t_fieldcat_alv,
              gs_layout   TYPE  slis_layout_alv.
    TYPES :BEGIN OF gty_temp,
                col(10) TYPE c,
               END OF gty_temp.
    DATA : gt_temp TYPE STANDARD TABLE OF gty_temp,
                gs_temp TYPE gty_temp.
       gs_temp-col  ='@0A@'. "ERROR RED LIGHT
           APPEND gs_temp TO   gt_temp.
        CLEAR GS_TEMP.
    gs_temp-col  = '@08@'." SUCCESS GREEN LIGHT
    APPEND gs_temp TO   gt_temp.
    CLAER GS_TEMP.
    gs_temp-col  = '@09@'. WARNING YELLOW LIGHT
    APPEND gs_temp TO   gt_temp.
    CLAER GS_TEMP.
    gs_fieldcat-fieldname   = ' COL'.
    gs_fieldcat-tabname   =  'GT_TEMP'.
    gs_fieldcat-seltext_m = 'ERROR'."
    APPEND gs_fieldcat TO gt_fieldcat.
    CLEAR gs_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program = 'ZPROG1' " PROGRAM NAME
         i_grid_title       = 'Details'
    *   is_layout          = gs_layout
         it_fieldcat        = gt_fieldcat
       TABLES
         t_outtab           = gt_temp.
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.

  • Traffic light  repaint not working via button

    I created a traffic light, a button is pressed and the colors should cycle yellow>green>yellow>red etc.. as a normal traffic light would
    when i press the start button, the repaint(); doesnt work, system.output shows me the number which corresponds to the light changes but somehow the graphics/paint is not updated.
    what am i doing wrong?
    package test2;<br />
    <br />
    import java.awt.event.ActionEvent;<br />
    import java.awt.event.ActionListener;<br />
    import javax.swing.JButton;<br />
    import javax.swing.JOptionPane;<br />
    import javax.swing.JPanel;<br />
    <br />
    public class Traffic_Lights extends JPanel implements ActionListener {<br />
    <br />
    private Light_Controller LightController;<br />
    private JButton jStart, jStop;<br />
    <br />
    public Traffic_Lights() {<br />
    jStart = new JButton("START");<br />
    jStop = new JButton("EXIT");<br />
    <br />
    // Register Listeners with buttons<br />
    jStart.addActionListener(this);<br />
    jStop.addActionListener(this);<br />
    LightController = new Light_Controller();<br />
    this.add(jStart);<br />
    this.add(jStop);<br />
    }<br />
    // Adding the traffic light<br />
    <br />
    <br />
    /**<br />
    * This method traps the button click events<br />
    */<br />
    public void actionPerformed(ActionEvent e) {<br />
    // Rotate button is clicked<br />
    if (e.getSource() == jStart) {<br />
    // Change the color displayed<br />
    LightController.changeColor();<br />
    package test2;<br />
    import java.awt.*;<br />
    import java.awt.geom.Rectangle2D;<br />
    import javax.swing.JComponent;<br />
    import javax.swing.JPanel;<br />
    <br />
    <br />
    public class Light_Controller extends JPanel {<br />
    <br />
    private int lightState = 1;<br />
    <br />
    <br />
    public void changeColor() {<br />
    lightState++;<br />
    System.out.println(lightState);<br />
    if (lightState > 5) {<br />
    lightState = 2;<br />
    <br />
    }<br />
    <br />
    this.repaint();<br />
    <br />
    }<br />
    <br />
    /**<br />
    * This method draws the traffic light on the screen<br />
    */<br />
    public void paintComponent(Graphics g) {<br />
    super.paintComponent(g);<br />
    <br />
    Graphics2D g1 = (Graphics2D) g;<br />
    // Draws the traffic light<br />
    // Draw out white frame<br />
    g.setColor(new Color(255,255,255));<br />
    g.fillRoundRect(35,15,120,225,30,30);<br />
    <br />
    // Draw inner black frame<br />
    g.setColor(new Color(0,0,0));<br />
    g.fillRoundRect(50,30,90,195,30,30);<br />
    g.drawRoundRect(35,15,120,225,30,30);<br />
    <br />
    // RED dim<br />
    g.setColor(new Color(100,0,0));<br />
    g.fillOval(70,40,50,50);<br />
    <br />
    // YELLOW dim<br />
    g.setColor(new Color(100,100,0));<br />
    g.fillOval(70,100,50,50);<br />
    <br />
    // GREEN dim<br />
    g.setColor(new Color(0,100,0));<br />
    g.fillOval(70,160,50,50);<br />
    <br />
    // Draw traffic light stand<br />
    g.setColor(new Color(50,50,50));<br />
    g.fillRect(80,240,30,30);<br />
    <br />
    switch(lightState) {<br />
    case 1:<br />
    // red glows<br />
    g.setColor(new Color(255, 0, 0));<br />
    g.fillOval(70, 40, 50, 50);<br />
    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
    break;<br />
    <br />
    case 2:<br />
    // yellow glows<br />
    g.setColor(new Color(255, 255, 0));<br />
    g.fillOval(70, 100, 50, 50);<br />
    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
    break;<br />
    <br />
    case 3:<br />
    // green glows<br />
    g.setColor(new Color(0, 255, 0));<br />
    g.fillOval(70, 160, 50, 50);<br />
    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
    break;<br />
    <br />
    case 4:<br />
    // back to yellow glows<br />
    g.setColor(new Color(255, 255, 0));<br />
    g.fillOval(70, 100, 50, 50);<br />
    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
    break;<br />
    <br />
    case 5:<br />
    // back to red glows<br />
    g.setColor(new Color(255, 0, 0));<br />
    g.fillOval(70, 40, 50, 50);<br />
    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));<br />
    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));<br />
    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));<br />
    break;<br />
    }<br />
    }<br />
    } <br />

    Code continued...
    class Light_Controller extends JPanel {
        private int lightState = 1;
        public void changeColor() {
            lightState++;
            System.out.println(lightState);
            if (lightState > 5) {
                lightState = 2;
            this.repaint();
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g1 = (Graphics2D) g;
            g.setColor(new Color(255, 255, 255));
            g.fillRoundRect(35, 15, 120, 225, 30, 30);
            g.setColor(new Color(0, 0, 0));
            g.fillRoundRect(50, 30, 90, 195, 30, 30);
            g.drawRoundRect(35, 15, 120, 225, 30, 30);
            g.setColor(new Color(100, 0, 0));
            g.fillOval(70, 40, 50, 50);
            g.setColor(new Color(100, 100, 0));
            g.fillOval(70, 100, 50, 50);
            g.setColor(new Color(0, 100, 0));
            g.fillOval(70, 160, 50, 50);
            g.setColor(new Color(50, 50, 50));
            g.fillRect(80, 240, 30, 30);
            switch (lightState) {
                case 1:
                    g.setColor(new Color(255, 0, 0));
                    g.fillOval(70, 40, 50, 50);
                    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
                    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
                    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
                    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
                    break;
                case 2:
                    g.setColor(new Color(255, 255, 0));
                    g.fillOval(70, 100, 50, 50);
                    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
                    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
                    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
                    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
                    break;
                case 3:
                    g.setColor(new Color(0, 255, 0));
                    g.fillOval(70, 160, 50, 50);
                    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
                    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
                    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
                    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
                    break;
                case 4:
                    g.setColor(new Color(255, 255, 0));
                    g.fillOval(70, 100, 50, 50);
                    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
                    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
                    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
                    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
                    break;
                case 5:
                    g.setColor(new Color(255, 0, 0));
                    g.fillOval(70, 40, 50, 50);
                    g1.fill(new Rectangle2D.Double(440, 450, 60, 5));
                    g1.fill(new Rectangle2D.Double(350, 240, 60, 5));
                    g1.fill(new Rectangle2D.Double(345, 360, 5, 80));
                    g1.fill(new Rectangle2D.Double(500, 250, 5, 90));
                    break;
    }

  • Re: Traffic Light in Stock Overview List

    Hi All,
    I want some advice regarding the traffic light.
    How is it confiured.Please explain me,how to configure it. I want that, whenever there is shortage for the child items, the traffic light should be red.
    Please advice.
    Regards,
    Vivek

    Dear,
    Since these traffic lights are user settings
    Go to MD04 Collective access -
    Enter MRP Area / Plant
    Enter MRP Contoller /Vendor
    Collective list of materials will appear.
    At the top of the screen , Define Traffic light button will be there.When you click on that you can visit the screen for defining traffic lights
    Define traffic light depending on ranges of coverage
    Define traffic light depending on exception groups.
    You carryout the necessary settings for traffic light and save.
    Try using MD06 as well. or in MD05
    After executing the report in MRP list:mayerial list screen click on push button ---> define tarffic light
    Please refer my reply from this thread.
    [Traffic Light |Re: Traffic lights - MRP]
    Regards,
    R.Brahmankar

  • Unable to display the Traffic Lights in a simple Classical Report.

    Hi to all..
                I'm creating a simple Program where i need to display traffic lights based upon the the value i enter into it..
    i have used AS ICON and type-pools ICON too in my program... but it is not displaying traffic lights.. can anyone provide a solution for it..
    type-pools : icon.
    data :  v_light(4) type c,
               p_tno type i.
    p_no = 5.
    DO p_tno TIMES.
    WRITE: /  v_light AS ICON.
    ENDDO.

    use  this code
    TABLES: icon.
    DATA: t_text(4) TYPE c.
    Name
    Length
    Is button?
    Is status?
    Is message?
    Is Function?
    SELECT-OPTIONS:
      so_name FOR icon-name,
      so_len  FOR icon-oleng,
      so_butt FOR icon-button,
      so_stat FOR icon-status,
      so_mess FOR icon-message,
      so_fn   FOR icon-function.
    SELECT * FROM icon
      WHERE
        name     IN so_name AND
        oleng    IN so_len  AND
        button   IN so_butt AND
        status   IN so_stat AND
        message  IN so_mess AND
        function IN so_fn.
      WRITE: /1 icon-id+1(2), icon-name.
      CONCATENATE '@' icon-id+1(2) '@' INTO t_text.
      WRITE: 35 t_text AS ICON.
      WRITE: 40 icon-oleng, 50 icon-button, 60 icon-status,
             70 icon-message, 80 icon-function.
    ENDSELECT.
    TOP-OF-PAGE.
      WRITE: 40 'Length', 50 'Button', 60 'Status',
             70 'Message', 80 'Function'.
    Nabheet

  • How to get GUI Status(Push Buttons) in ALV Report

    Hi Friends
    I have a requirement in a way that:
    Once selection-screen was processed,an ALV report has to come and above the ALV List,I need a custom GUI Status(4 Push Button) with Push Buttons Logic.
    Once I had clicks on thesse push button,I need to display one more ALV List and above this List,again I need a custom GUI Status(2 Push Buttons) with Push Buttons Logic.
    Can anyone throw some light how we can achieve this.
    Thanks for your cooperation!
    Regards,
    Madisetty

    data: rt_extab type slis_t_extab,
            g_ucomm like sy-ucomm ,
            g_selfield type slis_selfield.
    form alv_display .
      call function 'REUSE_ALV_LIST_DISPLAY'
         exporting
         i_callback_program             = g_repid
         i_callback_pf_status_set       = 'PF_STATUS'
         i_callback_user_command        = 'USER_COMM'
           it_fieldcat                    = it_fldcat
          tables
            t_outtab                       = it_final1
      perform pf_status using rt_extab.
      perform user_comm using g_ucomm g_selfield .
    endform.  
    form pf_status  using    p_rt_extab.
      set pf-status 'PF_STATUS' excluding p_rt_extab.
    endform.
    form user_comm  using    p_ucomm like sy-ucomm
                             p_selfield type slis_selfield.
      data: l_row type i.
      case  p_ucomm.
        when 'DISPLAY_PO'.
          loop at it_final1 into wa_final1.
            if wa_final1-sel eq 'X' .
              l_row = l_row + 1.
            endif.
            if l_row gt 1.
              message e004.
            endif.
            clear wa_final1.
          endloop.
          p_selfield-fieldname = 'SEL'.
          read table it_final1 into wa_final1 index p_selfield-tabindex .
          set parameter id 'BES' field wa_final1-ebeln.
          call transaction 'ME23N'.
      endcase.
    endform.
    *create user interface for gui status by double clicking on 'PF_STATUS'.
    *Check the above sample code .

  • Traffic Lights in ALV

    Hi experts,
    I am using below code to generate the traffic lights but in column header i am getting one button i want to replace that as Traffic lights. how to do this can any body tell me
    "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
    Thanks,
    Tharangini

    Hi!
    Try this code.I have removed the previous code where you specify Lights in layout.I specified the lights column in fieldcatalog as Icon and passed the icon value instead of the no.s which you specified earlier.
    "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(4),
    END OF t_lights.
    "Work Areas
    DATA:
    w_lights TYPE t_lights.
    "Internal tables
    DATA:
    i_lights TYPE STANDARD TABLE OF t_lights.
    TYPE-POOLS:
    slis.
    TYPES:
    t_fieldcat TYPE slis_fieldcat_alv,
    t_events TYPE slis_alv_event,
    t_layout TYPE slis_layout_alv.
    DATA:
    w_fieldcat TYPE t_fieldcat,
    w_events TYPE t_events,
    w_layout TYPE t_layout.
    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 @0A@=red or @09@=yellow or @08@=green to lights fields
      LOOP AT i_lights INTO w_lights .
        IF sy-tabix BETWEEN 1 AND 3.
          w_lights-lights = '@0A@'.
        ELSEIF sy-tabix BETWEEN 4 AND 7.
          w_lights-lights = '@09@'.
        ELSEIF sy-tabix BETWEEN 8 AND 10.
          w_lights-lights = '@08@'.
        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.
      w_fieldcat-fieldname = 'LIGHTS'.
      w_fieldcat-icon = 'X'.
      w_fieldcat-outputlen = 14.
      w_fieldcat-seltext_l = 'Traffic Lights'.
      w_fieldcat-seltext_s = 'Traffic Lights'.
      w_fieldcat-seltext_m = 'Traffic Lights'.
      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'.
    ENDFORM. " build_layout
    *& Form list_display
    FORM list_display .
      DATA:
      l_program TYPE sy-repid.
      l_program = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_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

  • Define traffic light in MD04

    Hi Gurus,
    Can anybody please explain me the define traffic light button in MD04 in detail
    Thanks
    Anusha

    Dear,
    Go to MD04 Collective access -
    Enter MRP Area / Plant
    Enter MRP Contoller /Vendor
    Collective list of materials will appear.
    At the top of the screen , Define Traffic light button will be there.When you click on that you can visit the screen for defining traffic lights
    Define traffic light depending on ranges of coverage.
    Define traffic light depending on exception groups.
    You carryout the necessary settings for traffic light and save.
    Regards,
    R.Brahmankar

  • Traffic Light in MD07 MD06 ...

    Hello Gurus,
    I have quick question. When i run the Md07 as collective access my traffic light shows up on the extreme right hand, but i want to show up in the extreme left hand. I have looked around but couldn't find the setting.
    I know i can just drag and drop in left hand side but i have to do it every time i access collective.
    please help !!!
    Thanks!
    Khan

    Khan,
    This uses the standard table view controls.  You can create your own configuration for any of these table displays that have the Configuration button in the top right corner of the table (the icon is a tiny spreadsheet with a blue stripe across the top).
    First, drag all the columns so as to appear the way you want.  Then, click on the table configuration Icon.  In the Maintain Variant block create a name for your customized table display.  Optionally check Use as standard setting.   Clik on Create.  The name you have chosen should  be copied to the top.  Now, Save.
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/7d/f63a19015111d396480000e82de14a/frameset.htm
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/42/c1361415311d64e10000000a1553f6/frameset.htm
    Rgds,
    DB49
    Edited by: Dogboy49 on Jan 18, 2010 12:18 PM

  • Traffic light in Gantt chart and Colour change in the same.

    Dear All,
    I have designed an interactive ALV report and put a button in the output to display Gantt Chart. The Gantt chart is displaying fine after pressing the button based on the output.
    I have two questions as below.
    1) Is it possible to diplay Traffic light in Gantt chart output from an interactive report. Please provide the code as well as process.
    2) How to change the colour of the fields like date or time field of the Gantt chart output from an interactive report. Please provide the code as well as process.
    Shyamal.
    ABAP.

    Hi friend,
    For displaying trafic lights there is a simple options in the layout
    under exceptions there are few fields,
    lights_fieldname type slis_fieldname,
    lights_tabname type slis_tabname,
    lights_rollname like dfies-rollname,
    lights_condense(1) type c.
    First two fields will server the purpose if you need extra manipulation can go for other two also.
    And for changing color in the fields there is an option called emphasize(4) in fieldcatlog which will do your purpose.
    I think you know your requirement and code better so its better to adapt this in your logic the using our logic which will make you confuse.
    if you want to highlight a particular cell in the ALV go for this codes in Wiki.
    If you still need any help please revert back to me i will help you.
    Thanks,
    Sri Hari

  • LM00 - Hide push button and Command box

    Hi all,
    We are in the process of implementing ITS mobile for WM transactions (for example : LM00)
    In the browser, I could see pushbuttons F2, F4 and command box. I dont need these push buttons and the command box. Can I hide them in the browser? In fact I want to hide the whole line.
    Note : The above mentioned push buttons are not the ones coded inside the application.
    Thankyou in advance.
    Regards,
    Vic

    Hello Edgar,
    Thankyou. That helped.
    I have 2 more please
    1. The pop-message (in one of the custom developed RF transaction) that appears on MC9090 through SAP Console doesnt appear when I use ITSMobile with browser on Windows Mobile 5.0 on the same handheld. Any idea, why I will not get this message? Could this be because of missing template for pop-up message box?
    I am trying to use LM00 (+ other tranx) through ITS mobile
    2. I recieve a small screen prompt to enter User ID/Password on the IE 6.0 in the laptop on typing URL. However, in MC9090 handheld device with Windows Mobile 5.0+IE, I do not get this small screen to enter User ID/Password. Therefore a blank screen with no text is displayed. Do I have create template for this small screen too? If so what will be screen number (pgm rlogon?), please. Can you please throw some light on this please?
    Thanks a ton in advance.
    Best regards,
    Vic

  • Window traffic lights grey?

    I recently updated to OSX 10.10
    Not bad have to admit, like the new font.
    However, one bug that I have which is annoying. The window traffic lights on my machine are occasionally coloured as normal but mostly they are grey.
    Not a problem for me, I've been on Macs all my life.
    But it's wrong.
    A newbie would find it difficult.
    Anyone else noticed this?
    Hope it's I'm not the only one and the bug gets fixed.

    Hi ..
    I think you are referring to the red, yellow, and green buttons.
    Open System Preferences > Accessibility then select Display on the left.
    Deselect:  Use grayscale

  • Help me traffic light applet

    Hello i am a student at the HOGE SCHOOL VAN AMSTREDAM
    and i have recently started using java's jbuilder and i am leraing how to program in java, which i find very joyful although it can be sometimes very frustrating.
    My problem is i have to make a trafficlight applet:
    class trafficlight.
    4 traffic lights have to be controlled by one button.
    for example 1 x click button is draw two light red and two light green.
    2 x click is 4 x orange
    3x click is 2x green and two times red.
    after 3 x click the counter wil reset: if(counter>2)
    counter=0;
    my main problem is making a class trafficlight, and making the whole applet.
    is there some body who can help me?
    e-mail: [email protected]

    Yeah - most people will happily post suggestions or point out bugs if you post an attempt at the solution, and the output from it. What people generally won't do is post a full solution to a problem you've been given as an assignment. And if they do, I can tell you when I look at someone's code it's bloody obvious where a cut/paste job has been done or if someone else has written it.
    I've actually seen in the past when doing lab demo work an english-speaking students code containing a completely uncredited or commented section with Spanish variable names. It's as easy to spot plagiarised code as it is if an English student sticks 10 pages of Shakespeare into an essay.

  • Hardware push button

    I am trying to build an automated thermostat tester using labview. I'm going to try and test 6 t'stats at one time. I have most of it ready but I have a few doubts. I'm using Labview 8.5 on Windows 2000 with the NI PCI 6515 DAQ unit.
    I am attaching my code here. As you can see it has  start and stop buttons (soft button). But this is not how it's supposed to be anymore. They want a push button in hardware now. So our design fixture has a big push button for start and stop (momentary switching not a proper switch) (hard start-stop).
    I want to know how to edit this VI in order to not have these soft buttons but to tie them up to a hardware button. I know I will have to use the DAQ to sense the momentary change in state but I don't know how I can do that and how to edit this without having lots to do.
    All you help will be highly appreciated.
    Thanks,
    Shreya
    Attachments:
    mux_try45.vi ‏678 KB

    Look at the dataflow demo I have attached. If you cannot figure out what it is doing part of the time, try running it with execution highlighting on. (The light bulb on the diagram toolbar). Notice that parts Two and Three have the indicators outside the case structures and use shift registers so no local variables are needed. Part One does not update LED 1 or String 1 effectively because it has neither the shift registers nor local variables. Parts One and Two are similar to your Unit cases, except that in the demo they always execute the same case on each iteration. Part Three is similar except for the way it handles delays. See below for why this matters.
    Part Three shows an alternate Wait method which works well with state machines and allows prompt response to user inputs (Stop) or errors.
    The picture shows one case of your program. Suppose this case is called in Unit 1 and the Reset93 case is called in Unit 2 on iteration 50 of the while loop. A call to Reset93 writes to a digital line then calls Clear Tasks. Clear Tasks calls Power Off which writes to a different digital line and calls Stop. Stop tells the while loop to stop executing.
    Question: When does PowerOff (Unit 2) happen and when does the while loop stop executing?
    Answer: In iteration 53 at least 183 seconds later. Iteration 50 does not complete until all the case structures and all other nodes inside the while loop complete. Since Unit 1 Case Dialog1 has waits totaling 183 seconds, iteration 51 will not start for at least that long. If one of the other Unit cases has a longer delay or has a delay in iteration 51 or 52 those delays would extend the time before stopping.
    Lynn
    Attachments:
    Parallel state dataflow demo.vi ‏44 KB
    Dataflow1.png ‏20 KB

  • CLD Traffic Light Sample Exam.

    I am posting my solution for the CLD Traffic
    Light Sample Exam.  Comments and input is appreciated.  The main VI is
    Traffic Lite.vi.
    Thanks in advance.
    Attachments:
    TrafficLite_5.22.10.zip ‏47 KB

    Nice work, VI Joe.  I heve just a few comments.  The first two will get you more points from the judges, the third is personal style preference.
    Add descriptions and tip strips to your controls (and indicators).
    You go to either Idle or Display from almost every state; poll the controls before your main Case Structure executes and update the indicators afterwards instead.  You wouldn't need to use a State Queue any more if you did this.This would also get your Stop button to work as required.  As VENKATESH.J mentioned, it needs to respond immediately.
    This is a cleaner way to queue up multiple states:
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

Maybe you are looking for