Color a row in ALV report

Hi Freinds,
I want to color a particular row based on the condition in ALV report can any one tell me how to do it.
Thanx and advance,
Line

Hi,
REPORT  zrnp_alv_so  MESSAGE-ID z7new .
TABLE DECLARATION
TABLES: vbak ,             "Sales Document: Header Data
        vbap ,             "Sales Document: Item Data
        makt ,             "Material Descriptions
        lips .             "SD document: Delivery: Item data
DECLARATION OF TYPE-POOL
*THIS TYPE-POOL CONTAINS THE EVENTS,
TYPE-POOLS : slis.
DECLARATION OF EVENTS
DATA: i_event TYPE slis_t_event.
DATA: t_event TYPE slis_alv_event.
DECLARATION OF LIST HEADER
DATA: i_listheader TYPE slis_t_listheader.
DECLARATION OF FIELD CATALOG FOR SCREEN 1
DATA: i_fldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DECLARATION OF FIELD CATALOG FOR SCREEN 2
DATA: i_fldcat2 TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DECLARATION OF FIELD LAYOUT
DATA: i_layout TYPE slis_layout_alv.
SORTING OF OUTPUT
DATA: i_sort TYPE slis_t_sortinfo_alv.
*DATA DECLARATION
DATA: v_auart TYPE tvak-auart,
      v_vkorg TYPE tvko-vkorg,
      v_kunnr TYPE kna1-kunnr,
      v_matnr TYPE mara-matnr ,
      v_spart TYPE tvta-spart .
TYPES: BEGIN OF it_so ,
       vbeln TYPE vbeln_va ,          "SALES ORDER NO.
       auart TYPE auart ,             "SALES DOC. TYPE
       vkorg TYPE vkorg ,             "SALES ORG.
       spart TYPE spart ,             "DIVISION
       kunnr TYPE kunag ,             "SOLD TO PARTY
       posnr TYPE posnr_va ,          "SALES DOC. ITEM
       matnr TYPE matnr ,             "MATERIAL NO
       maktx TYPE maktx ,             "DESCRIPTION
       kwmeng TYPE kwmeng ,           "QUANTITY
       vrkme TYPE vrkme ,             "SALES UNIT
       line_color(4) TYPE c ,
       END OF it_so .
TYPES: BEGIN OF it_del ,
       vbeln TYPE vbeln_vl ,         "SALES ORDER NO.
       posnr TYPE posnr_vl ,         "SALES DOC. ITEM
       matnr TYPE matnr ,            "MATERIAL NO
       werks TYPE werks_d ,          "PLANT
       lgort TYPE lgort_d ,          "STORAGE LOCATION
       charg TYPE charg_d ,          "BATCH NO.
       lfimg TYPE lfimg ,            "ACTUAL DELIVERY QTY.
       vrkme TYPE vrkme ,            "SALES UNIT
       END OF it_del .
TYPES: BEGIN OF type_vbfa ,
      vbelv TYPE vbeln_von , "Preceding sales and distribution document
      posnv TYPE posnr_von , "Preceding item of an SD document
      vbeln TYPE vbeln_nach, "Subsequent sales and distribution document
      posnn TYPE posnr_nach, "Document category of subsequent document
      vbtyp_n TYPE vbtyp_n ,
      END OF type_vbfa .
DATA: it_so1 TYPE STANDARD TABLE OF it_so ,
      it_del1 TYPE STANDARD TABLE OF it_del ,
      it_vbfa TYPE STANDARD TABLE OF type_vbfa,
      it_del_ful TYPE STANDARD TABLE OF it_del.
DATA: wa_so TYPE it_so ,
      wa_del TYPE it_del ,
      wa_vbfa TYPE type_vbfa,
      wa_it_del_ful TYPE it_del.
DATA:  i_title_vbfa TYPE lvc_title VALUE 'SALES ORDER LIST DISPLAYED'.
DATA:  i_title_vbpa TYPE lvc_title VALUE
'DELIVERY DETAILS DISPLAYED AGAINST GIVEN SALES ORDER'.
*SELECTION SCREEN                                                      *
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-004 .
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln ,
                s_auart FOR v_auart ,
                s_vkorg FOR v_vkorg ,
                s_spart FOR v_spart ,
                s_kunnr FOR v_kunnr ,
                s_matnr FOR v_matnr .
SELECTION-SCREEN END OF BLOCK blk1 .
*AT SELECTION SCREEN                                                   *
AT SELECTION-SCREEN.
  SELECT SINGLE vbeln
                 FROM vbak INTO vbak-vbeln
                 WHERE vbeln IN s_vbeln.
  IF sy-subrc <> 0.
    MESSAGE e202.
  ENDIF.
*START OF SELECTION                                                    *
START-OF-SELECTION .
  PERFORM data_select.
  PERFORM t_sort USING i_sort .
  PERFORM event_cat USING i_event .
  PERFORM fld_cat USING i_fldcat[] .
  PERFORM t_layout USING i_layout .
  PERFORM fld_cat2 USING i_fldcat2[] .
  PERFORM call_alv.
DATA SELECT                                                          *
*&      Form  DATA_SELECT
      text
-->  p1        text
<--  p2        text
FORM data_select .
  REFRESH: it_vbfa, it_so1, it_del_ful ,it_del1 .
  BREAK-POINT.
  SELECT
        a~vbeln
        a~auart
        a~vkorg
        a~spart
        a~kunnr
        b~posnr
        b~matnr
        c~maktx
        b~kwmeng
        b~vrkme
        INTO TABLE it_so1 FROM vbak AS a
              JOIN vbap AS b ON bvbeln = avbeln
              JOIN makt AS c ON cmatnr = bmatnr
              AND c~spras = sy-langu
              WHERE a~vbeln IN s_vbeln .
COLURING DISPLAY                                                     *
  DATA: ld_color(1) TYPE  c .
  LOOP AT it_so1 INTO wa_so.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
          i.e. wa_ekko-line_color = 'C410'
    ld_color = ld_color + 1.
Only 7 colours so need to reset color value
    IF ld_color = 8.
      ld_color = 1.
    ENDIF.
    CONCATENATE 'C' ld_color '10' INTO wa_so-line_color.
