Traffic lights in ALV list header

how do i display traffic lights as icons in ALV list header. for example, in the code below, i want to display a green icon at the end of closed items and a red icon at the end of the open items:
            closed : 4 [green-icon]
            open   : 2  [red-icon]
CLEAR header_alv_wa-info.
  header_alv_wa-key  = 'closed:'.
  header_alv_wa-info = gv_closed.
  header_alv_wa-typ  = 'S'.
  APPEND header_alv_wa TO headeralv.
  CLEAR header_alv_wa-info.
  header_alv_wa-typ  = 'S'.
  header_alv_wa-key  = 'open:'.
  header_alv_wa-info = gv_open.
  APPEND header_alv_wa TO headeralv.

Hi,
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
the above links will give u the code for the same..
Regards,
Aparna

Similar Messages

  • Example of lights in ALV LIST

    Can you please provide me with an example to use Traffic lights in ALV list display?
    Thanks,
    Amit

    Hi,
    Description : Pick Status Report                                    
    This is an ALV report using the heirarchical ALV list display. The  
    report selects all deliveries that fulfil the selection criteria    
    and displays a summary of all items in that delivery with reference 
    to certain statuses: overall status, goods issue status, transfer   
    order status, load to pallet status, pallet count status, loaded to 
    van status, van manifest printed status and end of day manifest     
    printed status. These statuses have been defined by the business.   
    There is extra functionality required to trigger printing of the van
    and end of day manifests from this report, and to set the loading   
    end status of a shipment if the last handling unit of a particular  
    shipment has been loaded onto a van for which the van manifest has  
    been triggered.                                                     
    REPORT  zwmr_pick_status_report NO STANDARD PAGE HEADING
                                    MESSAGE-ID zw.
    Type Pools                                                          
    TYPE-POOLS: icon, slis.
    Tables                                                              
    TABLES: tvst,
            likp,
            t30b,
            vekp,
    *{   INSERT         UKMK900355                                        4
            zhu_to_link,                                        "AS03
    *}   INSERT
            zpallettr,
            vttk,                                               "MB01
            zvantr.
    Types                                                               
    TYPES:
      BEGIN OF ty_data,
         lgtor       LIKE likp-lgtor,             " door
         vbeln       LIKE likp-vbeln,             " delivery
         wbstk       LIKE vbuk-wbstk,             " Goods movement status
         kostk       LIKE vbuk-kostk,             " Picking status
         posnr       LIKE lips-posnr,             " item
         route       LIKE likp-route,             " route
         wadat       LIKE likp-wadat,             " goods issue date
         lvsta       LIKE vbup-lvsta,             " warehouse status
         packvorschr LIKE vekp-packvorschr,       " pack mnemonic
         exidv       LIKE vekp-exidv,             " handling unit
         zpallet_no(10),  "like zpallettr-zpallet_no,   " pallet no
         zdep_point  LIKE zpallettr-zdep_point,   "Departur Point "Jvdm01
         zcount_check LIKE zpallettr-zcount_check," count check flag
         zvan_no(10),     "like zvantr-zvan_no,         " van no
         zvan_print  LIKE zvantr-zvan_print,      " van manifest print
         tknum       LIKE vttk-tknum,             " Shipment No  "ANV 11523
         zeod_print  LIKE zvantr-zeod_print,      " eod manifest print
         zzpackclass LIKE vekp-zzpackclass,       " package class
         zzti        LIKE vekp-zzti,              " T.I. value
         vstel       LIKE likp-vstel,             "Shipping point RM050906
         anzpk       TYPE znopack,            "No of packages in dlv MB01+
      END OF ty_data.
    TYPES:BEGIN OF x_likp ,
          vbeln LIKE likp-vbeln,
          vstel LIKE likp-vstel,                                "RM050906
          lgtor LIKE likp-lgtor,
          zzroute2lgtor LIKE likp-zzroute2lgtor,                "MB01
          route LIKE likp-route,
          wadat LIKE likp-wadat,
          zz2route LIKE likp-zz2route,                          "MB01+
          zzexproute LIKE likp-zzexproute,                      "MB01+
          zzroute2 LIKE likp-zzroute2,                          "MB01+
          anzpk    LIKE likp-anzpk,
          END OF x_likp.
    TYPES: BEGIN OF x_vbuk,
           vbeln TYPE vbuk-vbeln,
           wbstk TYPE vbuk-wbstk,             " Goods movement status
           kostk TYPE vbuk-kostk,             " Picking status
           END OF x_vbuk.
    TYPES: BEGIN OF x_lips,
          vbeln TYPE lips-vbeln,             " delivery
          posnr TYPE lips-posnr,             " item
          pstyv TYPE lips-pstyv,
          matnr TYPE lips-matnr,
          charg TYPE lips-charg,
          END OF x_lips.
    TYPES: BEGIN OF x_vbup,
           vbeln TYPE vbup-vbeln,             " delivery
           posnr TYPE vbup-posnr,             " item
           lvsta TYPE vbup-lvsta,             " warehouse status
           END OF x_vbup.
    TYPES: BEGIN OF x_vepo,
           venum TYPE vepo-venum,             "Internal Handling Unit
    Number
           vepos TYPE vepo-vepos,             "Handling Unit Item
           vbeln TYPE vepo-vbeln,             " delivery
           posnr TYPE vepo-posnr,             " item
           exidv TYPE vekp-exidv,
           END OF x_vepo.
    TYPES: BEGIN OF x_vepo1,
           venum TYPE vekp-venum,             "Internal Handling Unit
    Number
           exidv TYPE vekp-exidv,
           END OF x_vepo1.
    Start of changes by ANV SR#11523
    TYPES: BEGIN OF x_vttp,
             tknum TYPE tknum,                  " Shipment No
             tpnum TYPE tpnum,                  " Item No
             vbeln TYPE vbup-vbeln,             " delivery
             laufk LIKE vttk-laufk,             " leg indicator MB01+
           END OF x_vttp.
    End of changes by ANV SR#11523
    Data                                                                
    RANGES: r_del   FOR likp-vbeln,
            r_lgtor FOR likp-lgtor.
    RANGES: r_vanno FOR zvantr-zvan_no,
            r_palno FOR zpallettr-zpallet_no.
    DATA: BEGIN OF number_range OCCURS 0,
             mark(1),
             id(3),
             num(10) TYPE n,
             desc LIKE zpalletmd-zdesc,
          END OF number_range.
    DATA: t_disp_tab  TYPE STANDARD TABLE OF zpickdisp,
          t_data_tab  TYPE ty_data  OCCURS 0 WITH HEADER LINE,
          it_likp TYPE x_likp OCCURS 0 WITH HEADER LINE,         "SUM
          it_vbuk TYPE x_vbuk OCCURS 0 WITH HEADER LINE,         "SUM
          it_lips TYPE x_lips OCCURS 0 WITH HEADER LINE,         "SUM
          it_vbup TYPE x_vbup OCCURS 0 WITH HEADER LINE,         "SUM
          it_vepo TYPE x_vepo OCCURS 0 WITH HEADER LINE,         "SUM
          it_vepo2 TYPE x_vepo OCCURS 0 WITH HEADER LINE,        "SUM
    *{   INSERT         UKMK900355                                        3
          t_vepo_low TYPE x_vepo OCCURS 0 WITH HEADER LINE,     " AS01
    *}   INSERT
          it_vepo1 TYPE x_vepo1 OCCURS 0 WITH HEADER LINE,       "SUM
          it_vttp TYPE x_vttp OCCURS 0 WITH HEADER LINE, "ANV SR#11523
    t_disp_head TYPE STANDARD TABLE OF zpickhead.
    DATA wa_item_tab TYPE zpickdisp OCCURS 0 WITH HEADER LINE.
    "ANV SR#11113
    DATA: w_numrnge LIKE number_range,
          w_number(10) TYPE n.
    DATA: t_likp     LIKE likp      OCCURS 0 WITH HEADER LINE,
          t_lips     LIKE lips      OCCURS 0 WITH HEADER LINE,
          t_vbuk     LIKE vbuk      OCCURS 0 WITH HEADER LINE,
          t_vbup     LIKE vbup      OCCURS 0 WITH HEADER LINE,
          t_vepo     LIKE vepo      OCCURS 0 WITH HEADER LINE,
          t_vekp     LIKE vekp      OCCURS 0 WITH HEADER LINE,
          t_vantr    LIKE zvantr    OCCURS 0 WITH HEADER LINE,
          t_pallettr LIKE zpallettr OCCURS 0 WITH HEADER LINE,
         w_likp     like likp,
         w_lips     LIKE lips,
         w_vbuk     LIKE vbuk,
         w_vbup     LIKE vbup,
         w_vepo     LIKE vepo,
          w_vekp     LIKE vekp,
          w_vepo     TYPE x_vepo1,
          w_vbup     TYPE x_vbup,
          w_vttp     TYPE x_vttp,    " ANV SR#11523
          w_lips     TYPE x_lips,
          w_vbuk     TYPE x_vbuk,
          w_likp     TYPE x_likp,                               "MB01-+
          w_tplst    LIKE vttk-tplst.                           "MB01+
    DATA: s_variant  LIKE disvariant,                           "MB01+
          def_variant LIKE disvariant.
    ALV DATA *****
    DATA:
         g_grid             TYPE REF TO cl_gui_alv_grid,
         g_sort             TYPE slis_t_sortinfo_alv,
         g_custom_container TYPE REF TO cl_gui_custom_container,
         g_layout           TYPE slis_layout_alv,
         gt_fieldcat        TYPE slis_t_fieldcat_alv,
         t_fldcat           LIKE LINE OF gt_fieldcat,
         g_keyinfo          TYPE slis_keyinfo_alv,
         gt_events          TYPE slis_t_event,
         gs_event           TYPE slis_alv_event,
         w_sy_repid         LIKE sy-repid.
    DATA: BEGIN OF seltab OCCURS 0.
            INCLUDE STRUCTURE rsparams.
    DATA: END OF seltab.
    SYSTEM GENERATED TABLE CONTROL DATA ********
    DECLARATION OF TABLECONTROL 'TC_TABCON' ITSELF
    CONTROLS: tc_tabcon TYPE TABLEVIEW USING SCREEN 0100.
    LINES OF TABLECONTROL 'TC_TABCON'
    DATA:     g_tc_tabcon_lines  LIKE sy-loopc.
    DATA:     ok_code LIKE sy-ucomm.
    Constants                                                           
    CONSTANTS: c_data_class LIKE klah-class VALUE 'DG_DATA',
               c_mat_class  LIKE rmclf-klart VALUE '001',
               c_pack       LIKE lips-mtart VALUE 'VERP',
               c_a(1)            VALUE 'A',
               c_b(1)            VALUE 'B',
               c_c(1)            VALUE 'C',
               c_yes(1)          VALUE 'X',
               c_no(1)           VALUE ' '.
    Selection screen                                                    
    standard report select options block
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-002.
    SELECT-OPTIONS:
      s_wadat FOR likp-wadat NO-EXTENSION OBLIGATORY.  " Goods Issue Date
    *parameters:                                           "TR01-
    p_vstel like tvst-vstel obligatory. " Shipping Point "TR01-
    SELECT-OPTIONS:                                             "TR01+
      p_vstel FOR tvst-vstel.            " Shipping Point  "TR01+
    SELECT-OPTIONS:
      s_lfart FOR likp-lfart,            " Delivery type
      s_lgtor FOR t30b-lgtor,            " Door selection
      s_exidv FOR vekp-exidv,            " Handling Unit
      s_vbeln FOR likp-vbeln,            " Delivery            "MB01-+
      s_lfdat FOR likp-lfdat.            " Delivery date
    PARAMETERS:
      p_exdata AS CHECKBOX.              " Show extra columns flag
    SELECTION-SCREEN END OF BLOCK a.
    van/pallet specific select options block
    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-001.
    SELECT-OPTIONS:
      s_palno FOR zpallettr-zpallet_no, " no-extension,
      s_vanno FOR zvantr-zvan_no.       " no-extension.
    SELECT-OPTIONS:
      s_deppnt FOR zpallettr-zdep_point,                        "Jvdm01
      s_tplst  FOR vttk-tplst.                                  "MB01
    SELECTION-SCREEN END OF BLOCK b.
    MB01 - START - Display variant
    SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-019.
    PARAMETERS: p_vari LIKE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK c.
    MB01 - END
    Value Request Events                                                
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_palno-low.
      CLEAR: number_range, w_number .
      REFRESH number_range.
    select numbers and display pop up screen for selection
      PERFORM select_pal_nos.
      s_palno-low = w_number.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_palno-high.
      CLEAR: number_range, w_number .
      REFRESH number_range.
    select numbers and display pop up screen for selection
      PERFORM select_pal_nos.
      s_palno-high = w_number.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vanno-low.
      CLEAR: number_range, w_number .
      REFRESH number_range.
    select numbers and display pop up screen for selection
      PERFORM select_van_nos.
      s_vanno-low = w_number.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vanno-high.
      CLEAR: number_range, w_number .
      REFRESH number_range.
    select numbers and display pop up screen for selection
      PERFORM select_van_nos.
      s_vanno-high = w_number.
    MB01 - START - display variant
    F4-Help for variant
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      PERFORM f4_for_variant.
    MB01 - END
    At Selection Screen                                                 
    AT SELECTION-SCREEN.
      PERFORM validate_selections.
    Initialization                                                      
    INITIALIZATION.
    MB01 - START INSERT
    1.  Transportation planning point
    Import transportation planning point from user parameters and
    populate
    select option.
      GET PARAMETER ID 'TDP' FIELD w_tplst.
      MOVE: 'I'      TO s_tplst-sign,
             'EQ'     TO s_tplst-option,
             w_tplst TO s_tplst-low.
      APPEND s_tplst.
    2.  Display variant
      CLEAR s_variant.
      s_variant-report = sy-repid.
    Get default variant
    s_def_variante = s_variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = 'A'
           CHANGING
                cs_variant = s_variant
           EXCEPTIONS
                not_found  = 2.
      IF sy-subrc = 0.
        p_vari = s_variant-variant.
      ENDIF.
    MB01 - END INSERT
    Start of selection                                                  
    START-OF-SELECTION.
    clear all data tables
      CLEAR: t_likp,
            it_likp,
             t_lips,
             t_vbuk,
             t_vbup,
             t_vepo,
             t_vantr,
             t_pallettr,
             w_likp,
             w_lips,
             w_vbuk,
             w_vbup,
             w_vepo,
             w_vekp.
      REFRESH: t_likp,
              it_likp,
               t_lips,
               t_vbuk,
               t_vbup,
               t_vepo,
               t_vantr,
               t_pallettr.
    select data for ALV
    due to different input parameters being used, to streamline the data
    selection process, different selection methods are required
      IF NOT s_vanno IS INITIAL
      OR NOT s_palno IS INITIAL
      OR NOT s_deppnt IS INITIAL.                               "Jvdm01
      if selecting by van/pallet number, need to select the data from the
      handling unit upwards to delivery
        PERFORM select_data_up.
      ELSE.
      otherwise the data can be selected from the delivery downwards
        PERFORM select_data_down.
      ENDIF.
    End of selection                                                    
    END-OF-SELECTION.
    call hierarchical ALV display function module
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
           EXPORTING
                i_callback_program       = 'ZWMR_PICK_STATUS_REPORT'
                i_callback_pf_status_set = 'SET_STATUS'
                i_callback_user_command =
                   'USER_COMMAND' "custom gui status form
                is_layout                = g_layout  "user command form
                it_fieldcat              = gt_fieldcat
                it_sort                  = g_sort
                i_save                   = 'X'                  "MB01+
                is_variant               = s_variant
                it_events                = gt_events
                i_tabname_header         = 't_disp_head'
                i_tabname_item           = 't_disp_tab'
                i_structure_name_header  = 'ZPICKHEAD'
                i_structure_name_item    = 'ZPICKDISP'
                is_keyinfo               = g_keyinfo
           TABLES
                t_outtab_header          = t_disp_head
                t_outtab_item            = t_disp_tab.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
                                FORMS                                   
    Includes inserted by Screen Painter Wizard. DO NOT CHANGE THIS LINE!
    INCLUDE zwmr_pick_o01.
      INCLUDE zwmr_pick_status_reporto01 .
    INCLUDE zwmr_pick_i01.
      INCLUDE zwmr_pick_status_reporti01 .
    INCLUDE zwmr_pick_f01.
      INCLUDE zwmr_pick_status_reportf01 .
    *&      Form  select_pal_nos
          select pallet numbers for search help
    FORM select_pal_nos.
      DATA: BEGIN OF t_palno OCCURS 0,
              zpallet_no LIKE zpallettr-zpallet_no,
            END OF t_palno.
    select all available pallet numbers
      SELECT DISTINCT zpallet_no FROM zpallettr
                      INTO CORRESPONDING FIELDS OF TABLE t_palno.
      LOOP AT t_palno.
      get pallet id
        SELECT SINGLE zpallet_id FROM zpallettr
                      INTO number_range-id
                      WHERE zpallet_no = t_palno-zpallet_no.
      get pallet description
        SELECT SINGLE zdesc FROM zpalletmd
                      INTO number_range-desc
                      WHERE zpallet_id = number_range-id.
        number_range-num = t_palno-zpallet_no.
      append to search help table
        APPEND number_range.
      ENDLOOP.
    call pop up dialog box
      CALL SCREEN 0100 STARTING AT 5 5.
    ENDFORM.                    " select_pal_nos
    *&      Form  select_van_nos
          select van numbers for search help
    FORM select_van_nos.
      DATA: BEGIN OF t_vanno OCCURS 0,
              zvan_no LIKE zvantr-zvan_no,
            END OF t_vanno.
    select available van numbers
      SELECT DISTINCT zvan_no FROM zvantr
                      INTO CORRESPONDING FIELDS OF TABLE t_vanno.
      LOOP AT t_vanno.
      select van id
        SELECT SINGLE zvan_id FROM zvantr
                      INTO number_range-id
                      WHERE zvan_no = t_vanno-zvan_no.
      select van description (maintained in pallet tables)
        SELECT SINGLE zdesc FROM zpalletmd
                      INTO number_range-desc
                      WHERE zpallet_id = number_range-id.
        number_range-num = t_vanno-zvan_no.
      append to search help table
        APPEND number_range.
      ENDLOOP.
    call pop up dialog box
      CALL SCREEN 0100 STARTING AT 5 5.
    ENDFORM.                    " select_van_nos
    *&      Form  select_data_down
          select data if selecting from delivery down
    FORM select_data_down.
    select all deliveries from LIKP that fulfill selection criteria
    Start SU01 optmization changes
    SELECT vbeln vstel lgtor route wadat                      "RM050906
      SELECT vbeln vstel lgtor route wadat
             zzroute2lgtor zz2route zzexproute zzroute2 anzpk      "MB01-+
               FROM likp INTO CORRESPONDING FIELDS OF TABLE it_likp"MB01-+
                         WHERE vbeln IN s_vbeln
                         AND   vstel IN p_vstel
                         AND   lfart IN s_lfart
                         AND   wadat IN s_wadat
                         AND   lfdat IN s_lfdat                    "MB01+
                         AND
                 ( lgtor IN s_lgtor OR zzroute2lgtor IN s_lgtor ) ."MB01+
      IF sy-subrc NE 0.
      no data found
        MESSAGE i007.
        EXIT.
      ENDIF.
    IF NOT t_likp[] IS INITIAL.                             "SUM
      IF NOT it_likp[] IS INITIAL.
        SORT it_likp BY vbeln.                                  "SUM
      select sales document headers from VBUK
        SELECT vbeln wbstk kostk
                    FROM vbuk INTO TABLE it_vbuk
                     FOR ALL ENTRIES IN it_likp                "SUM
                     WHERE vbeln EQ it_likp-vbeln.             "SUM
        SORT it_vbuk BY vbeln.
      select all relevant delivery items from LIPS
        SELECT vbeln posnr pstyv matnr charg
                    FROM lips INTO TABLE it_lips
                      FOR ALL ENTRIES IN it_likp
                      WHERE vbeln EQ it_likp-vbeln
                      AND   pckpf NE 'B'           "cannot be packed  "AS05
                    AND   pstyv NE 'ZPAC'                           "AS05
                    AND   pstyv NE 'ZGDP'                    "TR02+ "AS05
                      AND   lfimg GT 0.                         "TR01+
      ENDIF.
      IF NOT it_lips[] IS INITIAL.
      select all sales document line items from VBUP
        SORT it_lips BY vbeln posnr.                      "SUM
        SELECT vbeln posnr lvsta
                    FROM vbup INTO TABLE it_vbup
                      FOR ALL ENTRIES IN it_lips
                      WHERE vbeln EQ it_lips-vbeln
                      AND   posnr = it_lips-posnr.
        SORT it_vbup BY vbeln posnr.
      select corresponding handling unit ID's (venum)
    TR03 Replace
    start
       select * from vepo appending corresponding fields of table t_vepo
                     for all entries in t_lips
                     where vbeln = t_lips-vbeln
                     and   posnr = t_lips-posnr
                     and   matnr = t_lips-matnr
                     and   charg = t_lips-charg.
       SELECT vepoVENUM vepoVEPOS vepovbeln vepoposnr
                     FROM vepo as vepo
                     INNER JOIN vekp as vekp ON vepovenum = vekpvenum
                     APPENDING corresponding fields of table it_vepo
                     FOR ALL ENTRIES IN it_lips
                     WHERE vepo~vbeln = it_lips-vbeln
                     AND   vepo~posnr = it_lips-posnr
                     AND   vepo~matnr = it_lips-matnr
                     AND   vepo~charg = it_lips-charg
                     AND   vekp~exidv IN s_exidv.
        SELECT venum vepos vbeln posnr
                      FROM vepo INTO TABLE it_vepo2
                      FOR ALL ENTRIES IN it_lips
                      WHERE vbeln = it_lips-vbeln
                      AND   posnr = it_lips-posnr
                      AND   matnr = it_lips-matnr
                      AND   charg = it_lips-charg.
        SORT it_vepo2 BY venum vepos.
    *{   INSERT         UKMK900355                                        1
      Ice-multis: replace lower-level HUs with highest level       " AS01
        PERFORM replace_highest_hu.                             " AS01
    *}   INSERT
    Start of changes by ANV SR#11523
    MB01 - extract shipment header as well to populate leg indicator
    Therefore, join vttp with vttk
    Limit as well by transportation planning point
        SELECT vttptknum vttptpnum vttpvbeln vttklaufk
                      FROM vttp INNER JOIN vttk
                      ON vttptknum = vttktknum
                      INTO  TABLE it_vttp
                      FOR ALL ENTRIES IN it_lips
                      WHERE vttp~vbeln = it_lips-vbeln
                      AND   vttk~tplst IN s_tplst.
    MB01 - END
    End of changes by ANV SR#11523
        IF NOT it_vepo2[] IS INITIAL.
          SELECT venum exidv
                        FROM vekp INTO TABLE it_vepo1
                        FOR ALL ENTRIES IN it_vepo2
                        WHERE venum = it_vepo2-venum
                        AND   exidv IN s_exidv.
        ENDIF.
        SORT it_vepo1 BY venum.
        CLEAR: w_vepo, it_vepo.
        LOOP AT it_vepo1.
          READ TABLE it_vepo2 WITH KEY venum = it_vepo1-venum.
          IF sy-subrc = 0.
            it_vepo2-exidv = it_vepo1-exidv.
            MODIFY it_vepo2 TRANSPORTING exidv
               WHERE venum = it_vepo1-venum .
          ENDIF.
        ENDLOOP.
        DELETE it_vepo2 WHERE exidv IS initial.
        it_vepo[] = it_vepo2[].
    TR03 Replace end
      ENDIF.
    build process table
      PERFORM move_to_table.
    ENDFORM.   "select_data_down
    *&      Form  select_data_up
          select data if selecting from van/pallet up
    FORM select_data_up.
      IF NOT s_vanno IS INITIAL.
      if van then select van numbers and hence pallet numbers
        SELECT * FROM zvantr INTO TABLE t_vantr
                              WHERE zvan_no IN s_vanno.
                            and   vstel   eq p_vstel."TR01-
        IF NOT t_vantr[] IS INITIAL.
          SORT t_vantr BY zvan_id zvan_no vstel zpallet_no.  "SUM
          SELECT * FROM zpallettr INTO TABLE t_pallettr
                                  FOR ALL ENTRIES IN t_vantr
                                  WHERE zpallet_no EQ t_vantr-zpallet_no
                                    AND zdep_point IN s_deppnt. "Jvdm01
                                and   vstel      eq p_vstel."TR01-
        ENDIF.
      ELSE.
      otherwise can get pallet numbers directly
        SELECT * FROM zpallettr INTO TABLE t_pallettr
                                WHERE zpallet_no IN s_palno
                                  AND zdep_point IN s_deppnt.   "Jvdm01
                              and   vstel      eq p_vstel."TR01-
      ENDIF.
      IF NOT t_pallettr[] IS INITIAL.
      from the pallet nos. we can select the handling units
        SORT t_pallettr BY zpallet_id zpallet_no vstel exidv.   "SUM
        SELECT * FROM vekp INTO TABLE t_vekp
                           FOR ALL ENTRIES IN t_pallettr
                           WHERE exidv EQ t_pallettr-exidv
                           AND   exidv NE space
                           AND   exidv IN s_exidv               "TR03+
                           AND ( exida = 'E'                    "TR01+
                           OR    exida = 'F' ).                 "TR01+
      ENDIF.
      SORT t_vekp BY venum.                                    "SUM
      IF NOT t_vekp[] IS INITIAL.
      build vbeln range from t_vekp.
        LOOP AT t_vekp.
          r_del-sign = 'I'.
          r_del-option = 'EQ'.
          r_del-low = t_vekp-vpobjkey.
          APPEND r_del.
        ENDLOOP.
      select all deliveries from LIKP that correspond to HU's
       SELECT * FROM likp INTO TABLE t_likp
                          WHERE vbeln IN r_del
                          AND   wadat IN s_wadat
                          AND   lfart IN s_lfart.
    ENDIF.
    MB01- START
       SELECT vbeln lgtor route wadat
                    FROM likp INTO TABLE it_likp
                        WHERE vbeln IN r_del
                        AND   wadat IN s_wadat
                        AND   lfart IN s_lfart.
        SELECT vbeln vstel lgtor route wadat
               zzroute2lgtor zz2route zzexproute zzroute2 anzpk "MB01-+
                 FROM likp INTO CORRESPONDING FIELDS OF TABLE it_likp
                           WHERE vbeln IN r_del
                           AND   lfart IN s_lfart
                           AND   wadat IN s_wadat               "MB01-+
                           AND   lfdat IN s_lfdat.              "MB01+
    MB01- END
      ENDIF.
      IF NOT it_likp[] IS INITIAL.
        SORT it_likp BY vbeln .                                   "SUM
      select sales document headers from VBUK
       SELECT * FROM vbuk INTO TABLE t_vbuk
                     FOR ALL ENTRIES IN t_likp
                     WHERE vbeln EQ t_likp-vbeln.
        SELECT vbeln wbstk kostk
                  FROM vbuk INTO TABLE it_vbuk
                     FOR ALL ENTRIES IN it_likp
                     WHERE vbeln EQ it_likp-vbeln.
        SORT it_vbuk BY vbeln.                                   "SUM
      select all relevant delivery items from LIPS
       SELECT * FROM lips INTO TABLE t_lips
                     FOR ALL ENTRIES IN t_likp
                     WHERE vbeln EQ t_likp-vbeln
                     AND   pstyv NE 'ZPAC'
                     AND   pstyv NE 'ZGDP'                     "TR02+
                     AND   lfimg GT 0.                         "TR01+
        SELECT vbeln posnr pstyv matnr charg
                          FROM lips INTO TABLE it_lips
                          FOR ALL ENTRIES IN it_likp
                          WHERE vbeln EQ it_likp-vbeln
                          AND   pckpf NE 'B'       "cannot be packed  "AS05
                        AND   pstyv NE 'ZPAC'                       "AS05
                        AND   pstyv NE 'ZGDP'                "TR02+ "AS05
                          AND   lfimg GT 0.                     "TR01+
      ENDIF.
      IF NOT it_lips[] IS INITIAL.
        SORT it_lips BY vbeln posnr.                              "SUM
      select all sales document line items from VBUP
       SELECT * FROM vbup INTO TABLE t_vbup
                     FOR ALL ENTRIES IN t_lips
                     WHERE vbeln EQ t_lips-vbeln
                     AND   posnr = t_lips-posnr.
    Start of changes by ANV SR#11523
    MB01 - START
    join vttp with vttk to obtain leg indicator
       SELECT tknum tpnum vbeln
                     FROM vttp INTO TABLE it_vttp
                     FOR ALL ENTRIES IN it_lips
                     WHERE vbeln = it_lips-vbeln.
        SELECT vttptknum vttptpnum vttpvbeln vttklaufk
                      FROM vttp INNER JOIN vttk
                      ON vttptknum = vttktknum
                      INTO  TABLE it_vttp
                      FOR ALL ENTRIES IN it_lips
                      WHERE vttp~vbeln = it_lips-vbeln
                      AND   vttk~tplst IN s_tplst.
    MB01 - END
    End of changes by ANV SR#11523
        SELECT vbeln posnr lvsta
                    FROM vbup INTO TABLE it_vbup
                    FOR ALL ENTRIES IN it_lips
                      WHERE vbeln EQ it_lips-vbeln
                      AND   posnr = it_lips-posnr.
        SORT t_vbup BY vbeln posnr.                                "SUM
      select corresponding handling unit ID's (venum)
       SELECT * FROM vepo APPENDING CORRESPONDING FIELDS OF TABLE t_vepo
                     FOR ALL ENTRIES IN t_lips
                     WHERE vbeln = t_lips-vbeln
                     AND   posnr = t_lips-posnr
                     AND   matnr = t_lips-matnr
                     AND   charg = t_lips-charg.
        SELECT venum vepos vbeln posnr
        FROM vepo APPENDING CORRESPONDING FIELDS OF TABLE it_vepo
                         FOR ALL ENTRIES IN it_lips
                         WHERE vbeln = it_lips-vbeln
                         AND   posnr = it_lips-posnr
                         AND   matnr = it_lips-matnr
                         AND   charg = it_lips-charg.
    *{   INSERT         UKMK900355                                        1
        it_vepo2[] = it_vepo[].                                 " DS01
        PERFORM replace_highest_hu.                             " DS01
        it_vepo[] = it_vepo2[].                                 " DS01
    *}   INSERT
      ENDIF.
    build process table
      PERFORM move_to_table.
    ENDFORM.   "select_data_up
    *&      Form  move_to_table
          move data to processing table
    FORM move_to_table.
      LOOP AT it_vepo.
        CLEAR t_data_tab.
      delivery lines.
        CLEAR w_lips.
        READ TABLE it_lips WITH KEY vbeln = it_vepo-vbeln
                                   posnr = it_vepo-posnr
                                   INTO w_lips BINARY SEARCH.     "SUM
        MOVE-CORRESPONDING w_lips TO t_data_tab.
      sales document line items
        CLEAR w_vbup.
        READ TABLE it_vbup WITH KEY vbeln = it_vepo-vbeln
                                   posnr = it_vepo-posnr
                                   INTO w_vbup BINARY SEARCH.     "SUM
      if w_vbup-kosta = space.                   "TR01-
        not relevant for picking
        delete t_vepo.                           "TR01-
        continue.                                "TR01-
      else.                                      "TR01-
        MOVE-CORRESPONDING w_vbup TO t_data_tab.
      endif.                                     "TR01-
      sales doc header
        CLEAR w_vbuk.
        READ TABLE it_vbuk WITH KEY vbeln = it_vepo-vbeln
                               INTO w_vbuk   BINARY SEARCH.       "SUM
        MOVE-CORRESPONDING w_vbuk TO t_data_tab.
      delivery header
        CLEAR w_likp.
        READ TABLE it_likp WITH KEY vbeln = it_vepo-vbeln
                               INTO w_likp BINARY SEARCH.         "SUM
        MOVE-CORRESPONDING w_likp TO t_data_tab.
    MB01 - START
      DATA: w_routetype TYPE i. "0=non-global,1=1st route,2=2nd
    route,3=both
    At this point move DOOR2 if it falls within the global route scenario
    and the door2 is satisfies the selection criteria for door
    1.   Does delivery fall within global route scenario
        CLEAR w_routetype.
        IF  w_likp-zz2route = 'Y' .
    1.a. First route - does door1 satisfy the selection criteria
          IF w_likp-lgtor IN s_lgtor.
            w_routetype = 1.
            MOVE w_likp-zzexproute TO t_data_tab-route.
    1.b. Second route - does door2 satisfy the selection criteria
          ELSEIF w_likp-zzroute2lgtor IN s_lgtor.
      here we need to move door2 to lgtor
            w_routetype = 2.
            MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
            MOVE w_likp-zzroute2 TO t_data_tab-route.
          ENDIF.
    If both routes satsify the criteria, append for 2nd leg  ***REVISIT!
          IF w_likp-lgtor IN s_lgtor AND w_likp-zzroute2lgtor IN s_lgtor.
            w_routetype = 3.
          ENDIF.
        ENDIF.
    MB01 - END
    Start of changes by ANV SR#11523
    MB01 - If the delivery falls within the global route scenario... need
    to select either preliminary shipment leg OR subsequent leg
    when laufk= 1 (prelim) and linked to route1, if laufk = 2 (subseq) &
    linked to route2
      Shipment Number
        SORT it_vttp BY vbeln laufk.
        CLEAR w_vttp.
        CASE w_routetype.
          WHEN 0.
            READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
                                   INTO w_vttp BINARY SEARCH.
          WHEN 1.
            READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
                                        laufk  = '1'
                                   INTO w_vttp BINARY SEARCH.
          WHEN 2.
            READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
                                        laufk  = '3'
                                   INTO w_vttp BINARY SEARCH.
          WHEN 3.  "REVISIT
        ENDCASE.
        MOVE w_vttp-tknum TO t_data_tab-tknum.
    MB01 - END
    End of changes by ANV SR#11523
      select handling unit info using vepo entry
        CLEAR w_vekp.
        IF t_vekp[] IS INITIAL.
          SELECT SINGLE * FROM vekp INTO w_vekp
                                    WHERE venum = it_vepo-venum.
        ELSE.
          READ TABLE t_vekp WITH KEY venum = it_vepo-venum
                                     INTO w_vekp  BINARY SEARCH.     "SUM
          IF sy-subrc NE 0.
            SELECT SINGLE * FROM vekp INTO w_vekp
                            WHERE venum = t_vepo-venum.
          ENDIF.
        ENDIF.
        MOVE-CORRESPONDING w_vekp TO t_data_tab.
    *{   INSERT         UKMK900355                                        2
      WM status for HU                                              "AS03
        SELECT SINGLE * FROM zhu_to_link WHERE lgnum EQ w_vekp-lgnum"AS03
                                         AND   exidv EQ w_vekp-exidv."AS03
        IF  sy-subrc EQ 0.                                      "AS03
          IF zhu_to_link-zpick_comp EQ space.                   "AS03
            t_data_tab-lvsta = 'B'.                             "AS03

  • How we can   drill-down, sorting, traffic lights,  in ALV report

    hi gurus ,
    how we can   drill-down, sorting, traffic lights,  in ALV report .
    please any one suggest that...
    regards,
    praveen

    Check the sample code for drill-down, sorting, traffic lights,  in ALV report.
    REPORT YMS_COLOURALV NO STANDARD PAGE HEADING.
    TYPE-POOLS: SLIS, ICON.
    DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA: BEGIN OF IMARA OCCURS 0,
    LIGHT(4) TYPE C,
    MATNR TYPE MARA-MATNR,
    MTART TYPE MARA-MTART,
    MAKTX TYPE MAKT-MAKTX,
    COLOR_LINE(4) TYPE C,
    TCOLOR TYPE SLIS_T_SPECIALCOL_ALV, "cell
    END OF IMARA.
    DATA: XCOLOR TYPE SLIS_SPECIALCOL_ALV.
    START-OF-SELECTION.
    PERFORM GET_DATA.
    PERFORM WRITE_REPORT.
    FORM GET_DATA.
    WRITE ICON_GREEN_LIGHT AS ICON TO IMARA-LIGHT.
    IMARA-MATNR = 'ABC'.
    IMARA-MTART = 'ZCFG'.
    IMARA-MAKTX = 'This is description for ABC'.
    APPEND IMARA.
    WRITE ICON_YELLOW_LIGHT AS ICON TO IMARA-LIGHT.
    IMARA-MATNR = 'DEF'.
    IMARA-MTART = 'ZCFG'.
    IMARA-MAKTX = 'This is description for DEF'.
    APPEND IMARA.
    WRITE ICON_RED_LIGHT AS ICON TO IMARA-LIGHT.
    IMARA-MATNR = 'GHI'.
    IMARA-MTART = 'ZCFG'.
    IMARA-MAKTX = 'This is description for GHI'.
    APPEND IMARA.
    LOOP AT IMARA.
    IF SY-TABIX = 1.
    IMARA-COLOR_LINE = 'C410'. " color line
    ENDIF.
    IF SY-TABIX = 2. " color CELL
    CLEAR XCOLOR.
    XCOLOR-FIELDNAME = 'MTART'.
    XCOLOR-COLOR-COL = '3'.
    XCOLOR-COLOR-INT = '1'. " Intensified on/off
    XCOLOR-COLOR-INV = '0'.
    APPEND XCOLOR TO IMARA-TCOLOR.
    ENDIF.
    MODIFY IMARA.
    ENDLOOP.
    ENDFORM. "get_data
    FORM WRITE_REPORT.
    DATA: LAYOUT TYPE SLIS_LAYOUT_ALV.
    LAYOUT-COLTAB_FIELDNAME = 'TCOLOR'.
    LAYOUT-INFO_FIELDNAME = 'COLOR_LINE'.
    PERFORM BUILD_FIELD_CATALOG.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FIELDCAT
    TABLES
    T_OUTTAB = IMARA.
    ENDFORM. "write_report
    FORM BUILD_FIELD_CATALOG.
    DATA: FC_TMP TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    CLEAR: FIELDCAT. REFRESH: FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Status'.
    FC_TMP-FIELDNAME = 'LIGHT'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '4'.
    FC_TMP-ICON = 'X'.
    APPEND FC_TMP TO FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Material Number'.
    FC_TMP-FIELDNAME = 'MATNR'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '18'.
    APPEND FC_TMP TO FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Material Type'.
    FC_TMP-FIELDNAME = 'MTART'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '10'.
    APPEND FC_TMP TO FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Material'.
    FC_TMP-FIELDNAME = 'MAKTX'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '40'.
    APPEND FC_TMP TO FIELDCAT.
    ENDFORM. "build_field_catalog

  • Display Traffic Lights in ALV TREE

    Hi,
    I have to display traffic light in ALV tree but i am not able to find out what parameter i should pass like in ALV grid where we can set is_layout (BCALV_GRID_04).
    Thanks in advance.
    Regards,
    Harsh

    Hi,
    Please take a look at my code below. Hope it suits your requirement.
    P.S. Please award points if it helps...
    *& Report ZMM_R_PO_TO_IPURCH_XI
    *& PROGRAM TYPE  : Report
    *& RICEF ID      :
    *& TITLE         : ZMM_R_PO_TO_IPURCH_XI
    *& SAP Module    : MM
    *& CREATION DATE : 02/06/2008
    *& AUTHOR        : Aris Hidalgo
    *& DESIGNER      : Aris Hidalgo
    *& DESCRIPTION   :
    *$**********************************************************************
    *$     CHANGE HISTORY
    *$----------------------------------------------------------------------
    *$   DATE        | T-Num      | Description                  | Reference
    **               |            |                              |
    *$**********************************************************************
    REPORT  zmm_r_po_to_ipurch_xi
            NO STANDARD PAGE HEADING
            MESSAGE-ID zmm.
    * Data Dictionary Table/s                      *
    TABLES: edidc.
    * SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_credat FOR edidc-credat OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: rb_sum RADIOBUTTON GROUP grp1,
                rb_det RADIOBUTTON GROUP grp1.
    SELECTION-SCREEN END OF BLOCK b2.
    */ CLASS DEFINITION/S /*
    *       CLASS lcl_data_def DEFINITION
    CLASS lcl_data_def DEFINITION ABSTRACT.
      PUBLIC SECTION.
        TYPES: BEGIN OF t_edidc,
                docnum TYPE edidc-docnum,
                docrel TYPE edidc-docrel,
                status TYPE edidc-status,
                doctyp TYPE edidc-doctyp,
                direct TYPE edidc-direct,
                rcvpor TYPE edidc-rcvpor,
                rcvprt TYPE edidc-rcvprt,
                rcvprn TYPE edidc-rcvprn,
                rcvsad TYPE edidc-rcvsad,
                sndpor TYPE edidc-sndpor,
                sndprt TYPE edidc-sndprt,
                sndprn TYPE edidc-sndprn,
                sndsad TYPE edidc-sndsad,
                credat TYPE edidc-credat,
                cretim TYPE edidc-cretim,
                mestyp TYPE edidc-mestyp,
                idoctp TYPE edidc-idoctp,
               END OF t_edidc.
        TYPES: BEGIN OF t_output,
                exception TYPE char1,
                ebeln     TYPE ekko-ebeln,
                lifnr     TYPE lfa1-lifnr,
                name1     TYPE lfa1-name1,
                credat    TYPE edidc-credat,
                cretim    TYPE edidc-cretim,
               END OF t_output.
        TYPES: BEGIN OF t_ekko,
                ebeln TYPE ekko-ebeln,
                lifnr TYPE ekko-lifnr,
               END OF t_ekko.
        TYPES: BEGIN OF t_lfa1,
                lifnr TYPE lfa1-lifnr,
                name1 TYPE lfa1-name1,
               END OF t_lfa1.
        DATA: gt_edidc  TYPE STANDARD TABLE OF t_edidc,
              gt_output TYPE STANDARD TABLE OF t_output,
              wa_output LIKE LINE OF gt_output,
              gt_ekko   TYPE HASHED TABLE OF t_ekko
                        WITH UNIQUE KEY ebeln,
              gt_lfa1   TYPE HASHED TABLE OF t_lfa1
                        WITH UNIQUE KEY lifnr.
    ENDCLASS.                    "lcl_data_def DEFINITION
    CLASS lcl_alv_routines  DEFINITION DEFERRED.
    CLASS lcl_handle_events DEFINITION DEFERRED.
    *       CLASS lcl_get_data DEFINITION
    CLASS lcl_get_data DEFINITION INHERITING FROM lcl_data_def.
      PUBLIC SECTION.
        METHODS: get_idocs,
                 read_idocs,
                 process_data
                   IMPORTING
                     im_docnum TYPE edidc-docnum.
      PRIVATE SECTION.
        CONSTANTS: lc_mestyp     TYPE edidc-mestyp VALUE 'ZMARKETSITE_PURCHASE_ORDER',
                   lc_idoctp     TYPE edidc-idoctp VALUE 'ZMARKETSITE_PURCHASE_ORDER01',
                   lc_segnam     TYPE edid4-segnam VALUE 'ZMARKETSITE_ORDER_HEADER1'.
        CONSTANTS: lc_red        TYPE i VALUE 1,
                   lc_yellow     TYPE i VALUE 2,
                   lc_green      TYPE i VALUE 3.
        DATA: lv_stat_message    TYPE bdidocattr-message,
              o_lcl_alv_routines TYPE REF TO lcl_alv_routines.
        DATA: ls_idoc_control    TYPE edidc,
              lv_tot_data_recs   TYPE sy-dbcnt,                 "#EC NEEDED
              lv_tot_status_recs TYPE sy-dbcnt.                 "#EC NEEDED
        DATA: lt_edids TYPE STANDARD TABLE OF edids,
              lt_edidd TYPE STANDARD TABLE OF edidd.
    ENDCLASS.                    "lcl_get_data DEFINITION
    *       CLASS lcl_alv_routines DEFINITION
    CLASS lcl_alv_routines DEFINITION INHERITING FROM lcl_get_data.
      PUBLIC SECTION.
        DATA: lcl_table            TYPE REF TO cl_salv_table,
              lcl_container        TYPE REF TO cl_gui_custom_container,
              lcl_handle_events    TYPE REF TO lcl_handle_events,
              lcl_columns          TYPE REF TO cl_salv_columns_table,
              lcl_column           TYPE REF TO cl_salv_column_table,
              lcl_events2          TYPE REF TO cl_salv_events_table,
              lcl_display_settings TYPE REF TO cl_salv_display_settings,
              lcl_functions        TYPE REF TO cl_salv_functions_list,
              lcl_display          TYPE REF TO cl_salv_display_settings,
              lcl_aggregations     TYPE REF TO cl_salv_aggregations,
              lcl_sorts            TYPE REF TO cl_salv_sorts,
              lcl_content          TYPE REF TO cl_salv_form_element,
              lcl_header           TYPE REF TO cl_salv_form_header_info,
              ls_color             TYPE lvc_s_colo.
        DATA: lcl_grid            TYPE REF TO cl_salv_form_layout_grid,
              lcl_grid_1          TYPE REF TO cl_salv_form_layout_grid,
              lcl_grid_2          TYPE REF TO cl_salv_form_layout_grid,
              lcl_label           TYPE REF TO cl_salv_form_label,"#EC NEEDED
              lcl_text            TYPE REF TO cl_salv_form_text,
              gt_t247             TYPE STANDARD TABLE OF t247,
              wa_t247             LIKE LINE OF gt_t247,
              lv_text             TYPE string.
        METHODS: display_data
                   IMPORTING
                     im_output LIKE gt_output,
                 display_top_of_page.
      PRIVATE SECTION.
        DATA: lv_string TYPE string,
              lv_date1  TYPE c LENGTH 10,
              lv_time   TYPE c LENGTH 10,
              lv_title  TYPE string.
    ENDCLASS.                    "lcl_alv_routines DEFINITION
    *       CLASS lcl_handle_events DEFINITION
    CLASS lcl_handle_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          on_link_click FOR EVENT link_click OF cl_salv_events_table
            IMPORTING row column.
    ENDCLASS.                    "lcl_handle_events DEFINITION
    */ IMPLEMENTATION/S /*
    *       CLASS lcl_get_data IMPLEMENTATION
    CLASS lcl_get_data IMPLEMENTATION.
    * METHOD get_idocs
      METHOD get_idocs.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
    *       PERCENTAGE       = 0
            text             = text-p01.
        SELECT docnum docrel status doctyp
               direct rcvpor rcvprt rcvprn
               rcvsad sndpor sndprt sndprn
               sndsad credat cretim mestyp
               idoctp
          FROM edidc
          INTO TABLE gt_edidc
         WHERE mestyp = lc_mestyp
           AND idoctp = lc_idoctp
           AND credat IN s_credat.
        IF gt_edidc[] IS NOT INITIAL.
    *     Get IDOC details
          CALL METHOD me->read_idocs.
        ENDIF.
      ENDMETHOD.                    "get_idocs
    * METHOD read_idocs
      METHOD read_idocs.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
    *       PERCENTAGE       = 0
            text             = text-p02.
        FIELD-SYMBOLS: <fs_edidc>  LIKE LINE OF gt_edidc,
                       <fs_output> LIKE LINE OF gt_output,
                       <fs_ekko>   LIKE LINE OF gt_ekko,
                       <fs_lfa1>   LIKE LINE OF gt_lfa1.
        LOOP AT gt_edidc ASSIGNING <fs_edidc>.
          CLEAR ls_idoc_control.
          REFRESH: lt_edids, lt_edidd.
    *     Get status text of IDOC
          CALL FUNCTION 'IDOC_GET_MESSAGE_ATTRIBUTE'
            EXPORTING
              idoc_number  = <fs_edidc>-docnum
            IMPORTING
              idoc_message = lv_stat_message.
    *     Get IDOC details
          CALL FUNCTION 'IDOC_READ_COMPLETELY'
            EXPORTING
              document_number          = <fs_edidc>-docnum
            IMPORTING
              idoc_control             = ls_idoc_control
              number_of_data_records   = lv_tot_data_recs
              number_of_status_records = lv_tot_status_recs
            TABLES
              int_edids                = lt_edids
              int_edidd                = lt_edidd
            EXCEPTIONS
              document_not_exist       = 1
              document_number_invalid  = 2
              OTHERS                   = 3.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    *     Pass data to output table
          CALL METHOD me->process_data
            EXPORTING
              im_docnum = <fs_edidc>-docnum.
        ENDLOOP.
        DELETE gt_output WHERE ebeln IS INITIAL.
        IF gt_output[] IS NOT INITIAL.
    *     Get vendor for fetched POs
          SELECT ebeln lifnr
            FROM ekko
            INTO TABLE gt_ekko
             FOR ALL ENTRIES IN gt_output
           WHERE ebeln = gt_output-ebeln.
          IF gt_ekko[] IS NOT INITIAL.
    *       Get name of vendors
            SELECT lifnr name1
              FROM lfa1
              INTO TABLE gt_lfa1
               FOR ALL ENTRIES IN gt_ekko
             WHERE lifnr = gt_ekko-lifnr.
          ENDIF.
    *     Pass vendor details to output table
          LOOP AT gt_output ASSIGNING <fs_output>.
            READ TABLE gt_ekko ASSIGNING <fs_ekko>
                               WITH TABLE KEY ebeln = <fs_output>-ebeln.
            IF sy-subrc = 0.
              READ TABLE gt_lfa1 ASSIGNING <fs_lfa1>
                                 WITH TABLE KEY lifnr = <fs_ekko>-lifnr.
              IF sy-subrc = 0.
                <fs_output>-lifnr = <fs_lfa1>-lifnr.
                <fs_output>-name1 = <fs_lfa1>-name1.
              ENDIF.
            ENDIF.
          ENDLOOP.
          CREATE OBJECT o_lcl_alv_routines.
          CALL METHOD o_lcl_alv_routines->display_data
            EXPORTING
              im_output = gt_output[].
        ENDIF.
      ENDMETHOD.                    "read_idocs
    * METHOD process_data
      METHOD process_data.
        FIELD-SYMBOLS: <fs_edidd> LIKE LINE OF lt_edidd.
        IF lv_stat_message CP 'ok' OR
           lv_stat_message CP 'positive'.
          wa_output-exception = lc_green.
        ELSEIF lv_stat_message CP 'error' OR
               lv_stat_message CP 'negative'.
          wa_output-exception = lc_red.
        ELSE.
          wa_output-exception = lc_yellow.
        ENDIF.
        READ TABLE lt_edidd ASSIGNING <fs_edidd>
                            WITH KEY docnum = im_docnum
                                     segnam = lc_segnam.
        IF sy-subrc = 0.
          wa_output-ebeln = <fs_edidd>-sdata+0(10).
        ENDIF.
        wa_output-credat = ls_idoc_control-credat.
        wa_output-cretim = ls_idoc_control-cretim.
        APPEND wa_output TO gt_output.
        CLEAR wa_output.
      ENDMETHOD.                    "process_data
    ENDCLASS.                    "lcl_get_data IMPLEMENTATION
    *       CLASS lcl_alv_routines IMPLEMENTATION
    CLASS lcl_alv_routines IMPLEMENTATION.
    * METHOD display_data
      METHOD display_data.
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
            percentage = 0
            text       = text-p03.
        gt_output[] = im_output[].
        TRY.
            cl_salv_table=>factory(
              EXPORTING
                list_display = ''
              IMPORTING
                r_salv_table = lcl_table
              CHANGING
                t_table      = gt_output ).
          CATCH cx_salv_msg.                                "#EC NO_HANDLER
        ENDTRY.
        lcl_functions = lcl_table->get_functions( ).
    *   Set all standard ALV functions
        lcl_functions->set_all( abap_true ).
        lcl_columns = lcl_table->get_columns( ).
        lcl_columns->set_optimize( '' ).
    *   Set display to striped pattern
        lcl_display = lcl_table->get_display_settings( ).
        lcl_display->set_striped_pattern( cl_salv_display_settings=>true ).
    */Sort columns
        TRY.
            lcl_sorts = lcl_table->get_sorts( ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        lcl_sorts->set_group_active( ).
        TRY.
            lcl_sorts->add_sort(
              columnname = 'EBELN'
              subtotal   = '' ).
          CATCH cx_salv_not_found cx_salv_existing cx_salv_data_error."#EC NO_HANDLER
        ENDTRY.
    */Set column names
        TRY.
            lcl_columns->set_exception_column( 'EXCEPTION' ).
          CATCH cx_salv_data_error.                         "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'EXCEPTION' ).
            lcl_column->set_short_text( text-h01 ).
            lcl_column->set_medium_text( text-h01 ).
            lcl_column->set_long_text( text-h01 ).
            lcl_column->set_output_length( '6' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'EBELN' ).
            lcl_column->set_short_text( text-h02 ).
            lcl_column->set_medium_text( text-h02 ).
            lcl_column->set_long_text( text-h02 ).
            lcl_column->set_output_length( '9' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'LIFNR' ).
    *        lcl_column->set_short_text( text-h03 ).
            lcl_column->set_medium_text( text-h03 ).
            lcl_column->set_long_text( text-h03 ).
            lcl_column->set_output_length( '11' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'NAME1' ).
    *        lcl_column->set_short_text( text-h04 ).
    *        lcl_column->set_medium_text( text-h04 ).
            lcl_column->set_long_text( text-h04 ).
            lcl_column->set_output_length( '30' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'CREDAT' ).
    *        lcl_column->set_short_text( text-h05 ).
    *        lcl_column->set_medium_text( text-h05 ).
            lcl_column->set_long_text( text-h05 ).
            lcl_column->set_output_length( '13' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
        TRY.
            lcl_column ?= lcl_columns->get_column( 'CRETIM' ).
    *        lcl_column->set_short_text( text-h06 ).
    *        lcl_column->set_medium_text( text-h06 ).
            lcl_column->set_long_text( text-h06 ).
            lcl_column->set_output_length( '13' ).
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
    */Set aggregations
    *    TRY.
    *        lcl_aggregations = lcl_table->get_aggregations( ).
    *      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    *    ENDTRY.
    *    TRY.
    *        lcl_aggregations->add_aggregation( '' ).
    *      CATCH cx_salv_not_found cx_salv_data_error cx_salv_existing."#EC NO_HANDLER
    *    ENDTRY.
    */Hide columns
    *    TRY.
    *        lcl_column ?= lcl_columns->get_column( 'DESCRIPT' ).
    *        lcl_column->set_visible( if_salv_c_bool_sap=>false ).
    *      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    *    ENDTRY.
    */Display top of page
        CALL METHOD me->display_top_of_page.
        lcl_table->set_top_of_list( lcl_content ).
    */Handle ALV events
        lcl_events2 = lcl_table->get_event( ).
        CREATE OBJECT lcl_handle_events.
        SET HANDLER lcl_handle_events->on_link_click FOR lcl_events2.
        lcl_display_settings = lcl_table->get_display_settings( ).
        lcl_table->display( ).
      ENDMETHOD.                    "display_data
    * METHOD display_top_of_page
      METHOD display_top_of_page.
        CREATE OBJECT lcl_grid.
        lv_title = text-t01.
        lcl_grid->create_header_information(
                    row     = 1
                    column  = 1
                    text    = lv_title
                    tooltip = lv_title ).
        lcl_grid->add_row( ).
        lcl_grid_1 = lcl_grid->create_grid(
                       row    = 3
                       column = 1 ).
        CLEAR lv_string.
        CONCATENATE: sy-datum+4(2) '/' sy-datum+6(2) '/' sy-datum+0(4)
               INTO lv_date1.
        CONCATENATE: text-t02 lv_date1
               INTO lv_string
          SEPARATED BY space.
        lcl_label = lcl_grid_1->create_label(
                      row     = 1
                      column  = 1
                      text    = lv_string
                      tooltip = lv_string ).
        CLEAR lv_string.
        CONCATENATE: sy-uzeit+0(2) ':' sy-uzeit+2(2) ':' sy-uzeit+4(2)
               INTO lv_time.
        CONCATENATE: text-t03 lv_time
               INTO lv_string
          SEPARATED BY space.
        lcl_label = lcl_grid_1->create_label(
                      row     = 2
                      column  = 1
                      text    = lv_string
                      tooltip = lv_string ).
        lcl_content = lcl_grid.
      ENDMETHOD.                    "display_top_of_page
    ENDCLASS.                    "lcl_alv_routines IMPLEMENTATION
    *       CLASS lcl_handle_events IMPLEMENTATION
    CLASS lcl_handle_events IMPLEMENTATION.
    * METHOD on_link_click
      METHOD on_link_click.
      ENDMETHOD.                    "on_link_click
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION
    * START-OF-SELECTION                           *
    START-OF-SELECTION.
      DATA: o_lcl_get_data TYPE REF TO lcl_get_data.
      CREATE OBJECT o_lcl_get_data.
      CALL METHOD o_lcl_get_data->get_idocs.

  • 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

  • Traffice light  in ALV

    hi experts
    i have itab having a field status and its data ( 'open' , 'complete')
    pls explain the needed steps to be followed for setting the traffic light in ALV.
    open --red light
    complete -- green light.
    pls, explain me the step by step procedure.
    thanks in advance.
    Regards
    Rajaram

    Hi Raja,
    Try this source coode and you can able to do it.
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE' 
                i_callback_html_end_of_list = 'END_OF_LIST_HTML'
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    *&      Form  end_of_list_html
          output at the end of the list - not in printed output       *
    FORM end_of_list_html USING end TYPE REF TO cl_dd_document.
      DATA: ls_text TYPE sdydo_text_element,
            l_grid     TYPE REF TO cl_gui_alv_grid,
            f(14) TYPE c VALUE 'SET_ROW_HEIGHT'.
      ls_text = 'Footer title'.
    adds and icon (red triangle)
      CALL METHOD end->add_icon
        EXPORTING
          sap_icon = 'ICON_MESSAGE_ERROR_SMALL'.
    adds test (via variable)
      CALL METHOD end->add_text
        EXPORTING
          text         = ls_text
          sap_emphasis = 'strong'.
    adds new line (start new line)
      CALL METHOD end->new_line.
    display text(bold)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Bold text'
          sap_emphasis = 'strong'.
    adds new line (start new line)
      CALL METHOD end->new_line.
    display text(normal)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Normal text'.
    adds new line (start new line)
      CALL METHOD end->new_line.
    display text(bold)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'Yellow triangle'
          sap_emphasis = 'strong'.
    adds and icon (yellow triangle)
      CALL METHOD end->add_icon
        EXPORTING
          sap_icon = 'ICON_LED_YELLOW'.
    display text(normal)
      CALL METHOD end->add_text
        EXPORTING
          text         = 'More text'.
    *set height of this section
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = l_grid.
      CALL METHOD l_grid->parent->parent->(f)
        EXPORTING
          id     = 3
          height = 14.
    ENDFORM. "end_of_list_html.
    Regards,
    Ameer Baba.

  • Writing selections in  alv list header

    Hi,
    in alv list header i have to show the values entered in selection screen.
    ex.
    Current year    : 2008
    current period  : 03
    report ID          : R_123
    company code : I BT  AA to BB
                            I BT  CC to DD
                            I EQ  FF
    in the above example first three are parameters and  company code is select-option, for parameters i can display what i want, but for company code( which is select option) it is showing only first line and not showing other lines.
    at the time of filling list header table for select-option, i am looping the select-option, first i am filling with  typ, key and info and for other i am filling only info, if i fill typ, key also for other recoreds also it is showing the  company code in all lines  as below ....
    company code  : I BT  AA to BB
    company code : I BT  CC to DD
    company code : I EQ  FF
    can any one suggest to get the list header as shown at the begining....
    thanks,
    bhushan

    Hi,
    Check this sample code. Here plant and date are selection screen paramters.
    Plant
      lwa_header-typ  = 'S'.
      lwa_header-key  = text-t47.
    If the select option for plant is 'EQ'
      LOOP AT s_werks.                                       "#EC *
        IF s_werks-option = 'EQ'.
          lwa_plant-werks = s_werks-low.
          APPEND lwa_plant TO lt_plant.
          CLEAR lwa_plant.
    If the select option for plant is 'BT'
        ELSEIF s_werks-option = 'BT'.
          CONCATENATE s_werks-low
                      text-t50
                      s_werks-high
            INTO lf_plant.
          lwa_header-info = lf_plant.
          APPEND lwa_header TO gt_header.
          CLEAR lwa_header.
        ENDIF.
      ENDLOOP.
      IF s_werks-option = 'EQ'.
        READ TABLE lt_plant INTO lwa_plant INDEX 1.
        lwa_header-info = lwa_plant-werks.
        APPEND lwa_header TO gt_header.
        CLEAR lwa_header.
        LOOP AT lt_plant INTO lwa_plant FROM 2.
          lwa_header-typ   = 'S'.
          lwa_header-key   = ''.
          lwa_header-info  =  lwa_plant-werks.
          APPEND lwa_header TO gt_header.
          CLEAR: lwa_header.
        ENDLOOP.
      ENDIF.
    Post date Range
      lwa_header-typ   = 'S'.
      lwa_header-key   = text-t33.
    If the select option for post date is 'EQ'
      LOOP AT s_budat.                                      "#EC *
        IF s_budat-option = 'EQ'.
          CONCATENATE s_budat-low+6(2) '.'
                      s_budat-low+4(2) '.'
                      s_budat-low(4) INTO lf_range.
        For multiple values
          IF lf_date_tmp IS INITIAL.
            lwa_date-date = lf_range.
            APPEND lwa_date TO lt_date.
          ELSE.
            lwa_date-date = lf_range.
            APPEND lwa_date TO lt_date.
          ENDIF.
      If the select option for post date is 'BT'
        ELSEIF s_budat-option = 'BT'.
          CONCATENATE s_budat-low+6(2) '.'
                      s_budat-low+4(2) '.'
                      s_budat-low(4) text-t49
                      s_budat-high+6(2) '.'
                      s_budat-high+4(2) '.'
                      s_budat-high(4) INTO lf_range .
          lwa_header-info  =  lf_range.
          CLEAR lf_range.
        ENDIF.
      ENDLOOP.
      IF s_budat-option = 'EQ'.
        READ TABLE lt_date INTO lwa_date INDEX 1.
        lwa_header-info  =  lwa_date-date.
        APPEND lwa_header TO gt_header.
        CLEAR: lwa_header.
        LOOP AT lt_date INTO lwa_date FROM 2.
          lwa_header-typ   = 'S'.
          lwa_header-key   = ''.
          lwa_header-info  =  lwa_date-date.
          APPEND lwa_header TO gt_header.
          CLEAR: lwa_header.
        ENDLOOP.
      ENDIF.
    Appending work area to the header table
      APPEND lwa_header TO gt_header.
      CLEAR lwa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_header.
    <REMOVED BY MODERATOR>
    Regards,
    Ramya
    Edited by: Alvaro Tejada Galindo on Apr 8, 2008 4:30 PM

  • Traffic Lights in ALV Tree

    Hi Experts ,
    Could you suggest if we can use traffic lights in ALV tree Display and if possible  program(T-code ) you have gone thorugh.
    I already checked BCALV_TREE_06 , its totally different just showing icons .
    Regards,
    Karan
    Edited by: Karan_Chowdary on Dec 24, 2011 7:28 AM

    First in your output table for ALV.. add the light coloum.
    for example:
    DATA: BEGIN OF IMARA OCCURS 0,
    LIGHT(4) TYPE C,
    MATNR TYPE MARA-MATNR,
    MTART TYPE MARA-MTART,
    MAKTX TYPE MAKT-MAKTX,
    COLOR_LINE(4) TYPE C,
    TCOLOR TYPE SLIS_T_SPECIALCOL_ALV, "cell
    END OF IMARA.
    Then in the get data section, you have to put if-else class and upate that column as follows
    WRITE ICON_GREEN_LIGHT AS ICON TO IMARA-LIGHT.
    The use that light column in the catalog section
    Regards,
    Venkat

  • Alv list header problem

    Hai Friends,
    In my ALV List header..i am writing date , time and my program name.
    but all are coming on left side.
    can i get date on left side, program name on centered and time on write side.
    my code is like this.
    FORM list_headers.
          lists-typ = 'H'.
          lists-info = text-010.
          APPEND lists.
          CLEAR lists.
          lists-typ = 'S'.
          lists-key = text-011.
          CONCATENATE sy-datum+6(2) '/'
                      sy-datum+4(2) '/'
                      sy-datum+0(4) INTO lists-info.
          APPEND lists.
          CLEAR lists.
          lists-typ = 'S'.
          lists-key = text-012.
          CONCATENATE sy-uzeit+0(2) ':'
                      sy-uzeit+2(2) ':'
                      sy-uzeit+4(2) INTO lists-info.
          APPEND lists.
          CLEAR lists.
    ENDFORM.

    Hi again,
    1. first of all how are u writing / displaying
       the alv header ?
    2. using documentary write ?
       then also, u can use one variable of
      length 100 and use this concept.
    3. If u are using top_of_page
      event,
      in this event, WE CAN use WRITE.
      (i have used it, and it
      works fantastic)
                  (not in case of alv grid)
    4. My point is, what ever u are using,
       use on variable of length 100.
      WRITE value INTO variable.
      using offset
      and then proceed further.
    regards,
    amit m.

  • How to read green light from ALV list display during BDC

    Hi,
    I am currently writing a BDC on CK11 transaction, after the user enters all the data he has to check log for any errors. The log is shown using ALV LIST DISPLAY and the errors are identified by RED lights on ALV LIST DISPLAY. At this point in BDC i have to either save or exit depending the status lights shown on the screen.
    Does anybody has any idea on how to read these lights from the screen ?
    thanks
    Udai

    Hi,
    I agree with Rich here. Never seen this done before (and I'm pretty sure you can't do it), but if someone has a funky way of doing it please share!
    Cheers,
    Pat.

  • ABAP OO: traffic lights in ALV

    Hello,
    Instead of going the easy way, I decided to practise a bit of ABAP OO (which I am still quite unfamiliar with), and do ALV list to my new report by using CL_SALV_TABLE class.
    This seems to be quite clear if I just follow Rich's great instructions:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de4908a6
    The only thing that is not so clear is that how can I add traffic (or led) lights to my ALV list when using  class CL_SALV_TABLE. Does someone has an example?
    Another bonus question: Do I always have to define the field catalog (with CL_SALV_TABLE) when using internal table of my own type?

    Hello
    Have a look at the sample report
    SALV_DEMO_TABLE_COLUMNS.Following is the in-line documentation of the report:
    *& Report  SALV_DEMO_TABLE_COLUMNS
    report salv_demo_table_columns no standard page heading.
    *... This report demonstrates the settings for the columns.
    *    The demonstration uses the new ALV API
    *      - cl_salv_table (Fullscreen Grid, Fullscreen List, Grid)
    *      - cl_salv_hierseq_table (hierseq. lists)
    *    If the table ALV_T_T2 is empty, please create data for the demo
    *    by running report BCALV_GENERATE_ALV_T_T2
    * §1   select data into global output table
    * §2   create ALV Table
    *      create instance of cl_salv_table for displaying a list of your
    *      output table
    * §2.1 create a ALV List by setting the parameter LIST_DISPLAY of the
    *      constructor cl_salv_table to 'X'
    * §2.2 create a ALV Fullscreen Grid by not setting the parameter
    *      LIST_DISPLAY of the constructor cl_salv_table to 'X'
    * §2.3 create a Grid by creating a Dynpro with a container in it. In
    *      PBO check if the container has been instantiated. If the
    *      container has not yet been instantiated then this is the first
    *      call:
    *            (1) create the container
    *            (2) create an instance of cl_salv_table
    * §3   Functions
    * §3.1 activate ALV generic Functions
    * §3.2 include own functions
    * §4   Cell Types
    * §4.1 Exception Column
    * §4.2 Icon Column
    * §4.3 Symbol Column
    * §4.4 Checkbox Column
    * §4.5 Hotspot Column
    * §4.6 Button Column
    * §4.7 Hyperlink Column
    * §4.8 Dropdown Column
    * §4.9 Tooltip Information for Exceptions, Icons and Symbols
    * §5   Color
    * §5.1 set the color of a complete column by calling the method
    *      set_color of cl_salv_column of the column
    * §5.2 set the color of a complete row
    *      note: by setting the columnname information the same
    *            technique can be used for setting the color of cells
    *      (1) register the column in which the color information
    *          for the row is held
    *      (2) set the color information to the row in the output
    *          table
    *          note: do not fill the parameter FNAME for setting the
    *                color of the complete row
    *                fill the parameter FNAME for setting the color
    *                of a cell (Row and Column are definied)
    * §6   Event Handler
    *      define a handler for the events of cl_salv_table
    * §6.1 define a local class for handling events of cl_salv_table
    *      define methods for the events which are to be handled
    * §6.2 implement the defined methods for handling the events of
    *      cl_salv_table
    * §7   Events
    *      register to events of cl_salv_table
    * §7.1 register to the event USER_COMMAND of cl_salv_table
    *      for receiving information when own functions has been selected
    * §7.2 register to the event DOUBLE_CLICK of cl_salv table
    *      for receiving information when user has double clicked on a line
    * §7.3 register to the event LINK_CLICK of cl_salv_table
    *      for receiving information when user has initiated a hotspot click
    * §8   Display
    *      display the configurated ALV Table by calling the method
    *      display of cl_salv_table.
    Regards
      Uwe

  • Displaying traffic lights in alv grid report?

    Hi everyone,
    I have an alv grid report.I m using the FM reuse_alv_grod_display to display my alv report.I am passing the fieldcatalogue automatically.I m getting the output perfectly.Now i have to add traffic lights to that alv report.
    Since i m passing the fieldcatalogue automatically i m confused to display the traffic lights?
    any suggestions please?
    Thank you.

    hi dp,
    look at the program i made... se the bold part you will be able to impelment lights easily,
    DECLARING TYPES POOL *
    All the definitions of internal tables, structures and constants
    are declared in a type-pool called SLIS.
    type-pools: slis.
    TABLES *
    tables: vbak,vbap,kna1.
    TYPES *
    *&--defining types for TABLE VBAK
    types: begin of t_vbak,
    vbeln type vbeln_va, "sales document
    kunnr type kunag,
    erdat type erdat,
    auart type auart,
    netwr type netwr_ak,
    waerk type waerk,
    vkorg type vkorg,
    vtweg type vtweg,
    spart type spart,
    name1 type name1_gp,
    stras type stras_gp,
    ort01 type ort01_gp,
    pstlz type pstlz,
    regio type regio,
    land1 type land1_gp,
    telf1 type telf1,
    end of t_vbak.
    *&--Defining types for TABLE VBAP
    types: begin of t_vbap,
    vbeln type vbeln_va,
    posnr type posnr_va,
    matnr type matnr,
    maktx type maktx,
    end of t_vbap.
    *&--MERGED FINAL SALES TABLE
    types: begin of t_sales_final,
    vbeln type vbeln_va,
    kunnr type kunag,
    posnr type posnr_va,
    erdat type erdat, "date of creation
    auart type auart,
    netwr type netwr_ak,
    waerk type waerk,
    vkorg type vkorg,
    vtweg type vtweg,
    spart type spart,
    name1 type name1_gp,
    v_lights type c,
    stras type stras_gp,
    ort01 type ort01_gp,
    pstlz type pstlz,
    regio type regio,
    land1 type land1_gp,
    telf1 type telf1,
    matnr type matnr,
    maktx type maktx,
    end of t_sales_final.
    defining wrokarea and IT.
    WORK AREA DECLARATION *
    *&---work area for Internal Tables
    data: wa_vbak type t_vbak.
    data: wa_vbap type t_vbap.
    data: wa_sales_final type t_sales_final.
    *&--work area for layout
    data: wa_layout type slis_layout_alv.
    INTERNAL TABLES DECLARATION *
    *&---Internal tables without Header Line.
    data : i_vbak type standard table of t_vbak,
    i_vbap type standard table of t_vbap,
    i_sales_final type standard table of t_sales_final.
    *&---Internal table for field catalog
    data : i_fieldcat type slis_t_fieldcat_alv,
    *&---Internal table for the sorting sequence.
    i_sortinfo type slis_t_sortinfo_alv,
    *&---Internal table for the event catalog.
    i_eventcat type slis_t_event,
    *&---Internal table for the top of page event
    i_listheader type slis_t_listheader.
    VARIABLE DECLARATION *
    data : v_progname like sy-repid, "Program name(system defined)
    v_gridtitle type lvc_title. "Grid Title
    INITIALIZATION EVENT *
    initialization.
    v_progname = sy-repid.
    refresh:i_vbak,
    i_vbap,
    i_sales_final,
    i_fieldcat,
    i_sortinfo,
    i_eventcat,
    i_listheader.
    clear: wa_vbak,
    wa_vbap,
    wa_sales_final,
    wa_layout.
    SELECTION SCREEN *
    SCREEN FOR ENTERING INFORMATION
    selection-screen begin of block b1 with frame title text-001.
    select-options: r_vbeln for wa_vbak-vbeln obligatory.
    select-options: r_erdat for wa_vbak-erdat obligatory.
    selection-screen end of block b1 .
    AT SELECTION SCREEN *
    at selection-screen.
    perform zf_validate_sales_doc_no.
    perform zf_validate_date.
    START OF SELECTION EVENT
    start-of-selection.
    perform zf_populate_header.
    perform zf_populate_detail.
    perform zf_append_sales_final.
    END OF SELECTION EVENT
    end-of-selection.
    *If Internal Table Is Populated Then Only Display Alv Report.
    if i_sales_final is not initial.
    Prepare fieldcatalog .
    perform zf_build_fieldcat using i_fieldcat.
    MODIFY the records IN the internal TABLE for the traffic lights.
    perform zf_modify_final.
    build event catalogue
    perform zf_eventcat using i_eventcat.
    build sorting
    perform zf_sorting using i_sortinfo.
    &---Build Listheader for TOP OF PAGE EVENT.
    perform zf_build_listheader using i_listheader.
    &---Build layout.
    perform zf_layout.
    &---Initializating Grid Title
    perform zf_build_grid_title.
    &---Display alv grid.
    perform zf_display_alv_grid.
    else.
    *If Table is not Populated ie Records Does not exist
    message 'Record Does Not Exist' type 'S'.
    endif.
    *& Form zf_validate_sales_doc_no
    text
    --> p1 text
    <-- p2 text
    form zf_validate_sales_doc_no .
    select single vbeln into wa_vbak-vbeln from vbak where vbeln in r_vbeln .
    if sy-subrc <> 0.
    message i101.
    endif.
    endform. " zf_validate_sales_doc_no
    *& Form zf_validate_date
    text
    --> p1 text
    <-- p2 text
    form zf_validate_date .
    if date is future
    if r_erdat-low >= sy-datum.
    message e102.
    elseif r_erdat-high >= sy-datum.
    message e103.
    endif.
    endform. " zf_validate_date
    *& Form zf_populate_header
    text
    --> p1 text
    <-- p2 text
    form zf_populate_header .
    select vbeln
    kunnr
    erdat
    auart
    netwr
    waerk
    vkorg
    vtweg
    spart
    into table i_vbak from vbak where vbeln in r_vbeln.
    if sy-subrc <> 0.
    message 'RECORD DOES NOT EXIST' type 'E'.
    endif.
    sort i_vbak by vbeln.
    *&--LOGIC TO GET FIELDS FROM TABLE KNA1 INTO INTERNAL TABLE I_VBAK
    loop at i_vbak into wa_vbak.
    select single name1 stras ort01 pstlz regio land1 telf1 into (wa_vbak-name1,
    wa_vbak-stras,
    wa_vbak-ort01,
    wa_vbak-pstlz,
    wa_vbak-regio,
    wa_vbak-land1,
    wa_vbak-telf1)
    from kna1
    where kunnr = wa_vbak-kunnr.
    modifying it_header.
    modify i_vbak from wa_vbak.
    clear wa_vbak.
    endloop.
    endform. " zf_populate_header
    *& Form zf_populate_detail
    text
    --> p1 text
    <-- p2 text
    form zf_populate_detail .
    if i_vbak[] is not initial.
    select vbeln
    posnr
    matnr
    into table i_vbap from vbap
    for all entries in i_vbak where vbeln = i_vbak-vbeln.
    endif.
    sort i_vbap by vbeln.
    sort i_vbap by posnr.
    *&--LOGIC TO GET FIELDS FROM TABLE MAKT INTO INTERNAL TABLE I_VBAP
    loop at i_vbap into wa_vbap.
    select single maktx into (wa_vbap-maktx)
    from makt where matnr = wa_vbap-matnr and spras = sy-langu.
    modifying it_header.
    modify i_vbap from wa_vbap.
    clear wa_vbap.
    endloop.
    endform. " zf_populate_detail
    *& Form zf_append_sales_final
    text
    --> p1 text
    <-- p2 text
    form zf_append_sales_final .
    sort i_vbak by vbeln.
    sort i_vbap by vbeln posnr.
    loop at i_vbak into wa_vbak.
    move-corresponding wa_vbak to wa_sales_final.
    read table i_vbap with key vbeln = wa_vbak-vbeln
    binary search transporting no fields.
    loop at i_vbap into wa_vbap from sy-tabix.
    if wa_vbap-vbeln <> wa_vbak-vbeln.
    exit.
    endif.
    move-corresponding wa_vbap to wa_sales_final.
    append wa_sales_final to i_sales_final.
    endloop.
    endloop.
    endform. " zf_append_sales_final
    *& Form zf_build_fieldcat
    text
    -->P_I_FIELDCAT text
    form zf_build_fieldcat using p_i_fieldcat type slis_t_fieldcat_alv.
    data: l_fieldcat type slis_fieldcat_alv. "local Workarea used
    clear l_fieldcat.
    FOR LIGHT IN COLUMN
    clear l_fieldcat.
    l_fieldcat-col_pos = '1'. " POSITION OF THE COLUMN.
    l_fieldcat-fieldname = 'V_LIGHTS'.
    " FIELD FOR WHICH CATALOG ID FILLED.
    *We are passing final internal table 'I_FINAL' to l_fieldcat(local
    *variable
    l_fieldcat-tabname = 'I_SALES_FINAL'.
    " INTERNAL TABLE TO WHICH THE FIELD BELONGS TO.
    l_fieldcat-just = 'C'. " FOR JUSTIFICATION.
    l_fieldcat-outputlen = 20.
    " TO DEFINE OUTPUT LENGTH OF THE COLUMN.
    append l_fieldcat to p_i_fieldcat.
    FIRST COLUMN ********************************
    l_fieldcat-col_pos = '2'. " POSITION OF THE COLUMN
    l_fieldcat-fieldname = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED
    l_fieldcat-tabname = 'I_SALES_FINAL'. " INTERNAL TABLE BELONGS TO
    l_fieldcat-key = 'X'. " SO THAT this field is not scrollable hiddable.
    l_fieldcat-just = 'L'. " FOR JUSTIFICATION
    *l_fieldcat-hotspot = 'X'. " MARK THIS field as hotsopt
    l_fieldcat-lzero = 'X'. " OUTPUT WITH leading zeros.
    l_fieldcat-seltext_l = 'Sales Document'. " long text for header.
    l_fieldcat-seltext_m = 'Sales Doc'. " medium text for header.
    l_fieldcat-seltext_s = 'Sales Doc'. " sort text for header.
    l_fieldcat-outputlen = 20. " SET THE output length.
    l_fieldcat-ref_tabname = 'VBAK'. " FOR F1 & F4 help as
    append l_fieldcat to p_i_fieldcat.
    clear l_fieldcat.
    **************************SECOND COLUMN ********************************
    *l_fieldcat-col_pos = '3'. " POSITION OF THE COLUMN
    l_fieldcat-row_pos = '2'. " POSITION OF THE COLUMN
    l_fieldcat-fieldname = 'POSNR'. " FIELD FOR WHICH CATALOG ID FILLED
    l_fieldcat-tabname = 'I_SALES_FINAL'. " INTERNAL TABLE BELONGS TO
    l_fieldcat-key = 'X'. " SO THAT this field is not scrollable hiddable.
    l_fieldcat-just = 'L'. " FOR JUSTIFICATION
    l_fieldcat-hotspot = 'X'. " MARK THIS field as hotsopt
    l_fieldcat-lzero = 'x'. " OUTPUT WITH leading zeros.
    l_fieldcat-seltext_l = 'Sales Document Item'. " long text for header.
    l_fieldcat-seltext_m = 'Sales Document Item'. " medium text for header.
    l_fieldcat-seltext_s = 'Sales Document Item'. " sort text for header.
    l_fieldcat-outputlen = 20. " SET THE output length.
    l_fieldcat-ref_tabname = 'VBAP'. " FOR F1 & F4 help as
    append l_fieldcat to p_i_fieldcat.
    clear l_fieldcat.
    endform. " zf_build_fieldcat
    *& Form zf_eventcat
    text
    -->P_I_EVENTCAT text
    form zf_eventcat using p_i_eventcat type slis_t_event.
    data: l_eventcat type slis_alv_event.
    clear l_eventcat.
    call function 'REUSE_ALV_EVENTS_GET'
    exporting
    i_list_type = 0
    importing
    et_events = p_i_eventcat
    exceptions
    list_type_wrong = 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.
    TOP OF PAGE FORM
    clear l_eventcat.
    read table p_i_eventcat into l_eventcat with key
    name = slis_ev_top_of_page.
    "(COMPONENT "NAME"of structure)
    if sy-subrc = 0. "if success
    move 'ZF_TOP_OF_PAGE' to l_eventcat-form.
    "matches name and moves form to workarea and modifies table
    modify p_i_eventcat from l_eventcat index sy-tabix
    transporting form.
    endif.
    PF_STATUS_SET FORM
    clear l_eventcat.
    read table p_i_eventcat into l_eventcat with key
    name = slis_ev_pf_status_set.
    if sy-subrc = 0.
    move 'ZF_PF_STATUS_SET' to l_eventcat-form.
    modify p_i_eventcat from l_eventcat index sy-tabix
    transporting form.
    endif.
    USER_COMMAND FORM
    clear l_eventcat.
    read table p_i_eventcat into l_eventcat with key
    name = slis_ev_user_command.
    if sy-subrc = 0.
    move 'ZF_USER_COMMAND' to l_eventcat-form.
    modify p_i_eventcat from l_eventcat index sy-tabix
    transporting form.
    endif.
    endform. " zf_eventcat
    *& Form zf_sorting
    text
    -->P_I_SORTINFO text
    form zf_sorting using p_i_sortinfo.
    endform. " zf_sorting
    *& Form zf_build_listheader
    text
    -->P_I_LISTHEADER text
    form zf_build_listheader using p_i_listheader type slis_t_listheader.
    data: l_listheader type slis_listheader.
    refresh p_i_listheader.
    clear l_listheader.
    HEADER
    l_listheader-typ = 'H'.
    l_listheader-info = 'FUJITSU CONSULTING INDIA LTD.'.
    append l_listheader to p_i_listheader.
    SELECTION
    l_listheader-typ = 'S'.
    l_listheader-key = 'Date:'.
    l_listheader-info = sy-datum.
    append l_listheader to p_i_listheader.
    ACTION
    l_listheader-typ = 'A'.
    *l_listheader-key =
    l_listheader-info = 'SALES ORDER ALV REPORT By Rohan Malik'.
    append l_listheader to p_i_listheader.
    endform. " zf_build_listheader
    *& Form zf_build_grid_title
    text
    --> p1 text
    <-- p2 text
    form zf_build_grid_title .
    v_gridtitle = 'List of Purchase Order'.
    endform. " zf_build_grid_title
    *& Form zf_display_alv_grid
    text
    --> p1 text
    <-- p2 text
    form zf_display_alv_grid .
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    i_callback_program = v_progname
    i_grid_title = v_gridtitle
    is_layout = wa_layout
    it_fieldcat = i_fieldcat
    it_sort = i_sortinfo
    it_events = i_eventcat
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    tables
    t_outtab = i_sales_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.
    endform. " zf_display_alv_grid
    *& Form zf_top_of_page
    text
    --> p1 text
    <-- p2 text
    form zf_top_of_page .
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = i_listheader
    i_logo = 'ENJOYSAP_LOGO'
    I_END_OF_LIST_GRID =
    endform. " zf_top_of_page
    *& Form zf_user_command
    text
    --> p1 text
    <-- p2 text
    form zf_user_command using r_ucomm like sy-ucomm
    rs_selfield type slis_selfield .
    case r_ucomm. "FCODE
    when 'VA03'.
    read table i_sales_final into wa_sales_final index rs_selfield-tabindex.
    set parameter id 'AUN' field rs_selfield-value.
    call transaction 'VA03' and skip first screen .
    message i102 with rs_selfield-value .
    when '&IC1'. "for hotspot with VBELN, POSNR, MATNR, KUNNR.
    if rs_selfield-fieldname = 'MATNR'.
    set parameter id 'MAT' field rs_selfield-value.
    call transaction 'MM03' and skip first screen.
    return.
    message i103 with rs_selfield-value .
    endif.
    if rs_selfield-fieldname = 'VBELN'.
    set parameter id 'AUN' field rs_selfield-value.
    call transaction 'VA03' and skip first screen.
    return.
    message i104 with rs_selfield-value .
    endif.
    endcase.
    endform. " zf_user_command
    *& Form ZF_PF_STATUS_SET
    text
    --> p1 text
    <-- p2 text
    form zf_pf_status_set using rt_extab type slis_t_extab.
    set pf-status 'Z11_RM_ALV_SO'.
    endform. " ZF_PF_STATUS_SET
    *& Form zf_layout
    text
    --> p1 text
    <-- p2 text
    form zf_layout .
    wa_layout-zebra = 'X'.
    wa_layout-lights_fieldname = 'V_LIGHTS'.
    wa_layout-lights_tabname = 'I_SALES_FINAL'.
    " 1, 2 or 3 for red, yellow and green respectively.
    endform. " zf_layout
    *& Form zf_modify_final
    text
    --> p1 text
    <-- p2 text
    form zf_modify_final .
    CODE TO EXECUTE LIGHTS
    *start of loop
    loop at i_sales_final into wa_sales_final.
    *giving conditions and modifying as we want to change many rows
    if wa_sales_final-netwr <= 10000.
    wa_sales_final-v_lights = '1'.
    modify i_sales_final from wa_sales_final transporting v_lights.
    elseif wa_sales_final-netwr > 10000 and wa_sales_final-netwr <= 100000.
    wa_sales_final-v_lights = '2'. " Exception.
    modify i_sales_final from wa_sales_final transporting v_lights.
    else.
    wa_sales_final-v_lights = '3'. " Exception.
    modify i_sales_final from wa_sales_final transporting v_lights.
    endif.
    endloop.
    reward point s if helpful
    rohan malik

  • Reg: Adding spaces between texts in ALV list header

    Hi All,
    I was implementing a client requirement for ALV. The list header should contain something of this format.
    Pgm Id:               ZZZ01
    After this list header it is ALV display.
    I did this using the concatenate statement.
    ex: Concatenate 'PgmID' sy-repid into listheader seperated by space.
    But this is not showing spaces between text in ALV display. See I want a tabspace between the texts in headr. Any idea on how to mak it?
    Rakesh

    Depending on Fontsize the space might be so narrow that you believe its not there.
    check in the debugger if there is really a space in the string, the clause "separated by space" will insert one for sure.
    May be you'reshowing the ALV before you are modifying the listheader?
    Another approach is using strings, blanks at the end of a string are not deleted
    concatenate 'ABC ' 'XYZ' into s.
    and
    concatenate `ABC ` `XYZ` into s.
    will give different results, be aware of the difference in the quots in both cases. Using the second example you can insert as many blanks as you want.

  • LED in field and traffic lights in ALV filter

    Hi experts,
    Am showing LED in field of ALV(OOPs oriented)and when i click on  ALV filter for led field..it shows me Traffic lights in poup for filter.Please help me to get LED in filter popup also.
    Thanks,
    Sajay.

    Solved

  • How to print traffic lights in ALV reports

    hi how to print traffic lights on selection screen in alv reports

    HI,
    check below code
    TYPE-POOLS : icon.
    types:  BEGIN OF ty_display,
            status     TYPE icon-id,
            bukrs      TYPE bseg-bukrs,
            gjahr      TYPE bseg-gjahr,
            monat      TYPE monat,
            work_order TYPE z_work_order,
            glaccount  TYPE saknr,
            message    TYPE string,
          END OF ty_display.
    data : it_display     TYPE TABLE OF ty_display,
             wa_display TYPE ty_display.
    WRITE icon_led_green AS ICON TO wa_display-status.
            wa_display-gjahr = p_year.
            wa_display-bukrs = p_cc.
            wa_display-monat = p_period.
            wa_display-work_order = v_aufnr.
            wa_display-glaccount = wa_bseg-hkont.
        APPEND wa_display TO it_display.
    WRITE icon_led_red AS ICON TO wa_display-status.
              wa_display-gjahr      = p_year.
              wa_display-bukrs      = p_cc.
              wa_display-monat      = p_period.
              wa_display-work_order = v_aufnr.
              wa_display-glaccount  = wa_bseg-hkont.
              wa_display-message    = text-010.
              APPEND wa_display TO it_display.
    change the icon color based on your requirement and append it to the internal table which you have to display in ALV.
    reward points if it is helpful.
    Regards,
    Srilatha

Maybe you are looking for

  • Crystal Reports "Report Application Server"

    Does anyone have any experience with Crystal Reports' Report Application Server (RAS)? The provided documentation is very thin and support are taking an age to respond. I want to use a Bean as a data source for a report. The blurb says you can do thi

  • Problem with syncing AD users (LDAP)

    I am running into a 'problem' with syncing users from ad. I'm pretty sure i'm doing something wrong but i can't figure it out. When i sync manually the 'pop up' shows that it's synchronizing and after a few seconds it tells me "OK". But there are 0 u

  • Preview build update fails with 0x80070003

    Attempting to update the preview build form 9860 yields error 0x80070003. How do I update the preview build?

  • Windows XP machine doesn't show up in finder

    How can I change this, and then allow screen sharing (We have 3 other computers, which are macs, and they work fine together).

  • Internal Error: 10014, 7686376, 7686666, 10069197

    TCS3.5, updated today so FM = 10.0.2.419 Win 7-64, 12 GB RAM, 1 terabyte space I get this error when trying to spell check. It is not localized to one file.  It occurred in the previous version of my install as well. I have about 15 files in one book