wa_ekko-line_color = 'C410'.
    MODIFY it_so1 FROM wa_so.
  ENDLOOP .
  IF sy-subrc = 0.
    SELECT vbelv
           posnv
           vbeln
           posnn
           vbtyp_n
           INTO TABLE it_vbfa
           FROM vbfa
           FOR ALL ENTRIES IN it_so1
           WHERE vbelv = it_so1-vbeln
           AND   posnn = it_so1-posnr
           AND vbtyp_n ='J' .
    IF sy-subrc = 0.
      SELECT vbeln
             posnr
             matnr
             werks
             lgort
             charg
             lfimg
             vrkme
             FROM lips INTO TABLE it_del_ful
             FOR ALL ENTRIES IN it_vbfa
             WHERE vbeln = it_vbfa-vbeln
             AND   posnr = it_vbfa-posnn.
    ENDIF.
  ENDIF.
ENDFORM.                    " DATA_SELECT
EVENT CATALOG ****************************************
*&      Form  EVENT_CAT
      text
     -->P_I_EVENT  text
FORM event_cat  USING    p_i_event TYPE slis_t_event .
  REFRESH p_i_event .
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
  I_LIST_TYPE           = 0
   IMPORTING
      et_events             = p_i_event
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.
  READ TABLE p_i_event WITH KEY name = slis_ev_top_of_page INTO t_event.
  IF sy-subrc = 0.
    MOVE 'TOP_OF_PAGE' TO t_event-form.
    MODIFY p_i_event FROM t_event INDEX sy-tabix TRANSPORTING form.
  ENDIF.
  CLEAR t_event .
ENDFORM.                    " EVENT_CAT
*********FORM FOR EVENT TOP_OF_PAGE*********************************
FORM top_of_page .
  REFRESH i_listheader.
  DATA: t_header TYPE slis_listheader.
  DATA: v_text(50).
  WRITE sy-datum TO v_text.
  CLEAR t_header.
  t_header-typ = 'S'.
  t_header-key = 'Date'.
  t_header-info = v_text.
  APPEND t_header TO i_listheader.
  CLEAR t_header.
  CLEAR v_text.
WRITE:  'SALES ORDER REPORT  ' TO v_text .
t_header-typ = 'S'.
t_header-key = 'TITLE'.
t_header-info = v_text.
APPEND t_header TO i_listheader.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = i_listheader.
     I_LOGO             = 'ALV_BACKGROUND'.
  I_END_OF_LIST_GRID       =
ENDFORM.                    "TOP_OF_PAGE
FIRST ALV GRID DISPLAY ***************************************
*&      Form  CALL_ALV
      text
-->  p1        text
<--  p2        text
FORM call_alv .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = sy-repid
   I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
     i_callback_user_command           = 'USER_COMMAND1'
     i_callback_top_of_page            = 'TOP_OF_PAGE'
     I_BACKGROUND_ID                   = 'ALV_BACKGROUND'
     i_grid_title                      = i_title_vbfa
     is_layout                         = i_layout
     it_fieldcat                       = i_fldcat[]
     it_sort                           = i_sort
     it_events                         = i_event
    TABLES
     t_outtab                          = it_so1
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.                    " CALL_ALV
FIRST FIELDCATALOG *************************************
*&      Form  FLD_CAT
      text
     -->P_I_FLDCAT[]  text
FORM fld_cat  USING    p_i_fldcat TYPE slis_t_fieldcat_alv.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'."TABLE NAME
  i_fldcat-seltext_m   = 'SALES ORDER NO.'.
  i_fldcat-col_pos     = 1.        " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'AUART'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'."TABLE NAME
  i_fldcat-seltext_m   = 'SALES DOC. TYPE'.
  i_fldcat-col_pos     = 2.        " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'VKORG'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'.
  i_fldcat-seltext_m   = 'SALES ORG.'.
  i_fldcat-col_pos     = 3.        " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 12.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'SPART'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'.
  i_fldcat-seltext_m   = 'DIVISION'.
  i_fldcat-col_pos     = 4.        " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 10.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'KUNNR'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'.
  i_fldcat-seltext_m   = 'SOLD TO PARTY'.
  i_fldcat-col_pos     = 5.        " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'.
  i_fldcat-seltext_m   = 'SALES DOC. ITEM'.
  i_fldcat-col_pos     = 6.        " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 17.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'.
  i_fldcat-seltext_m   = 'MATERIAL NO.'.
  i_fldcat-col_pos     = 7.        " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'MAKTX'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'.
  i_fldcat-seltext_m   = 'DESCRIPTION'.
  i_fldcat-col_pos     = 8.        " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'KWMENG'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'.
  i_fldcat-seltext_m   = 'QUANTITY'.
  i_fldcat-col_pos     = 9.        " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 15.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-do_sum    = 'X'.        " For doing "SUM"
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
  CLEAR i_fldcat.
  i_fldcat-fieldname   = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat-tabname     = 'IT_SO1'.
  i_fldcat-seltext_m   = 'SALES UNIT'.
  i_fldcat-col_pos     = 10.       " POSITION OF THE COLUMN.
  i_fldcat-outputlen   = 10.       " SET THE OUTPUT LENGTH.
  i_fldcat-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat-just(1)     = 'C'.
  APPEND i_fldcat.
ENDFORM.                    " FLD_CAT
ALV SORTING  ***************************************
*&      Form  SORT
      text
     -->P_I_SORT  text
FORM t_sort  USING    p_i_sort TYPE slis_t_sortinfo_alv .
  DATA: i_sort TYPE slis_sortinfo_alv .
  REFRESH p_i_sort .
  CLEAR i_sort.
  i_sort-spos = 1.
  i_sort-tabname = 'IT_SO1'.
  i_sort-fieldname = 'VBELN'.
  i_sort-up = 'X'.
  i_sort-subtot = 'X'.
  i_sort-group = '*'.
  APPEND i_sort TO p_i_sort.
ENDFORM.                    " SORT
*FORM SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
*ENDFORM. "Set_pf_status
**********FORM FOR EVENT USER_COMMAND1*******************************
FORM user_command1 USING r_ucomm LIKE sy-ucomm
                         rs_selfield TYPE slis_selfield.
*CASE R_UCOMM .
   WHEN '&IC1' .
   IF rs_selfield-FIELDNAME = 'VBELN' .
   ENDIF .
WHEN OTHERS .
ENDCASE .
  CLEAR wa_so.
  REFRESH: it_del1 .
  IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
  rs_selfield-value IS NOT INITIAL.
    READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
    IF sy-subrc = 0.
      LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = wa_so-vbeln
                                   AND   posnv = wa_so-posnr.
        READ TABLE it_del_ful INTO wa_it_del_ful
             WITH KEY vbeln = wa_vbfa-vbelv
                      posnr = wa_vbfa-posnn.
        IF sy-subrc = 0.
          CLEAR wa_del.
          MOVE wa_it_del_ful TO wa_del.
          APPEND wa_del TO it_del1.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDIF.
SECOND ALV GRID DISPLAY ***********************************
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
    i_callback_program                = sy-repid
  I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
    i_callback_user_command           = 'USER_COMMAND2'
    i_callback_top_of_page            = 'TOP_OF_PAGE'
    I_BACKGROUND_ID                   = 'ALV_BACKGROUND'
     i_grid_title                      = i_title_vbpa
    it_fieldcat                       = i_fldcat2[]
    it_sort                           = i_sort
    TABLES
    t_outtab                          = it_del_ful
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 .                    "USER_COMMAND1
FORM FOR EVENT USER_COMMAND 2 ******************************
FORM user_command2 USING r_ucomm LIKE sy-ucomm
                         rs_selfield TYPE slis_selfield.
  CLEAR wa_so.
  REFRESH: it_del1 .
  IF r_ucomm = '&IC1' AND rs_selfield-fieldname = 'VBELN' AND
  rs_selfield-value IS NOT INITIAL.
    READ TABLE it_so1 INTO wa_so INDEX rs_selfield-tabindex.
   IF SY-SUBRC = 0.
      LOOP AT it_vbfa INTO wa_vbfa WHERE vbelv = WA_SO-vbeln
                                   AND   posnv = WA_SO-posnr.
    READ TABLE it_del_ful INTO wa_it_del_ful
         WITH KEY vbeln = rs_selfield-value
                  posnr = wa_vbfa-posnn.
    IF rs_selfield-fieldname = 'VBELN'.
      SET PARAMETER ID 'VL' FIELD wa_vbfa-vbeln .
      CALL TRANSACTION 'VL03' AND SKIP FIRST SCREEN.
    ENDIF .
      ENDLOOP.
   ENDIF.
  ENDIF.
ENDFORM .                    "USER_COMMAND2
SECOND FIELDCATALOG ******************************************
*&      Form  FLD_CAT2
      text
     -->P_I_FLDCAT2[]  text
FORM fld_cat2  USING    p_i_fldcat2 TYPE slis_t_fieldcat_alv .
  CLEAR i_fldcat2.
  i_fldcat2-fieldname   = 'VBELN'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat2-tabname     = 'IT_DEL_FUL'."TABLE NAME
  i_fldcat2-seltext_m   = 'DELIVERY NO.'.
  i_fldcat2-col_pos     = 1.        " POSITION OF THE COLUMN.
  i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat2-hotspot     = 'X'.
  i_fldcat2-just(1)     = 'C'.
  APPEND i_fldcat2.
  CLEAR i_fldcat2.
  i_fldcat2-fieldname   = 'POSNR'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat2-seltext_m   = 'DELIVERY ITEM'.
  i_fldcat2-col_pos     = 2.        " POSITION OF THE COLUMN.
  i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat2-just(1)     = 'C'.
  APPEND i_fldcat2.
  CLEAR i_fldcat2.
  i_fldcat2-fieldname   = 'MATNR'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat2-seltext_m   = 'MATERIAL NO.'.
  i_fldcat2-col_pos     = 3.        " POSITION OF THE COLUMN.
  i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat2-just(1)     = 'C'.
  APPEND i_fldcat2.
  CLEAR i_fldcat2.
  i_fldcat2-fieldname   = 'WERKS'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat2-seltext_m   = 'PLANT.'.
  i_fldcat2-col_pos     = 4.        " POSITION OF THE COLUMN.
  i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat2-just(1)     = 'C'.
  APPEND i_fldcat2.
  CLEAR i_fldcat2.
  i_fldcat2-fieldname   = 'LGORT'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat2-seltext_m   = 'ST. LOCATION'.
  i_fldcat2-col_pos     = 5.        " POSITION OF THE COLUMN.
  i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat2-just(1)     = 'C'.
  APPEND i_fldcat2.
  CLEAR i_fldcat2.
  i_fldcat2-fieldname   = 'CHARG'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat2-seltext_m   = 'BATCH NO.'.
  i_fldcat2-col_pos     = 6.        " POSITION OF THE COLUMN.
  i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat2-just(1)     = 'C'.
  APPEND i_fldcat2.
  CLEAR i_fldcat2.
  i_fldcat2-fieldname   = 'LFIMG'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat2-seltext_m   = 'ACT. DEL. QTY.'.
  i_fldcat2-col_pos     = 7.        " POSITION OF THE COLUMN.
  i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat2-just(1)     = 'C'.
  APPEND i_fldcat2.
  CLEAR i_fldcat2.
  i_fldcat2-fieldname   = 'VRKME'. "FIELD FOR WHICH CATALOG ID FILLED
  i_fldcat2-seltext_m   = 'SALES UNIT.'.
  i_fldcat2-col_pos     = 8.        " POSITION OF THE COLUMN.
  i_fldcat2-outputlen   = 20.       " SET THE OUTPUT LENGTH.
  i_fldcat2-emphasize   = 'X'.      " COLOR OF THIS COLUMN.
  i_fldcat2-key         = 'X'.      " SO THAT THIS FIELD IS NOT
  "SCROLLABLE AND HIDDABLE.
  i_fldcat2-just(1)     = 'C'.
  APPEND i_fldcat2.
ENDFORM.                                                    " FLD_CAT2
ALV LAYOUT *******************************************
*&      Form  LAYOUT
      text
     -->P_I_LAYOUT  text
FORM t_layout  USING    p_i_layout TYPE slis_layout_alv .
  p_i_layout-zebra  = 'X'.
  p_i_layout-totals_text = 'GRAND TOTAL ='.
p_i_layout-CONFIRMATION_PROMPT = 'X'.
p_i_layout-DEF_STATUS  = ' '.
  p_i_layout-info_fieldname = 'LINE_COLOR'.
ENDFORM.                    " LAYOUT
Note: Reward points if helpful.

Similar Messages

  • Coloring of a (specific) row in ALV report-How?

    Hi Experts,
    Am looking to assign a color for a (specific)row in ALV report.......so, pls. let me know How to get it done?
    thanq

    TABLES:LFA1.
    SELECT-OPTIONS:LIFNR FOR LFA1-LIFNR.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    REGIO LIKE LFA1-REGIO,
    SORTL LIKE LFA1-SORTL,
    CFIELD(4) TYPE C,
    END OF ITAB.
    data:col(4).
    data:num value '1'.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE LIFNR
    IN LIFNR.
    LOOP AT ITAB.
    concatenate 'C' num '10' into col .
    ITAB-CFIELD = col.
    num = num + 1.
    if num = '8'.
    num = '1'.
    endif.
    MODIFY ITAB.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:EVE TYPE SLIS_T_EVENT WITH HEADER LINE.
    LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    LAYOUT-WINDOW_TITLEBAR = 'VENDORS DETAILS SCREEN'.
    LAYOUT-EDIT = 'X'.
    LAYOUT-info_fieldname = 'CFIELD'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    this is for coloring cols
    REPORT ZBHCOLOR_COLS.
    TABLES:LFA1.
    SELECT-OPTIONS:C_LIFNR FOR LFA1-LIFNR. " FOR GRID ONLY
    PARAMETERS:LIST RADIOBUTTON GROUP ALV DEFAULT 'X',
    GRID RADIOBUTTON GROUP ALV.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    SORTL LIKE LFA1-SORTL,
    REGIO LIKE LFA1-REGIO,
    COL TYPE LVC_T_SCOL,
    END OF ITAB.
    DATA:COLR TYPE LVC_S_SCOL.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB.
    LOOP AT ITAB.
    IF ITAB-LIFNR IN C_LIFNR.
    COLR-FNAME = 'NAME1'.
    COLR-COLOR-COL = '5'.
    COLR-COLOR-INT = '1'.
    COLR-COLOR-INV = '0'.
    COLR-NOKEYCOL = 'X'.
    APPEND COLR TO ITAB-COL.
    COLR-FNAME = 'LIFNR'.
    APPEND COLR TO ITAB-COL.
    MODIFY ITAB.
    ENDIF.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    LAYOUT-ZEBRA = 'X'.
    layout-coltab_fieldname = 'COL'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    IF LIST = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ELSEIF GRID = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ENDIF.
    Reward points if useful.

  • About inserting color to rows in alv

    hi ,
        could any one tell me how to insert colors to rows in alv.
    regards,
    pavan.

    hi,
    try like this
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      line_color(4) TYPE c,     "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = gd_repid
          is_layout          = gd_layout
          it_fieldcat        = fieldcatalog[]
          i_save             = 'X'
        TABLES
          t_outtab           = it_ekko
        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.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      DATA: ld_color(1) TYPE c.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekko.
    *Populate field with color attributes
      LOOP AT it_ekko INTO wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
              i.e. wa_ekko-line_color = 'C410'
        ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
        IF ld_color = 8.
          ld_color = 1.
        ENDIF.
        CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
        MODIFY it_ekko FROM wa_ekko.
      ENDLOOP.
    ENDFORM.                    " DATA_RETRIEVAL
    reward if usefull....

  • Single row in alv report

    Hi experts...
    I want single row in alv report.
    I have use loop for fatch data into internal table using loop when i am passing data in alv report then the data comes according loop. i want onlu one data in alv row.
    how can i do such, plz help me.

    decleare two internal table.
    read table itab into  wa index  1.
    append wa to itab2.
    pass itab2 only one record display.

  • Deleting rows in alv report.

    Hi Experts,
                I want to delete a row in alv report output, It is duplicating  records in the report  and 'GRAND TOTAL' also be displayed . In under the report . <<removed_by_moderator>>
    Thanks,
    Dinesh.B
    Edited by: Vijay Babu Dudla on May 11, 2009 9:15 AM

    Hi,
    use the following code for deleting duplicate and adjacent records from itab
    delete ADJACENT DUPLICATES FROM itab.
    or
    sort itab by pernr.
    delete ADJACENT DUPLICATE FROM itab COMPARING pernr.
    Also, for grand total you can use fieldcat-do_sum    =  'X'  with the field catalog. It will give you total for the required column.
    Hope this solves your problem.
    Regards,
    Ibrar Munsif.

  • How to select multiple row in ALV report

    Hi friends,
    1. How to select multiple row in ALV report
                   ( How to set tab in ALV report and want to select multiple line.)
    Thanking you.
    Subash

    Hi Sahoo,
    If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
    in layout structure you will find field SEL_MODE
    pass :
    LS_LAYOUT-SEL_MODE = 'A'.
    In PAI.
      CALL METHOD GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = T_ROWS
          ET_ROW_NO     = T_ROWID.
    Hope these will solve your problem.
    Regards,
    Kumar M.

  • To add/delete the rows in ALV report outpout

    Hi,
    Is there any way by which we can  add/delete the rows in ALV report output.
    Thanks
    Ankul

    Hi,
    Try out this way:
    data: i_modified TYPE STANDARD TABLE OF mara,"For getting modified rows
            w_modified TYPE mara.
    CASE e_ucomm.
          WHEN 'EDIT'.
          perform save_database.
          CALL METHOD ref_GRID->REFRESH_TABLE_DISPLAY.
        ENDCASE.
    FORM SAVE_DATABASE .
    data: i_selected_rows TYPE lvc_t_row,                "Selected Rows
          w_selected_rows TYPE lvc_s_row.
    * Getting the selected rows index
        CALL METHOD ref_grid->get_selected_rows
                    IMPORTING  et_index_rows = i_selected_rows.
    * Through the index capturing the values of selected rows
        LOOP AT i_selected_rows INTO w_selected_rows.
        READ TABLE it_tab INTO wa_it_tab INDEX w_selected_rows-index.
        IF sy-subrc EQ 0.
          MOVE-CORRESPONDING wa_it_tab TO w_modified.
          APPEND w_modified TO i_modified.
        ENDIF.
      ENDLOOP.
      MODIFY mara FROM TABLE i_modified.
    Thanks,
    Krishna

  • How to apply List box for multiple selection of rows  in ALV report ?

    Hi Exprots,
    1: How to apply List box for multiple selection of rows  in ALV report ?
    Thanking you.
    Subash

    hi,
    check the below program.
    REPORT zalv_dropdowns.
    *Type pools declarations for ALV
    TYPE-POOLS : slis.
    *data declarations for ALV container,ALV grid, Fieldcatalogues & layout
    DATA: g_grid  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          gs_layout TYPE lvc_s_layo.*INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
    DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
          wa_outtab TYPE t517a.
    START-OF-SELECTION.*Call to ALV
      CALL SCREEN 600.*On this statement double click  it takes you to the screen painter SE51.
    *Create a Custom container and name it CCONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.
    PBO of the actual screen , Here we can give a title and customized menus
    Here we also call the subroutine for ALV output.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      PERFORM alv_output.
    ENDMODULE.                    "pbo OUTPUT
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    ENDMODULE.                    "pai INPUT
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat.
    DATA ls_fcat TYPE lvc_s_fcat.
    *Build the field catalogue
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'T517A'
        CHANGING
          ct_fieldcat      = gt_fieldcat.
    To assign dropdown in the fieldcataogue
      LOOP AT gt_fieldcat INTO ls_fcat.   
    CASE ls_fcat-fieldname.
       WHEN 'SLART'.
    *is the first list box
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.
    is the second list box    
    WHEN 'ABART'.       
            ls_fcat-drdn_hndl = '2'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.   
    ENDCASE.
      ENDLOOP.
    ENDFORM.                    "build_fieldcat
    *&      Form  ALV_OUTPUT
    FORM alv_output .*Create object for container
      CREATE OBJECT g_custom_container
             EXPORTING container_name = 'CCONT'.
    *create object for grid
      CREATE OBJECT g_grid
             EXPORTING i_parent = g_custom_container.
    Build fieldcat and set column
    *Assign a handle for the dropdown listbox.
      PERFORM build_fieldcat.
    *Build layout
      PERFORM build_layout.
    Define a drop down table.
      PERFORM dropdown_table.
    *fetch values from the T517A table
      SELECT * FROM t517a INTO TABLE gt_outtab.
    *Display ALV output
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_outtab       = gt_outtab.ENDFORM.                               "ALV_OUTPUT
    *&      Form  dropdown_table
          text
    -->  p1        text
    <--  p2        text
    FORM dropdown_table.*Declarations for drop down lists in ALV.
      DATA: lt_dropdown TYPE lvc_t_drop,
            ls_dropdown TYPE lvc_s_drop.
    First SLART listbox (handle '1').
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '01 Primary school'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '1'.
      ls_dropdown-value = '02 Lower Secondary'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '1'.
      ls_dropdown-value = '03 Upper Secondary'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '04 Professional School'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '05 College'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '06 University'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '09 Other Establishment'.
      APPEND ls_dropdown TO lt_dropdown.* Second ABART listbox (handle '2').  ls_dropdown-handle = '2'.
      ls_dropdown-value = '10 Primary School certificate'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '2'.
      ls_dropdown-value = '20 Lower secondary/Junior high'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '30 High school diploma(B-levels)'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '2'.
      ls_dropdown-value = '31 Vocational'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '32 Matriculation'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '40 Specialist vocational certificate'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '50 College degree Level1'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '51 College degree Level2'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '52 Masters degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '60 Univ Degree level1'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '61 Bachelors degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '62 Masters degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '63 Licenciate'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '64 Doctors Degree Ph.D'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '89 None'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '90 Unknown'.
      APPEND ls_dropdown TO lt_dropdown.*method to display the dropdown in ALV
      CALL METHOD g_grid->set_drop_down_table
        EXPORTING
          it_drop_down = lt_dropdown.ENDFORM.                               " dropdown_table
    *&      Form  build_layout
          text
    *layout for ALV output
    FORM build_layout .  gs_layout-cwidth_opt = 'X'.
      gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
      gs_layout-no_toolbar = 'X'.ENDFORM.                    " build_layout
    endform.
    Edited by: S.r.v.r.Kumar on Jun 1, 2009 2:48 PM

  • Adding color to few rows in ALV report output

    Hi,
    I have developed a ALV report program which displays the project details of the employees.In the output the rows containing the employees who have been part of the project should be displayed in different color.I have used necessary code for this but still the rows are not displayed in different color.
    Given below is my program.Please suggest me possible solution for this.
    REPORT  ZPROJ_ALL_DETAILS.
    TYPE-POOLS: SLIS.
    Tables: zheempl,zhealoc,zheproj,zheskil.
    types: begin of ty_zheempl,
          empid like zheempl-empid,
          grade like zheempl-grade,
          location like zheempl-location,
          pu like zheempl-pu,
          name1 like zheempl-name1,
          end of ty_zheempl.
    types: begin of ty_zhealoc,
          project like zhealoc-project,
          stdat like zhealoc-stdat,
          endat like zhealoc-endat,
          role like zhealoc-role,
          end of ty_zhealoc.
    types: begin of ty_output,
          empid like zheempl-empid,
          grade like zheempl-grade,
          location like zheempl-location,
          pu    like zheempl-pu,
          name1 like zheempl-name1,
          role like zhealoc-role,
          stdat like zhealoc-stdat,
          endat like zhealoc-endat,
          cellcolor(4) type c,
          end of ty_output.
    data: t_zheempl type standard table of ty_zheempl,
          t_zhealoc type standard table of ty_zhealoc,
          t_output type standard table of ty_output with header line.
    data: wa_zheempl type ty_zheempl,
          wa_zhealoc type ty_zhealoc,
          wa_output type ty_output.
    DATA : T_FIELDCAT TYPE slis_t_fieldcat_alv.
    Data : wa_fieldcat type slis_fieldcat_alv.
    Data: it_top TYPE slis_t_listheader,
          wa_top TYPE slis_listheader.
    Data: t_cellcolor TYPE lvc_t_scol WITH HEADER LINE,
          wa_cellcolor TYPE lvc_s_scol.
    Data: t_layout TYPE slis_layout_alv.
    *selection-screen
    selection-screen: begin of block b1 with frame title text-001.
    select-options: s_proj for wa_zhealoc-project,
                    s_empid   for wa_zheempl-empid.
    parameters:     p_date like sy-datum obligatory.
    selection-screen: end of block b1.
    selection-screen: begin of block b2 with frame title text-002.
    parameters:      p_prtosr  radiobutton group g1 default 'X',
                     p_prusly  radiobutton group g1.
    selection-screen: end of block b2.
    selection-screen: begin of block b3 with frame title text-003.
    parameters:      p_dwtodk as checkbox default 'X'.
    selection-screen: end of block b3.
    selection-screen: begin of block b4 with frame title text-004.
    parameters:      p_shwhis as checkbox default 'X'.
    selection-screen: end of block b4.
    Start-of-selection
      IF p_shwhis = 'X'.
    SELECT l~empid
           l~grade
           l~location
           l~pu
           l~name1
           c~role
           c~stdat
           c~endat
      INTO TABLE t_output
      FROM ( zheempl AS l
      INNER JOIN zhealoc
      AS c ON lempid = cempid )
      where project IN s_proj
      AND endat < p_date
      OR endat > p_date.
       t_output-cellcolor = 'C310'.
       MODIFY t_output transporting cellcolor where endat < p_date.
      ELSE.
      select l~empid
           l~grade
           l~location
           l~pu
           l~name1
           c~role
           c~stdat
           c~endat
      INTO TABLE t_output
      FROM ( zheempl AS l
      INNER JOIN zhealoc
      AS c ON lempid = cempid )
      WHERE project in s_proj
      AND   endat > p_date.
       ENDIF.
      wa_fieldcat-col_pos = '1'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'EMPID'.
      wa_fieldcat-seltext_m = 'Employee ID'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '2'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'NAME1'.
      wa_fieldcat-seltext_m = 'Name 1'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '3'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'ROLE'.
      wa_fieldcat-seltext_m = 'Role of employee in the project'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '4'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'STDAT'.
      wa_fieldcat-seltext_m = 'Start Date'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '5'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'ENDAT'.
      wa_fieldcat-seltext_m = 'End Date'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '6'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'GRADE'.
      wa_fieldcat-seltext_m = 'Salary Level'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '7'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'PU'.
      wa_fieldcat-seltext_m = 'Department Number'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '8'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'LOCATION'.
      wa_fieldcat-seltext_m = 'Work Location'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      t_layout-no_input = 'X'.
      t_layout-colwidth_optimize = 'x'.
      t_layout-info_fieldname = 'LINE_COLOR'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_INTERFACE_CHECK                 = ' '
        I_BYPASSING_BUFFER                = ' '
        I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = SY-REPID
         i_callback_top_of_page            = 'TOP'
         is_layout                         = t_layout
         IT_FIELDCAT                       = T_FIELDCAT
         i_save                            = 'X'
        TABLES
          t_outtab                          = T_OUTPUT
      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.
    Form top.
      Refresh it_top.
      wa_top-typ = 'S'.
      wa_top-key = 'Requestor'.
      wa_top-info = sy-uname.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      wa_top-typ = 'S'.
      wa_top-key = 'Program'.
      wa_top-info = sy-repid.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      wa_top-typ = 'S'.
      wa_top-key = 'Page'.
      wa_top-info = sy-pagno.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      wa_top-typ = 'S'.
      wa_top-key = 'Date'.
      wa_top-info = sy-datum.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      wa_top-typ = 'H'.
      wa_top-info = 'Project Details'.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = it_top.
      ENDFORM.

    { REPORT  ZPROJ_ALL_DETAILS.
    TYPE-POOLS: SLIS.
    Tables: zheempl,zhealoc,zheproj,zheskil.
    types: begin of ty_zheempl,
          empid like zheempl-empid,
          grade like zheempl-grade,
          location like zheempl-location,
          pu like zheempl-pu,
          name1 like zheempl-name1,
          end of ty_zheempl.
    types: begin of ty_zhealoc,
          project like zhealoc-project,
          stdat like zhealoc-stdat,
          endat like zhealoc-endat,
          role like zhealoc-role,
          end of ty_zhealoc.
    types: begin of ty_output,
          empid like zheempl-empid,
          grade like zheempl-grade,
          location like zheempl-location,
          pu    like zheempl-pu,
          name1 like zheempl-name1,
          role like zhealoc-role,
          stdat like zhealoc-stdat,
          endat like zhealoc-endat,
          cellcolor(4) type c,
          end of ty_output.
    data: t_zheempl type standard table of ty_zheempl,
          t_zhealoc type standard table of ty_zhealoc,
          t_output type standard table of ty_output with header line,
          t_output1 type standard table of ty_output with header line.
    data: wa_zheempl type ty_zheempl,
          wa_zhealoc type ty_zhealoc,
          wa_output type ty_output,
          wa_output1 type ty_output.
    DATA : T_FIELDCAT TYPE slis_t_fieldcat_alv.
    Data : wa_fieldcat type slis_fieldcat_alv.
    Data: it_top TYPE slis_t_listheader,
          wa_top TYPE slis_listheader.
    Data: t_cellcolor TYPE lvc_t_scol WITH HEADER LINE,
          wa_cellcolor TYPE lvc_s_scol.
    Data: t_layout TYPE slis_layout_alv.
    *selection-screen
    selection-screen: begin of block b1 with frame title text-001.
    select-options: s_proj for wa_zhealoc-project,
                    s_empid   for wa_zheempl-empid.
    parameters:     p_date like sy-datum obligatory.
    selection-screen: end of block b1.
    selection-screen: begin of block b2 with frame title text-002.
    parameters:      p_prtosr  radiobutton group g1 default 'X',
                     p_prusly  radiobutton group g1.
    selection-screen: end of block b2.
    selection-screen: begin of block b3 with frame title text-003.
    parameters:      p_dwtodk as checkbox default 'X'.
    selection-screen: end of block b3.
    selection-screen: begin of block b4 with frame title text-004.
    parameters:      p_shwhis as checkbox default 'X'.
    selection-screen: end of block b4.
    Start-of-selection
      IF p_shwhis = 'X'.
    SELECT l~empid
           l~grade
           l~location
           l~pu
           l~name1
           c~role
           c~stdat
           c~endat
      INTO TABLE t_output
      FROM ( zheempl AS l
      INNER JOIN zhealoc
      AS c ON lempid = cempid )
      where project IN s_proj
      AND endat < p_date
      OR endat > p_date.
       t_output-cellcolor = 'C310'.
       MODIFY t_output transporting cellcolor where endat < p_date.
      ELSE.
      select l~empid
           l~grade
           l~location
           l~pu
           l~name1
           c~role
           c~stdat
           c~endat
      INTO TABLE t_output
      FROM ( zheempl AS l
      INNER JOIN zhealoc
      AS c ON lempid = cempid )
      WHERE project in s_proj
      AND   endat > p_date.
       ENDIF.
      wa_fieldcat-col_pos = '1'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'EMPID'.
      wa_fieldcat-seltext_m = 'Employee ID'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '2'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'NAME1'.
      wa_fieldcat-seltext_m = 'Name 1'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '3'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'ROLE'.
      wa_fieldcat-seltext_m = 'Role of employee in the project'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '4'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'STDAT'.
      wa_fieldcat-seltext_m = 'Start Date'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '5'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'ENDAT'.
      wa_fieldcat-seltext_m = 'End Date'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '6'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'GRADE'.
      wa_fieldcat-seltext_m = 'Salary Level'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '7'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'PU'.
      wa_fieldcat-seltext_m = 'Department Number'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos = '8'.
      wa_fieldcat-tabname = 't_output'.
      wa_fieldcat-fieldname = 'LOCATION'.
      wa_fieldcat-seltext_m = 'Work Location'.
      wa_fieldcat-hotspot = 'X'.
      APPEND wa_fieldcat to t_fieldcat.
      CLEAR wa_fieldcat.
      t_layout-no_input = 'X'.
      t_layout-colwidth_optimize = 'x'.
      t_layout-info_fieldname = 'LINE_COLOR'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_INTERFACE_CHECK                 = ' '
        I_BYPASSING_BUFFER                = ' '
        I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = SY-REPID
         i_callback_top_of_page            = 'TOP'
         is_layout                         = t_layout
         IT_FIELDCAT                       = T_FIELDCAT
         i_save                            = 'X'
        TABLES
          t_outtab                          = T_OUTPUT
      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.
    Form top.
      Refresh it_top.
      wa_top-typ = 'S'.
      wa_top-key = 'Requestor'.
      wa_top-info = sy-uname.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      wa_top-typ = 'S'.
      wa_top-key = 'Program'.
      wa_top-info = sy-repid.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      wa_top-typ = 'S'.
      wa_top-key = 'Page'.
      wa_top-info = sy-pagno.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      wa_top-typ = 'S'.
      wa_top-key = 'Date'.
      wa_top-info = sy-datum.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      wa_top-typ = 'H'.
      wa_top-info = 'Project Details'.
      APPEND wa_top to it_top.
      CLEAR wa_top.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = it_top.
      ENDFORM.}

  • How to color row in ALV report?

    hi
    I am creating an ALV report using factory method.
    my report is based on itab which contain 3 coulms, 1 column is ERROR_TYPE . how can i color all the rows which contain E in error_type ???
    thanks
    Ami

    TABLES:LFA1.
    SELECT-OPTIONS:LIFNR FOR LFA1-LIFNR.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    REGIO LIKE LFA1-REGIO,
    SORTL LIKE LFA1-SORTL,
    CFIELD(4) TYPE C,
    END OF ITAB.
    data:col(4).
    data:num value '1'.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE LIFNR
    IN LIFNR.
    LOOP AT ITAB.
    concatenate 'C' num '10' into col .
    ITAB-CFIELD = col.
    num = num + 1.
    if num = '8'.
    num = '1'.
    endif.
    MODIFY ITAB.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:EVE TYPE SLIS_T_EVENT WITH HEADER LINE.
    LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    LAYOUT-WINDOW_TITLEBAR = 'VENDORS DETAILS SCREEN'.
    LAYOUT-EDIT = 'X'.
    LAYOUT-info_fieldname = 'CFIELD'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    this is for coloring cols
    REPORT ZBHCOLOR_COLS.
    TABLES:LFA1.
    SELECT-OPTIONS:C_LIFNR FOR LFA1-LIFNR. " FOR GRID ONLY
    PARAMETERS:LIST RADIOBUTTON GROUP ALV DEFAULT 'X',
    GRID RADIOBUTTON GROUP ALV.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    SORTL LIKE LFA1-SORTL,
    REGIO LIKE LFA1-REGIO,
    COL TYPE LVC_T_SCOL,
    END OF ITAB.
    DATA:COLR TYPE LVC_S_SCOL.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB.
    LOOP AT ITAB.
    IF ITAB-LIFNR IN C_LIFNR.
    COLR-FNAME = 'NAME1'.
    COLR-COLOR-COL = '5'.
    COLR-COLOR-INT = '1'.
    COLR-COLOR-INV = '0'.
    COLR-NOKEYCOL = 'X'.
    APPEND COLR TO ITAB-COL.
    COLR-FNAME = 'LIFNR'.
    APPEND COLR TO ITAB-COL.
    MODIFY ITAB.
    ENDIF.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    LAYOUT-ZEBRA = 'X'.
    layout-coltab_fieldname = 'COL'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    IF LIST = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ELSEIF GRID = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ENDIF.
    Reward points if useful.

  • Add a row after Total row in ALV report

    Hi Experts,
    I have a report is displayed by  ALV format(not use function module to display it but use Class cl_gui_custom_container),I want to add a row after the total row. for example,
    Customer   amount1    amount2    amount3 
    10000         1,234        1,000         2,000
    10001         4,000        2,000         1,000
    10002         1,300        1,000         3,000
    11000         1,200        4,000         3,000
         Total:     7,734        8,000         9,000
    Ratio%        31.27       32.34          36.39
    the row of 'Total' is calculated by fieldcat-do_sum = 'X' But after the Total row we need a Ratio row to display the ratio. Yes we can calculate the total amout and ratio and then append it into the output itab, but we don't like this solution.We want to keep the total function in the ALV report.Any experts can poit me a direction. Thanks in advance.
    Joe

    Djoe,
    First you need to handle the user command,in order to capture the button action. For this you need to implment a class, i  am attaching sample codes here
    In top include write the following code
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION .
        METHODS:
         handle_toolbar  FOR EVENT toolbar                   " To add new functional buttons to the ALV toolbar
                         OF        cl_gui_alv_grid
                         IMPORTING e_object,
         handle_user_command FOR EVENT user_command          " To implement user commands
                            OF cl_gui_alv_grid
                            IMPORTING e_ucomm .
      PRIVATE SECTION.
    ENDCLASS.                                               " Lcl_event_handler DEFINITION
    Now   <b>Class implementation</b>
    CLASS lcl_event_handler IMPLEMENTATION .
      METHOD handle_toolbar.                                " Handle Toolbar
        PERFORM f9500_handle_toolbar USING e_object.
    ENDMETHOD .                                            " Handle_toolbar
      METHOD handle_user_command .                          " Handle User Command
        PERFORM f9600_handle_user_command USING e_ucomm .
      ENDMETHOD.
    ENDCLASS .                                              " lcl_event_handler IMPLEMENTATION
    FORM f9600_handle_user_command USING p_e_ucomm TYPE sy-ucomm.
      CONSTANTS:c_newl(4) TYPE c
                          VALUE 'NEWL',               " New line
                c_copy(4) TYPE c
                          VALUE 'COPY',               " Copy
                c_corr(4) TYPE c
                          VALUE 'CORR'.               " Correction
      CASE p_e_ucomm .
        WHEN c_newl.
    Create a new line
          PERFORM f9610_insert_new_line.
    ENDFORM.                                          " f9600_handle_user_command
    FORM f9610_insert_new_line .
    *Data Declarations
      DATA: lt_rows     TYPE lvc_t_row,                 " Itab for row property
            ls_rows     TYPE lvc_s_row,                 " Work area for row
            lv_cntid    TYPE i.                         " Counter
      DATA: gv_index TYPE sy-index.
      CLEAR gs_last.
      CALL METHOD gr_alvgrid->get_selected_rows
        IMPORTING
          et_index_rows = lt_rows.
      READ TABLE lt_rows INTO ls_rows INDEX 1.
      IF sy-subrc EQ 0.
        gv_index = ls_rows-index + 1.
      ELSE.
        gv_index = 1.
      ENDIF.
      DESCRIBE TABLE gt_last LINES lv_cntid.
      lv_cntid = lv_cntid + 1.
      gs_last-cntid = lv_cntid.
      INSERT gs_last INTO gt_last INDEX gv_index.
      LOOP AT gt_last INTO gs_last FROM gv_index TO gv_index.
    Make the new line editable
        PERFORM f9611_style.
      ENDLOOP.
      CALL METHOD gr_alvgrid->refresh_table_display
        EXCEPTIONS
          finished = 1
          OTHERS   = 2.
    ENDFORM.                    " f9610_insert_new_line
    You can ask questions doubts if any!
    regards
    Antony Thomas

  • Select  mutiple rows in ALV report output

    Hi All,
    I want to select the Multiple records i in ALV report output with out holding the CNTL(Control Key).
    Is there any options in Layout?
    Please let me know
    regards,
    Ajay
    Edited by: Ajay reddy on May 30, 2010 3:27 PM

    Hi Ajay,
    To select several rows without Control button, if the rows are adjacent:
    - select the first and the last of the desired rows with Shift button pressed
    or
    - select a row, keep the mouse button pressed, and pass over the desired rows
    I don't know an option without Control if the rows are not adjacent.
    http://help.sap.com/saphelp_bw/helpdata/en/d1/7d9d37664e4d45e10000009b38f8cf/content.htm
    Regards,
    Paulo Carvalho

  • Set select one of the cell in subtotal row in ALV report

    Dear all,
    I have a ALV report that has subtotal amount by Vendor ID.
    I want to set the selection at vendor ID column (same row with subtotal).
    I tried both set_selected_cell() and set_current_cell() methods, the cell selected is incorrect. It doesnt seem to be able to select any cell at the same row of SUBTOTAL.
    lr_selections = ref_table->get_selections( ).
          lt_current_cell = lr_selections->get_current_cell( ).
          lt_current_cell-row = lt_current_cell-row.
          lt_current_cell-columnname = 'LIFNR'.
          lr_selections->set_current_cell( lt_current_cell ).
    Please help. Thanks.

    HP should provide tested recovery DVD every note book user. along with note book.
    That is solution
    fws1 wrote:
    I neglected to add that the system is configured exactly as from the factory, save a few added programs and user files. No hardware changes or OS up or downgrade. The hard drive was corrupted by some type of root virus and had to be fully reformatted. I did the format manually as well as let the HP Recovery disks. Same result either way. The recovery program, after the failure,  prompts user to insert a flash drive and creates some file, but HP has no info on the file creation or what to do with said file!  
    fws1 wrote:
    I neglected to add that the system is configured exactly as from the factory, save a few added programs and user files. No hardware changes or OS up or downgrade. The hard drive was corrupted by some type of root virus and had to be fully reformatted. I did the format manually as well as let the HP Recovery disks. Same result either way. The recovery program, after the failure,  prompts user to insert a flash drive and creates some file, but HP has no info on the file creation or what to do with said file!  

  • How to colour a row in alv report

    Hi
    As per our client's requirement we have to do color the column on the basis of values in the column like
    if data is more than 5000 it will show in red,if less than 5000 it will show in green in ALV  report.
    Pls give me the solution.
    Thanks&Regards.

    Hi Sahoo,
    If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
    in layout structure you will find field SEL_MODE
    pass :
    LS_LAYOUT-SEL_MODE = 'A'.
    In PAI.
      CALL METHOD GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = T_ROWS
          ET_ROW_NO     = T_ROWID.
    Hope these will solve your problem.
    Regards,
    Kumar M.

  • How to split a single column row  in alv report

    Hi All,
    I need to split a row of the particular coolumn in alv report.
    for example row size is 10 that should be split into 5 & 5.
    Thanks
    Ram

    Hi Ram,
    You can add one more column for that..
    while processing your internal table you can split the value for that column using offset..
    DATA :  FIELD_STR(10) TYPE C.
    VAR1 = FIELD_STR+0(5) .
    VAR2 = FIELD_STR+5(5) .
    Now you can print this both VAR1 and VAR2 in seperate column.
    Please search on SCN before posting any question..
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

Maybe you are looking for

  • Problem with generating xml and nested cursor (ora-600)

    I have a problem with generating xml (with dbms_xmlquery or xmlgen) and nested cursors. When I execute the following command, I get a ORA-600 error: select dbms_xmlquery.getxml('select mst_id , mst_source , cursor(select per.* , cursor(select ftm_fdf

  • Master data: maintain "Goods Issue Processing Time" in R3 and CIF it ?

    Hello, we want to use the so called GIPRT (Goods Issue Processing Time) in the APO material master (Tab: GR/GI) to schedule SNP PREQs. I can maintain the field in APO but finally I'm looking for maintaining it in the conencted R3 material master (MM0

  • REST API ACS vs ISE

    Hi all We are currently using ACS for wireless authentication. Guests register over an external Sharepoint webpage. The REST API is used to create and later delete these temporary users in ACS. Now we want to migrate to ISE. In contrast to ACS, the I

  • Show values beside Bar of a chart

    Hello world, within a chart I like to show the values beside/of the bar. Is this possible? ...and how Thank you. Ralf Müller

  • Linux Integration Services (LIS) version 4.0 available!

    We are pleased to announce the release of Linux Integration Services (LIS) version 4.0. As part of this release we have expanded the access to Hyper-V features and performance to the latest Red Hat Enterprise Linux, CentOS, and Oracle Linux version.