List Box in ALV Grid

Hi all,
    How to bring a list box in ALV Grid
Regards,
Vijayakumar
Message was edited by:
        Vijayakumar V

Hello Vijayakumar
You have to do 2 steps (inbetween creating the fieldcatalog and displaying the ALV list):
(1) Set dropdown handle in fieldcatalog, e.g.
* Set Drop-Down handle for column 'LOGSYS'
  CLEAR l_wa_fcat.
*  l_wa_fcat-drdn_field = 'DROP_DOWN_HANDLE'.
  l_wa_fcat-drdn_hndl  = c_drdn_handle_logsys.  " just a unique number
  MODIFY me->mt_fcat FROM l_wa_fcat
      TRANSPORTING drdn_hndl
    WHERE ( fieldname = 'LOGSYS' ).
(2) Register the dropdown handle, e.g.
* Set listbox for available source systems (according to
* SOM Customizing and selection on selection screen)
  CLEAR l_wa_drop.
  l_wa_drop-handle = c_drdn_handle_logsys.
  LOOP AT me->mt_rfc_check INTO l_wa_rfccheck.
    l_wa_drop-value = l_wa_rfccheck-logsys.
    APPEND l_wa_drop TO lt_drop.
  ENDLOOP.
  CALL METHOD me->mo_alvgrid->set_drop_down_table
    EXPORTING
      it_drop_down = lt_drop.
Regards
  Uwe

Similar Messages

  • Event for the List Box in ALV Grid Control

    Hello,
    I have the below urgent requirment.
    I have an ALV Grid Control built using ABAP Objects. In the grid, I have few fields and one of these fields is a List Box. Depending on the values selected, I need to enable or disable some fields. So, is there any event for the List box in ALV Grid Control.
    For ex: I have 2 Fields, Designation and Commission. The designation field is a List Box field having 'Software Engineer' and 'Manager' as values. When I select 'Software Engineer', the commission field should be disabled. When I select 'Manager', the comission field should be enabled.
    Early reply is hightly appreciated.
    Priya

    REPORT  ZTEST1234    MESSAGE-ID ZZ                           .
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_VALID TYPE C,
          V_FLAG,
          V_DATA_CHANGE,
          V_ROW TYPE LVC_S_ROW,
          V_COLUMN TYPE LVC_S_COL,
          V_ROW_NUM TYPE LVC_S_ROID.
    DATA: OK_CODE LIKE SY-UCOMM,
          SAVE_OK LIKE SY-UCOMM,
          G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
          GS_LAYOUT TYPE LVC_S_LAYO.
    DATA:BEGIN OF  ITAB OCCURS 0,
         VBELN LIKE LIKP-VBELN,
         POSNR LIKE LIPS-POSNR,
         COMISN(10),
         CELLCOLOR TYPE LVC_T_SCOL, "required for color
         DROP(20),
        <b> HANDLE_STYLE TYPE LVC_T_STYL,</b>
         END OF ITAB.
    *       CLASS lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
    **Hot spot Handler
        HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                          IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
    <b>**Handler to Check the Data Change
        HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
                             OF CL_GUI_ALV_GRID
                             IMPORTING ER_DATA_CHANGED
                                       E_ONF4
                                       E_ONF4_BEFORE
                                       E_ONF4_AFTER,</b>
    **Double Click Handler
        HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                         IMPORTING E_ROW E_COLUMN ES_ROW_NO.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *Handle Hotspot Click
      METHOD HANDLE_HOTSPOT_CLICK .
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW_ID.
        V_COLUMN = E_COLUMN_ID.
        V_ROW_NUM = ES_ROW_NO.
        MESSAGE I000 WITH V_ROW 'clicked'.
      ENDMETHOD.                    "lcl_event_handler
    *Handle Double Click
      METHOD  HANDLE_DOUBLE_CLICK.
      ENDMETHOD.                    "handle_double_click
    <b>**Handle Data Change
      METHOD HANDLE_DATA_CHANGED.
        DATA: X_CHANGE TYPE LVC_S_MODI,
                X_FINAL TYPE ITAB,
                L_FLAG,
                LS_OUTTAB LIKE LINE OF ITAB.
        DATA: LS_EDIT TYPE LVC_S_STYL,
              LT_EDIT TYPE LVC_T_STYL.
        LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO X_CHANGE.
          IF X_CHANGE-FIELDNAME = 'DROP' AND X_CHANGE-VALUE = 'S/W ENGINEER'.
            LS_EDIT-FIELDNAME = 'COMISN'.
            LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            LS_EDIT-STYLE2 = SPACE.
            LS_EDIT-STYLE3 = SPACE.
            LS_EDIT-STYLE4 = SPACE.
            LS_EDIT-MAXLEN = 8.
            INSERT LS_EDIT INTO TABLE LT_EDIT.
            INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
            MODIFY ITAB INDEX X_CHANGE-ROW_ID FROM LS_OUTTAB  TRANSPORTING
                                              HANDLE_STYLE .
          else.
            LS_EDIT-FIELDNAME = 'COMISN'.
            LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
            LS_EDIT-STYLE2 = SPACE.
            LS_EDIT-STYLE3 = SPACE.
            LS_EDIT-STYLE4 = SPACE.
            LS_EDIT-MAXLEN = 8.
            INSERT LS_EDIT INTO TABLE LT_EDIT.
            INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
            MODIFY ITAB INDEX X_CHANGE-ROW_ID FROM LS_OUTTAB  TRANSPORTING
                                              HANDLE_STYLE .
          ENDIF.
        ENDLOOP.
        CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
          EXCEPTIONS
            FINISHED = 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.
      ENDMETHOD.                    "HANDLE_DATA_CHANGED</b>
    ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
    *&             Global Definitions
    DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
                G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
    *- Fieldcatalog for First and second Report
    DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
          X_FIELDCAT TYPE LVC_S_FCAT,
          LS_VARI  TYPE DISVARIANT.
    *                START-OF_SELECTION
    START-OF-SELECTION.
      SELECT VBELN
             POSNR
             FROM LIPS
             UP TO 20 ROWS
             INTO CORRESPONDING FIELDS OF TABLE ITAB.
    END-OF-SELECTION.
      IF NOT ITAB[] IS INITIAL.
        CALL SCREEN 100.
      ELSE.
        MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
      ENDIF.
    *&      Form  CREATE_AND_INIT_ALV
    *       text
    FORM CREATE_AND_INIT_ALV .
      DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
      CREATE OBJECT G_CUSTOM_CONTAINER
             EXPORTING CONTAINER_NAME = G_CONTAINER1.
      CREATE OBJECT G_GRID
             EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
    * Set a titlebar for the grid control
      CLEAR GS_LAYOUT.
      GS_LAYOUT-GRID_TITLE = TEXT-003.
       <b>GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.</b>
      GS_LAYOUT-ZEBRA = SPACE.
      GS_LAYOUT-CWIDTH_OPT = 'X'.
      GS_LAYOUT-NO_ROWMARK = 'X'.
      GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
    <b>  CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.</b>
      CREATE OBJECT G_HANDLER.
      SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
    <b>  SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.</b>
      DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
      DATA: L_INDEX TYPE SY-TABIX.
      "Here i am changing the color of line 1,5,10...
      "so you can change the color of font conditionally
      LOOP AT ITAB.
        L_INDEX = SY-TABIX.
        IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
          LS_CELLCOLOR-FNAME = 'VBELN'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
          LS_CELLCOLOR-FNAME = 'POSNR'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
        ENDIF.
      ENDLOOP.
    * setting focus for created grid control
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL = G_GRID.
    * Build fieldcat and set editable for date and reason code
    * edit enabled. Assign a handle for the dropdown listbox.
      PERFORM BUILD_FIELDCAT.
      PERFORM  SET_DRDN_TABLE.
    * Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
    **Vaiant to save the layout
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
    **Calling the Method for ALV output
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          IS_VARIANT           = LS_VARI
          IS_LAYOUT            = GS_LAYOUT
          I_SAVE               = 'A'
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = ITAB[].
    * Set editable cells to ready for input initially
      CALL METHOD G_GRID->SET_READY_FOR_INPUT
        EXPORTING
          I_READY_FOR_INPUT = 1.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
    *       text
    *      -->PT_EXCLUDE text
    FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      DATA LS_EXCLUDE TYPE UI_FUNC.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_fieldcat
    *       Fieldcatalog
    FORM BUILD_FIELDCAT .
      DATA: L_POS TYPE I.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
      X_FIELDCAT-FIELDNAME = 'VBELN'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-HOTSPOT = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Item'(025).
      X_FIELDCAT-FIELDNAME = 'POSNR'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
      X_FIELDCAT-FIELDNAME = 'DROP'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      X_FIELDCAT-EDIT = 'X'.
      X_FIELDCAT-DRDN_HNDL = '1'.
      X_FIELDCAT-DRDN_ALIAS = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Comissn'(025).
      X_FIELDCAT-FIELDNAME = 'COMISN'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-EDIT = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
    ENDFORM.                    " build_fieldcat
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF G_CUSTOM_CONTAINER IS INITIAL.
    **Initializing the grid and calling the fm to Display the O/P
        PERFORM CREATE_AND_INIT_ALV.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  SET_DRDN_TABLE
    *       text
    FORM SET_DRDN_TABLE.
      DATA:LT_DRAL TYPE LVC_T_DRAL,
            LS_DRAL TYPE LVC_S_DRAL.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  'S/W Engineer'.
      LS_DRAL-INT_VALUE =  'S/W Engineer'.
      APPEND LS_DRAL TO LT_DRAL.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  'Manager'.
      LS_DRAL-INT_VALUE =  'Manager'.
      APPEND LS_DRAL TO LT_DRAL.
    **Setting the Drop down table for Reason Code
      CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
        EXPORTING
          IT_DROP_DOWN_ALIAS = LT_DRAL.
    ENDFORM.                               " set_drdn_table
    Regards
    vijay

  • List box in alv grid control  through slis and reuse_alv grid_display metho

    hello,
    i want to display list box in one column of alv by slis method.can u suggest me how to do it?
    neon

    Hi,
    plz check below code :
    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.
    *initialisation event
    INITIALIZATION.
    *Start of selection event
    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.
    set pf-status 'xxx'.
    set titlebar 'MAIN100'.
    Subroutine to display the output in alv
      PERFORM alv_output.
    ENDMODULE.                    "pbo OUTPUT
    PAI module of the screen created. In case we use an interactive ALV or
    *for additional functionalities we can create OK codes and
    based on the user command we can do the coding.
          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'.
    *drdn-hndl = '1' is the first list box
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.
    *drdn-hndl = '2' 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
    reference : wiki.

  • Handling list box in alv

    hai all
    please check the code and tell how i can call in both open and close sales orders
    NAME = 'CATEGORY'.
      VALUE-KEY = 'OPEN'.
      VALUE-TEXT = 'OPEN'.
      APPEND VALUE TO LIST.
      VALUE-KEY = 'CLOSE'.
      VALUE-TEXT = 'CLOSE'.
      APPEND VALUE TO LIST.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          ID     = NAME
          VALUES = LIST.

    Reported to SCN Moderators for multiple postings:
    handling list box in alv
    The specified item was not found.
    pk

  • How to get check box in alv grid list output

    hi gurus,
    can anyone inform me
    how to get check box in alv output it should not be a pop up window
    thank you
    regards
    kals.

    or
    hi go through the fallowing code.
    code*&----
    *& Report YGS_ALV_BOM *
    REPORT YGS_ALV_BOM .
    TABLES : MAST,STKO,STPO.
    TYPE-POOLS: SLIS.
    TYPES : BEGIN OF TY_MAST,
    CHECK_BOX,
    MATNR TYPE MAST-MATNR,
    WERKS TYPE MAST-WERKS,
    STLAN TYPE MAST-STLAN,
    STLNR TYPE MAST-STLNR,
    STLAL TYPE MAST-STLAL,
    END OF TY_MAST.
    TYPES : BEGIN OF TY_STKO,
    STLTY TYPE STKO-STLTY,
    STLNR TYPE STKO-STLNR,
    STLAL TYPE STKO-STLAL,
    STKOZ TYPE STKO-STKOZ,
    BMENG TYPE STKO-BMENG,
    BMEIN TYPE STKO-BMEIN,
    END OF TY_STKO.
    TYPES : BEGIN OF TY_STPO,
    LIGHTS,
    STLTY TYPE STPO-STLTY,
    STLNR TYPE STPO-STLNR,
    STLKN TYPE STPO-STLKN,
    STPOZ TYPE STPO-STPOZ,
    IDNRK TYPE STPO-IDNRK,
    MENGE TYPE STPO-MENGE,
    MEINS TYPE STPO-MEINS,
    END OF TY_STPO.
    DATA : IT_MAST TYPE TABLE OF TY_MAST,
    WA_MAST TYPE TY_MAST,
    IT_STKO TYPE TABLE OF TY_STKO,
    WA_STKO TYPE TY_STKO,
    IT_STPO TYPE TABLE OF TY_STPO,
    WA_STPO TYPE TY_STPO.
    DATA : lt_fieldcat TYPE slis_t_fieldcat_alv,
    ls_layout TYPE slis_layout_alv,
    ls_event TYPE slis_alv_event,
    lt_event TYPE slis_t_event,
    it_sortinfo type slis_t_sortinfo_alv,
    ls_header TYPE slis_listheader,
    lt_header TYPE slis_t_listHEADER.
    DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    SELECT-OPTIONS : S_MATNR FOR MAST-MATNR.
    START-OF-SELECTION.
    PERFORM GET_DATA.
    PERFORM BUILD_FIELDCAT USING LT_FIELDCAT.
    PERFORM BUILD_LAYOUT.
    END-OF-SELECTION.
    PERFORM DISPLAY_DATA.
    *& Form GET_DATA
    text
    --> p1 text
    <-- p2 text
    form GET_DATA .
    REFRESH : IT_MAST.
    SELECT MATNR
    WERKS
    STLAN
    STLNR
    FROM MAST
    INTO CORRESPONDING FIELDS OF TABLE IT_MAST
    WHERE MATNR IN S_MATNR.
    endform. " GET_DATA
    *& Form BUILD_FIELDCAT
    text
    --> p1 text
    <-- p2 text
    form BUILD_FIELDCAT USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    REFRESH : LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 1.
    L_FIELDCAT-FIELDNAME = 'MATNR'.
    L_FIELDCAT-TABNAME = 'IT_MAST'.
    L_FIELDCAT-REF_FIELDNAME = 'MATNR'.
    L_FIELDCAT-REF_TABNAME = 'MAST'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 2.
    L_FIELDCAT-FIELDNAME = 'WERKS'.
    L_FIELDCAT-TABNAME = 'IT_MAST'.
    L_FIELDCAT-REF_FIELDNAME = 'WERKS'.
    L_FIELDCAT-REF_TABNAME = 'MAST'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 3.
    L_FIELDCAT-FIELDNAME = 'STLNR'.
    L_FIELDCAT-TABNAME = 'IT_MAST'.
    L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
    L_FIELDCAT-REF_TABNAME = 'MAST'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    endform. " BUILD_FIELDCAT
    *& Form BUILD_LAYOUT
    text
    --> p1 text
    <-- p2 text
    form BUILD_LAYOUT .
    CLEAR LS_LAYOUT.
    LS_LAYOUT-BOX_FIELDNAME = 'CHECK_BOX'.
    LS_LAYOUT-BOX_TABNAME = 'IT_MAST'.
    endform. " BUILD_LAYOUT
    *& Form DISPLAY_DATA
    text
    --> p1 text
    <-- p2 text
    form DISPLAY_DATA .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    I_STRUCTURE_NAME =
    IS_LAYOUT = LS_LAYOUT
    IT_FIELDCAT = LT_FIELDCAT
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    t_outtab = IT_MAST
    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_DATA
    FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
    SET PF-STATUS 'YSTATUS' OF PROGRAM SY-REPID
    EXCLUDING RT_EXTAB.
    ENDFORM.
    FORM USER_COMMAND USING RF_UCOMM TYPE SY-UCOMM
    SELFIELD TYPE SLIS_SELFIELD.
    CASE RF_UCOMM.
    WHEN '&NEXT'.
    PERFORM GET_DATA_BOM .
    PERFORM BUILD_FIELDCAT_BOM USING LT_FIELDCAT.
    PERFORM BUILD_LAYOUT_BOM.
    PERFORM DISPLAY_DATA_BOM.
    ENDCASE.
    ENDFORM.
    *& Form GET_DATA_BOM
    text
    --> p1 text
    <-- p2 text
    form GET_DATA_BOM .
    CLEAR : WA_STPO,
    WA_MAST.
    REFRESH : IT_STPO.
    DATA : IT_CHECK TYPE TABLE OF TY_MAST.
    LOOP AT IT_MAST INTO WA_MAST.
    IF WA_MAST-CHECK_BOX EQ 'X'.
    APPEND WA_MAST TO IT_CHECK.
    ENDIF.
    ENDLOOP.
    SELECT STLTY
    STLNR
    STLKN
    VGKNT
    IDNRK
    MENGE
    MEINS
    FROM STPO
    INTO CORRESPONDING FIELDS OF TABLE IT_STPO
    FOR ALL ENTRIES IN IT_CHECK
    WHERE IDNRK EQ IT_CHECK-MATNR.
    CLEAR WA_STPO.
    LOOP AT IT_STPO INTO WA_STPO.
    SELECT SINGLE * FROM MAST WHERE MATNR EQ WA_STPO-IDNRK.
    IF SY-SUBRC = 0.
    WA_STPO-LIGHTS = '2'.
    ELSE.
    WA_STPO-LIGHTS = '1'.
    ENDIF.
    MODIFY IT_STPO FROM WA_STPO.
    ENDLOOP.
    endform. " GET_DATA_BOM
    *& Form BUILD_FIELDCAT_BOM
    text
    --> p1 text
    <-- p2 text
    form BUILD_FIELDCAT_BOM USING LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    REFRESH : LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 1.
    L_FIELDCAT-FIELDNAME = 'STLTY'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'STLTY'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 2.
    L_FIELDCAT-FIELDNAME = 'STLNR'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'STLNR'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 3.
    L_FIELDCAT-FIELDNAME = 'STLKN'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'STLKN'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 4.
    L_FIELDCAT-FIELDNAME = 'IDNRK'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'IDNRK'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    L_FIELDCAT-COL_POS = 5.
    L_FIELDCAT-FIELDNAME = 'MENGE'.
    L_FIELDCAT-TABNAME = 'IT_STPO'.
    L_FIELDCAT-REF_FIELDNAME = 'MENGE'.
    L_FIELDCAT-REF_TABNAME = 'STPO'.
    APPEND L_FIELDCAT TO LT_FIELDCAT.
    endform. " BUILD_FIELDCAT_BOM
    *& Form BUILD_LAYOUT_BOM
    text
    --> p1 text
    *<-- p2 text
    form BUILD_LAYOUT_BOM .
    CLEAR : LS_LAYOUT.
    LS_LAYOUT-LIGHTS_FIELDNAME = 'LIGHTS'.
    LS_LAYOUT-LIGHTS_TABNAME = 'IT_STPO'.
    endform. " BUILD_LAYOUT_BOM
    *& Form DISPLAY_DATA_BOM
    text
    --> p1 text
    <-- p2 text
    form DISPLAY_DATA_BOM .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND_BOM'
    I_CALLBACK_TOP_OF_PAGE = 'TOP9'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = 'ALV_BACKGROUND'
    I_GRID_TITLE =
    I_GRID_SETTINGS =
    IS_LAYOUT = LS_LAYOUT
    IT_FIELDCAT = LT_FIELDCAT
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IT_ALV_GRAPHICS =
    IT_HYPERLINK =
    IT_ADD_FIELDCAT =
    IT_EXCEPT_QINFO =
    I_HTML_HEIGHT_TOP =
    I_HTML_HEIGHT_END =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    t_outtab = IT_STPO
    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_DATA_BOM
    FORM TOP9 .
    CLEAR LS_HEADER.
    REFRESH LT_HEADER.
    LS_HEADER-TYP = 'H'.
    LS_HEADER-INFO = 'BILL OF MATERIALS'.
    APPEND LS_HEADER TO LT_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = LT_HEADER
    I_LOGO = 'ENJOYSAP_LOGO'
    I_END_OF_LIST_GRID =
    ENDFORM.
    FORM USER_COMMAND_BOM USING RF_UCOMM_BOM LIKE SY-UCOMM
    SEL_FIELD TYPE SLIS_SELFIELD.
    CASE RF_UCOMM_BOM.
    WHEN '&IC1'.
    SET PARAMETER ID 'MAT' FIELD WA_STPO-IDNRK.
    SET PARAMETER ID 'WRK' FIELD WA_MAST-WERKS.
    SET PARAMETER ID 'CSA' FIELD WA_MAST-STLAN.
    CALL TRANSACTION 'CS03' AND SKIP FIRST SCREEN.
    ENDCASE.[/code]

  • How to create command button called 'Remarks' and Check box in ALV GRID?

    Hi, Experts,
    Requirement is: in the ALVE GRID report output, user select a record by clicking the check box and pressing the button 'Remarks' it will take me into other transaction from the output list.
    Please help me out.
    Reward points.
    Sekhar

    Hi Chandra Shekar,
    Check the following sample program. 2 things to remember.
    1. Check the callback subroutine PF_STATUS_SET and create PF status for the program.and also ur REMARKS button in the application tool. Comments are made every where wherever those are needed. After creating Pf status execute the report.
    2.Once you select records by selecting checkboxes, u have to press on Refresh button( that is there on application toolbar), then only for selected records, CHECK field in the internal is updated. After that press on REMARKS button .
      REPORT zvenkat_alv_grid.
      TABLES:t001.
      "Types
      TYPES:
            BEGIN OF t_1001,
              check TYPE c,
              bukrs TYPE t001-bukrs,
              butxt TYPE t001-butxt,
              ort01 TYPE t001-ort01,
              land1 TYPE t001-land1,
            END OF t_1001.
      "Work area
      DATA:
            w_t001 TYPE t_1001.
      "Internal table
      DATA:
            i_t001 TYPE STANDARD TABLE OF t_1001.
      " 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_events.
        PERFORM build_layout.
        PERFORM list_display.
    *&      Form  get_data
      FORM get_data .
        SELECT bukrs
               butxt
               ort01
               land1
          FROM t001
          INTO CORRESPONDING FIELDS OF TABLE i_t001
          UP TO 30 ROWS.
      ENDFORM.                    " get_data
    *&      Form  build_fieldcatlog
      FORM build_fieldcatlog .
        CLEAR:w_fieldcat,i_fieldcat[].
        PERFORM build_fcatalog USING:
                 'CHECK' 'I_T001' ' ',
                 'BUKRS' 'I_T001' 'BUKRS',
                 'BUTXT' 'I_T001' 'BUTXT',
                 'ORT01' 'I_T001' 'ORT01',
                 'LAND1' 'I_T001' 'LAND1'.
      ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  BUILD_FCATALOG
      FORM build_fcatalog USING l_field l_tab l_text.
        w_fieldcat-fieldname      = l_field.
        w_fieldcat-tabname        = l_tab.
        w_fieldcat-seltext_m      = l_text.
        IF  l_field = 'CHECK'..
          w_fieldcat-checkbox = 'X'.
          w_fieldcat-edit     = 'X'.
        ENDIF.
        APPEND w_fieldcat TO i_fieldcat.
        CLEAR w_fieldcat.
      ENDFORM.                    " build_fieldcatlog
    *&      Form  build_events
    *       text
      FORM build_events.
        CLEAR :
              w_events, i_events[].
        w_events-name = 'TOP_OF_PAGE'."Event Name
        w_events-form = 'TOP_OF_PAGE'."Callback event subroutine
        APPEND w_events TO i_events.
        CLEAR  w_events.
        w_events-name = 'USER_COMMAND' .
        w_events-form = 'USER_COMMAND' .
        APPEND w_events TO i_events.
        CLEAR w_events.
        w_events-name = 'PF_STATUS_SET' .
        w_events-form = 'PF_STATUS_SET' .
        APPEND w_events TO i_events.
        CLEAR w_events.
      ENDFORM.                    "build_events
    *&      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
            it_events          = i_events
          TABLES
            t_outtab           = i_t001
          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
    *&      Form  top_of_page
      FORM top_of_page.
        DATA :
         li_header TYPE slis_t_listheader,
         w_header  LIKE LINE OF li_header.
        DATA:
              l_date TYPE char10.
        WRITE sy-datum TO l_date.
        w_header-typ  = 'H'.
        CONCATENATE sy-repid ':' 'From Date' l_date INTO w_header-info SEPARATED BY space.
        APPEND w_header TO li_header.
        CLEAR w_header.
        w_header-typ  = 'S'.
        w_header-info = sy-title.
        APPEND w_header TO li_header.
        CLEAR w_header.
        w_header-typ  = 'A'.
        w_header-info = sy-uname.
        APPEND w_header TO li_header.
        CLEAR w_header.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            it_list_commentary = li_header.
      ENDFORM.                    "top_of_page
    *&      Form  pf_status_set
      FORM pf_status_set    USING extab TYPE slis_t_extab.
        "Procedure to set own pf-status.
        "1.Goto Transaction code SE41
        "2.give program = SAPLKKBL and status = STANDARD_FULLSCREEN.
        "3.Click on Application toolbar STATUS button
        "4.Give ur program name Status name that is to be used in the program using SET pf-status statement
        "5.Create ur button REMARKS.
        SET PF-STATUS 'STATUS1' EXCLUDING extab.
      ENDFORM.                    "pf_status_set
    *&      Form  user_command
      FORM user_command USING ucomm LIKE sy-ucomm
                        selfield TYPE slis_selfield.
        CASE ucomm .
          WHEN 'REMARKS'."When u click on remarks button.
            LOOP AT i_t001 INTO w_t001 WHERE check = 'X'.
              WRITE :/ w_t001-bukrs, 'Checked'.
            ENDLOOP.
        ENDCASE.
      ENDFORM.                    "user_command
    I hope that it helps u .
    Regards,
    Venkat.O

  • Check Boxes in ALV Grid

    Hi,
    I want to display an ALV grid/ list report with a check box at the begining of each row.
    I want to select some or all check boxes.
    Based on the selection, i need to perform some action (like z table update).
    Can u plz send the sample code to meet this requirement.
    Thanks

    Hi..
    I had developed this code long time it uses container and its working
    *& Report  ZHR_REPT_EMP_NOT_PBOOKED
    *& Program title:    List of employees who have not done Pre-Booking and
    *                     Provision to send E mail to such employees
    *& Description:      To display a list of emloyees in report and then sending mails to them
    REPORT  ZHR_REPT_EMP_NOT_PBOOKED.
    TYPE-POOLS slis.
    *-----------tables
    TABLES: pernr,
            pa0001,
            hrp1001,
            hrp1000,
            zodtab,
            zcstab,
            zsbutab.
    *-----------Infotypes
    INFOTYPES :0001,  "org assignment,
               1001,
               1000,
               0105.
    TYPES : BEGIN OF i_conf,
              checkbox ,
              pernr TYPE pa0001-pernr,                  "personnel Number.
              ename TYPE pa0001-ename,                  "Name of Employee.
              zzbtc TYPE pa0001-zzbtc,                  "Band.
              btrtl  TYPE pa0001-btrtl,                 "Grade
              Location type string,
              persk type string,
              ptext type string,
              werks TYPE p0001-werks,
              zzod_txt type string,                         "OD name
              zzod type pa0001-zzod,
              zzcs type string,                         "cluster/sector
              vertical type string,
              sbu LIKE pa0001-zzsbu,                    "SBU
              sbutxt LIKE zsbutab-zsbutxt,              "SBUTXT
              orgeh LIKE pa0001-orgeh,                  "Vertical
              org_text type string,
              zzbloc LIKE pa0001-zzbloc,                "base location
              dept_loc type string,                     "dept loc
              ename_s LIKE pa0001-ename,                "Department
              zztc LIKE pa0001-zztc,
              endda type p0001-endda,
             celltab type lvc_t_styl,
            END OF i_conf.
    DATA : it_conf TYPE STANDARD TABLE OF i_conf WITH HEADER LINE,
           wa_conf TYPE i_conf.
    *data: begin of gs_outtab.
    *data: checkbox type c.                "field for checkbox
    ** §B1.Extend your output table by a field to dis- or enable
    **     cells for input.
    *data: celltab type lvc_t_styl.        "field to switch editability
    *        include structure i_conf.
    *data: end of gs_outtab.
    *data: gt_outtab type gs_outtab occurs 0 with header line.
    *& DATA DECLARATION FOR EMAIL
    DATA: docdata    TYPE sodocchgi1,
          objpack    TYPE STANDARD TABLE OF sopcklsti1 WITH HEADER LINE,
          objhead    TYPE STANDARD TABLE OF solisti1   WITH HEADER LINE,
          objtxt     TYPE STANDARD TABLE OF solisti1   WITH HEADER LINE,
          objbin     TYPE STANDARD TABLE OF solisti1   WITH HEADER LINE,
          reclist    TYPE STANDARD TABLE OF somlreci1  WITH HEADER LINE.
    DATA: tab_lines  TYPE sy-tabix.
    DATA : p_1001 TYPE TABLE OF p1001 WITH HEADER LINE.
    DATA : p_0001 TYPE TABLE OF p0001 WITH HEADER LINE.
    DATA : p_0105 TYPE TABLE OF p0105 WITH HEADER LINE.
    DATA : od TYPE p0001-zzod.
    DATA : new_pernr type p0001-pernr.
    DATA : pernr_s type p0001-pernr.
    DATA : email_s type p0105-USRID_LONG.
    DATA : email type p0105-USRID_LONG.
    DATA : tc_name type string.
    DATA : tc_num type string.
    DATA : emails type string.
    DATA : sel_all type string.
    DATA: REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA : flag type i.
    DATA : title TYPE string.
    DATA : pernr_temp tYPE p0001-pernr.
    DATA : rel type string.
    DATA : stat type string.
    DATA : count type i.
    DATA :   v_dynnr type sy-dynnr.
    DATA : g_grid  type ref to cl_gui_alv_grid.
    DATA : g_custom_container type ref to cl_gui_custom_container,
          g_container type scrfname value 'CC'.
    *************field cat********************************
    DATA:  fieldcat TYPE  lvc_t_fcat,
           wa_fieldcat LIKE LINE OF fieldcat.
    DATA:  gd_layout TYPE lvc_s_layo,
          gd_repid TYPE sy-repid.
    DATA:gt_events TYPE slis_t_event,
          gt_list_top_of_page TYPE slis_t_listheader.
    DATA rec_fetched TYPE sy-tabix.
    CONSTANTS g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    SELECTION-SCREEN BEGIN OF  BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:   s_zzod    FOR   zsbutab-zod       NO INTERVALS ,
                      s_btrtl  FOR   pa0001-btrtl     NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK b1.
    start-of-selection.
      if pn-begda is initial.
        pn-begda = '18000101'.
      endif.
      if pn-endda is initial.
        pn-begda = '99991230'.
      endif.
      clear : it_conf,it_conf[].
    get pernr.
      clear new_pernr.
      move pernr-pernr to new_pernr.
    **************checking whether employee has booked or prebooked for any event****************
      clear: p_1001,p_1001[].
      perform read_info tables p_1001 using  new_pernr '1' 'B027' .
      IF SY-SUBRC <> 0.
        clear: p_1001,p_1001[].
        perform read_info tables p_1001 using  new_pernr '1' 'B023' .
        IF SY-SUBRC <> 0.
          clear: p_1001,p_1001[].
          perform read_info tables p_1001 using  new_pernr '2' 'B027' .
          IF SY-SUBRC <> 0.
            clear: p_1001,p_1001[].
            perform read_info tables p_1001 using  new_pernr '2' 'B023' .
            IF SY-SUBRC <> 0.
              clear : p_0001,p_0001[].
              CALL FUNCTION 'HR_READ_INFOTYPE'
                EXPORTING
                  pernr           = new_pernr
                  infty           = '0001'
                  BEGDA           = pn-begda
                  ENDDA           = pn-endda
                TABLES
                  infty_tab       = p_0001
                EXCEPTIONS
                  infty_not_found = 1
                  OTHERS          = 2.
              sort p_0001 descending by begda.
              read table p_0001 index 1.
              move p_0001-pernr to wa_conf-pernr.
              move p_0001-ename to wa_conf-ename.
              move p_0001-zzbtc to wa_conf-zzbtc.
              move p_0001-btrtl to wa_conf-btrtl.
              move p_0001-werks to wa_conf-werks.
              move p_0001-zzsbu to wa_conf-sbu.
              move p_0001-orgeh to wa_conf-orgeh.
              move p_0001-zzbloc to wa_conf-zzbloc.
              move p_0001-zztc to wa_conf-zztc.
              move p_0001-zzod to wa_conf-zzod.
              move p_0001-endda to wa_conf-endda.
              move p_0001-btrtl to wa_conf-btrtl.
    ***************clustor txt**********************
              select single zcstxt into wa_conf-zzcs from zcstab
                                                    where  zcs = p_0001-zzcs
                                                    and zod = p_0001-zzod.
    ***********operating division*******************************
              select single ZODLTXT into  wa_conf-zzod_txt from zodtab
                                                 where zod = wa_conf-zzod.
    ***********sbu txt***************************************************************
              select single zsbutxt into wa_conf-sbutxt from zsbutab
                                            where zsbu = wa_conf-sbu.
    ***********location**************************************
              select single btext into wa_conf-location from t001p
                                                 where  btrtl = wa_conf-btrtl
                                                 and werks = wa_conf-werks.
    ***********Dept*********************************************
              select single orgtx into wa_conf-org_text from t527x
                                                  where sprsl = 'EN'
                                                  and orgeh = wa_conf-orgeh
                                                  and  begda <= p_0001-begda
                                                  and endda >= p_0001-begda.
    ***************grade******************************************
              SELECT SINGLE ptext FROM t503t INTO  wa_conf-persk
                                              WHERE sprsl = 'EN'
                                              AND persk = p_0001-persk .
    ********************vertical*****************************
    select single zverttxt into wa_conf-vertical from zvtab
                                 where zvert = p_0001-zzvert.
    ********deputation location******************
      if p_0001-ZZDEPFLG = 'X'.
         select single zdltxt into wa_conf-dept_loc from zdltab where zdl = p_0001-zzdploc.
    endif.
    ***get imm superior
              CALL FUNCTION 'ZHR_GET_IMMMED_SUPERIOR'
               EXPORTING
                 pernr     =  new_pernr
    *          begda     = '18000101'
    *          endda     = '99991231'
               IMPORTING
                 v_pernr   = pernr_s
               EXCEPTIONS
                 not_found = 1
                 OTHERS    = 2.
              if sy-subrc = 0.
    ** find the email of the immed. superiors personal number..
                clear : p_0001,p_0001[].
                CALL FUNCTION 'HR_READ_INFOTYPE'
                  EXPORTING
                    pernr           = pernr_s
                    infty           = '0001'
                    BEGDA           = pn-begda
                    ENDDA           = pn-endda
                  TABLES
                    infty_tab       = p_0001
                  EXCEPTIONS
                    infty_not_found = 1
                    OTHERS          = 2.
                read table p_0001 index 1.
                move p_0001-ename to wa_conf-ename_s.
              endif.
              if wa_conf-btrtl in s_btrtl and wa_conf-zzod in s_zzod .
                append wa_conf to it_conf.
              endif.
            endif.
          endif.
        endif.
      endif.
      clear wa_conf.
    end-of-selection.
       if it_conf[] is initial.
          MESSAGE i501(zmod).
          exit.
          endif.
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'USER'.
    *  SET TITLEBAR 'xxx'.
      if g_custom_container is  initial.
        data: lt_exclude type ui_functions.
        create object g_custom_container
          EXPORTING
            container_name = g_container.
        create object g_grid
          EXPORTING
            i_parent = g_custom_container.
        perform fieldcat_build .
    * Exclude all edit functions in this example since we do not need them:
        perform exclude_tb_functions changing lt_exclude.
    *  perform build_data.
    *§ B3.Use the layout structure to aquaint additional field to ALV.
        gd_layout-stylefname = 'CELLTAB'.
        PERFORM build_layout.
        if it_conf[] is initial.
    *      MESSAGE i501(zmod).                    "No data exists
        else.
          call method g_grid->set_table_for_first_display
            EXPORTING
              is_layout            = gd_layout
              it_toolbar_excluding = lt_exclude
            CHANGING
              it_fieldcatalog      = fieldcat
              it_outtab            = it_conf[].
    *  create object g_event_receiver.
    *  set handler g_event_receiver->catch_doubleclick for g_grid.
    * Set editable cells to ready for input initially
          call method g_grid->set_ready_for_input
            EXPORTING
              i_ready_for_input = 1.
        endif.
      endif.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *call screen 100.
    *&      Form  build_layout
    FORM build_layout.
      CLEAR gd_layout.
      v_dynnr = 100.
      gd_layout-cwidth_opt = 'X'.
    *  gd_layout-zebra      = 'X'.
    *  gd_layout-grid_title = text-002.
    ENDFORM.                    "build_layout
    *&      Form  exclude_tb_functions
    *       text
    *      -->PT_EXCLUDE text
    form exclude_tb_functions changing pt_exclude type ui_functions.
      data ls_exclude type ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
      append ls_exclude to pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
      append ls_exclude to pt_exclude.
    endform.                    "exclude_tb_functions
    *&      Form  field_cat
    *       text
    FORM fieldcat_build .
      wa_fieldcat-fieldname  = 'CHECKBOX'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      wa_fieldcat-checkbox   = 'X'.
      wa_fieldcat-edit   = 'X'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'PERNR'.
      wa_fieldcat-coltext = 'P.S. No'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ENAME'.
      wa_fieldcat-coltext = 'Employee Name'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ZZBTC'.
      wa_fieldcat-coltext = 'Band'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'PERSK'.
      wa_fieldcat-coltext = 'Grade'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ZZOD'.
      wa_fieldcat-coltext = 'OD Name'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ZZCS'.
      wa_fieldcat-coltext = 'Cluster / Sector '.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
       wa_fieldcat-fieldname  = 'VERTICAL'.
      wa_fieldcat-coltext = 'Vertical'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'SBUTXT'.
      wa_fieldcat-coltext = 'SBU'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ORG_TEXT'.
      wa_fieldcat-coltext = 'Dept.'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'LOCATION'.
      wa_fieldcat-coltext = 'Empl. Base Location '.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
       wa_fieldcat-fieldname  = 'DEPT_LOC'.
      wa_fieldcat-coltext = 'Empl. Deputation Location '.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ENAME_S'.
      wa_fieldcat-coltext = 'IS Name '.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
    endform.                    "field_cat
    *&      Form  check_lock
    *       text
    *      -->PS_OUTTAB  text
    *      -->P_LOCKED   text
    form check_lock using    ps_outtab type i_conf
                    changing p_locked.
      data ls_celltab type lvc_s_styl.
      loop at ps_outtab-celltab into ls_celltab.
        if ls_celltab-fieldname = 'CHECKBOX'.
          if ls_celltab-style eq cl_gui_alv_grid=>mc_style_disabled.
            p_locked = 'X'.
          else.
            p_locked = space.
          endif.
        endif.
      endloop.
    endform.                    "check_lock
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
      IF sy-ucomm = 'EMAIL'.
        clear it_conf.
    *    CALL METHOD g_grid->refresh_table_display.
        data: ls_outtab type i_conf.
        data: l_valid type c,
              l_locked type c.
    *§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
    *       you must check the input cells.
    * If all entries are ok, ALV transferes new values to the output
    * table which you then can modify.
        call method g_grid->check_changed_data
          IMPORTING
            e_valid = l_valid.
        if l_valid eq 'X'.
          loop at it_conf  into ls_outtab.
            if     not ls_outtab-checkbox is initial
               and not ls_outtab-checkbox eq '-'.
    ***************************sending mail to employee and his/her superior************************************
              select single  sachn  telnr  into (tc_name , tc_num) from t526
             where SACHX = it_conf-zztc
             and werks = it_conf-werks .
    *   ******find the emil of employee.
              clear : p_0105,p_0105[].
              CALL FUNCTION 'HR_READ_INFOTYPE'
                EXPORTING
                  pernr           = ls_outtab-pernr
                  infty           = '0105'
                  BEGDA           = pn-begda
                  ENDDA           = pn-endda
                TABLES
                  infty_tab       = p_0105
                EXCEPTIONS
                  infty_not_found = 1
                  OTHERS          = 2.
              if sy-subrc = 0.
                read table p_0105 with key subty = '0010'.
                move p_0105-USRID_LONG to email.
              endif.
    ** find immediate superior by Z FM.
              clear pernr_s.
              CALL FUNCTION 'ZHR_GET_IMMMED_SUPERIOR'
                EXPORTING
                  pernr     = ls_outtab-pernr
                IMPORTING
                  v_pernr   = pernr_s
                EXCEPTIONS
                  not_found = 1
                  OTHERS    = 2.
              if sy-subrc = 0.
    ** find the email of the immed. superiors personal number..
                clear : p_0105,p_0105[].
                CALL FUNCTION 'HR_READ_INFOTYPE'
                  EXPORTING
                    pernr           = pernr_s
                    infty           = '0105'
                    BEGDA           = pn-begda
                    ENDDA           = pn-endda
                  TABLES
                    infty_tab       = p_0105
                  EXCEPTIONS
                    infty_not_found = 1
                    OTHERS          = 2.
                read table p_0105 with key subty = '0010'.
                move p_0105-USRID_LONG to email_s.
              endif.
              if email <> ' '.
                count = 1.
                perform send_mail using ls_outtab-ename email email_s tc_name tc_num count .
              endif.
              if email_s <> ' '.
                count = 2.
                perform send_mail using ls_outtab-ename email email_s tc_name tc_num count.
              endif.
              call method g_grid->refresh_table_display.
              modify it_conf  from ls_outtab.
            endif.
          endloop.
          call method g_grid->refresh_table_display.
        endif.
        set screen 100.
      endif.
    ***************************end of sending mail*****************************************************
      IF sy-ucomm = 'SELECT'.
    * CALL METHOD g_grid->refresh_table_display.
    *§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
    *       you must check the input cells.
    * If all entries are ok, ALV transferes new values to the output
    * table which you then can modify.
        call method g_grid->check_changed_data
          IMPORTING
            e_valid = l_valid.
        if l_valid eq 'X'.
          loop at it_conf into ls_outtab.
            perform check_lock using    ls_outtab
                               changing l_locked.
            if l_locked is initial
               and not ls_outtab-checkbox eq '-'.
              ls_outtab-checkbox = 'X'.
            endif.
            modify it_conf from ls_outtab.
          endloop.
          call method g_grid->refresh_table_display.
        endif.
        set screen 100.
      endif.
      IF sy-ucomm = 'BCK'  and v_dynnr = 100.
        clear v_dynnr.
        set screen 1000.
        leave screen.                                           " 0."1000.
    **call selection-screen 1000.
    *call screen 1000.
      endif.
      IF sy-ucomm = 'EXIT'  and v_dynnr = 100.
        clear v_dynnr.
        leave program.
      endif.
      IF sy-ucomm = 'CANC'  and v_dynnr = 100.
        clear v_dynnr.
        leave program.
      endif.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  send_mail
    *       text
    *      -->EMAIL_S    text
    *      -->EMAIL      text
    *      -->TC_NAME    text
    *      -->TC_NUM     text
    form send_mail using  ename email email_s tc_name tc_num count.
    *  *Body of mail
      CLEAR objtxt.
      CLEAR objtxt[].
      objtxt = text-005.
      concatenate objtxt ename into objtxt separated by space.
      append objtxt.
      clear objtxt.
      objtxt = text-006.
      concatenate objtxt email_s into objtxt separated by space.
      append objtxt.
      clear objtxt.
      append objtxt.
      objtxt = text-002.
      append objtxt.
      clear objtxt.
      objtxt = text-003.
      append objtxt.
      clear objtxt.
      append objtxt.
      objtxt = text-004.
      concatenate objtxt tc_name 'at' tc_num into objtxt separated by space.
      append objtxt.
      clear objtxt.
      DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
    *Mail description
      CLEAR docdata.
      docdata-doc_size  = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
      docdata-obj_name  = 'Reminder'.
      docdata-obj_descr = 'REMINDER TO DO PRE-BOOKING'.
      docdata-obj_langu = sy-langu.
    *Packing list for main document
      CLEAR objpack.
      CLEAR objpack[].
      objpack-head_start = 1.
      objpack-head_num   = 0.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'RAW'.
      APPEND objpack.
    *Email receiver's list
      CLEAR reclist.
      CLEAR reclist[].
      if count = 1.
    *  reclist-receiver = 'email address'."put email add here
        reclist-receiver = email.
      else.
        reclist-receiver = email_s.
      endif.
      reclist-rec_type = 'U'.
      APPEND reclist.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = docdata
          document_type              = 'RAW'
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          object_content             = objtxt
          receivers                  = reclist
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          DOCUMENT_TYPE_NOT_EXIST    = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR            = 5
          X_ERROR                    = 6
          ENQUEUE_ERROR              = 7
          OTHERS                     = 8.
      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.                    "send_mail
    *&      Form  eventtab_build
    FORM eventtab_build USING rt_events TYPE slis_t_event.
    *Registration of events to happen during list display
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = rt_events.
      READ TABLE rt_events WITH KEY name = slis_ev_top_of_page INTO ls_event.
      IF sy-subrc = 0.
        MOVE g_top_of_page TO ls_event-form.
        APPEND ls_event TO rt_events.
      ENDIF.
    ENDFORM.                    "eventtab_build
    *&      Form  top_of_page
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_list_top_of_page.
    ENDFORM.                    "top_of_page
    *&      Form  COMMENT_BUILD
    FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
      DATA: ls_line TYPE slis_listheader,
              rp_date TYPE string.              "report date
    * LIST HEADING LINE: TYPE H
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = text-007.
      APPEND ls_line TO lt_top_of_page.
      CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum(4) INTO rp_date SEPARATED BY '.'.
    * STATUS LINE: TYPE S
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = text-008.
      ls_line-info = rp_date.
      APPEND ls_line TO lt_top_of_page.
    ENDFORM.                    "comment_build
    *&      Form  read_info
    *       text
    *      -->P_1001     text
    *      -->PERNR      text
    *      -->STAT       text
    *      -->REL        text
    form read_info tables p_1001 using  pernr stat rel.
      CALL FUNCTION 'RH_READ_INFTY_1001'
        EXPORTING
          AUTHORITY        = 'DISP'
          WITH_STRU_AUTH   = 'X'
          PLVAR            = '01'
          OTYPE            = 'P'
          OBJID            = pernr
          ISTAT            = stat
          SUBTY            = rel
          BEGDA            = pn-begda
          ENDDA            = pn-endda
        TABLES
          I1001            = p_1001
        EXCEPTIONS
          NOTHING_FOUND    = 1
          WRONG_CONDITION  = 2
          WRONG_PARAMETERS = 3
          OTHERS           = 4.
    endform.                    "read_info
    *&      Module  BACK  INPUT
    *       text
    MODULE BACK INPUT.
      IF SY-UCOMM = 'E'.
        leave program.
      endif.
      IF SY-UCOMM = 'ENDE'.
        leave program.
      endif.
      IF SY-UCOMM = 'ECAN'.
        leave program.
      endif.
    ENDMODULE.                 " BACK  INPUT
    regards
    vivek

  • Problem with check box in ALV Grid Display

    I am Displaying Material Master Data in ALV Grid Display with Check Box for each record and if i checked check box then i am processing Update operation in Database,  my question is after perform update operation check box should be clear.
    Kindly help me!!!!

    Hello Raj
    Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
    In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    * define local data
      DATA: ls_outtab  LIKE LINE OF gt_outtab,
                ld_idx       TYPE i.
      LOOP AT gt_outtab INTO ls_outtab
                     WHERE ( chkbox = 'X' ).
        ld_idx = syst-tabix.
        " Call your update function / method / perform
       ls_outtab-chkbox = space.
       MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
          TRANSPORTING chkbox.
      ENDLOOP.
    " And now trigger refresh of the ALV display:
      rs_selfield-refresh = 'X'.  " <<< !!!
    ENDFORM.
    Regards
      Uwe

  • Check box in ALV grid gets unselected for new selection

    Hi all,
    This is my code :
    TYPE-POOLS : slis.
    Variable
    DATA: g_repid LIKE sy-repid,
          g_title TYPE lvc_title,
          g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
          g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
          g_layout TYPE slis_layout_alv,
          g_print_alv TYPE slis_print_alv,
          g_variant LIKE disvariant,
          c_char_a(1) VALUE 'A',
          c_char_x(1) VALUE 'X',
          itab_alv_sort TYPE slis_t_sortinfo_alv,
          itab_alv_fcat TYPE slis_t_fieldcat_alv,
          fm_name type rs38l_fnam," Function Module Name
    *      l_sfctrlparams LIKE ssfctrlop, " Form Print Parameter
    *      l_sfoutopt LIKE ssfcompop,
          pri_params LIKE pri_params,
          c_x type c .
    *       Internal tables          Begin with IT_                       *
    DATA : it_fcat TYPE SLIS_T_FIELDCAT_ALV,                           "---ALV
           it_disp type table of ZLOI.
    *       Work Area for Internal tables      Begin with WA_             *
    data : wa_fcat TYPE slis_fieldcat_alv ,              "---ALV
           wa_layout           TYPE lvc_s_layo,               "---ALV
           wa_it_disp like line of it_disp.
    *       Objects                                                       *
    DATA : cref TYPE REF TO cl_gui_custom_container,          "---ALV
           gref TYPE REF TO cl_gui_alv_grid.                  "---ALV
    *        Start-of-selection
    Start-of-selection.
      perform fetch_po_det.
      perform build_fcat.
      perform alv_display.
    *&      Form  FETCH_PO_DET
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_PO_DET .
      data : it_po type table of crmd_orderadm_h,
               wa_po like line of it_po,
               wa_header type BBP_PDS_PO_HEADER_D.
      select  guid
              object_id
              DESCRIPTION
              POSTING_DATE
              CREATED_BY
      from crmd_orderadm_h
      into corresponding fields of table it_po
      where object_type = 'BUS2201'.
      loop at it_po into wa_po.
        move wa_po-object_id to wa_it_disp-ZZPONO.
        move wa_po-DESCRIPTION to wa_it_disp-ZZPODESC.
        move wa_po-posting_date to wa_it_disp-ZZPODATE.
        move wa_po-created_by to wa_it_disp-ZZPOCREATOR.
        CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
          EXPORTING
            I_OBJECT_ID = wa_it_disp-zzpono
          IMPORTING
            E_HEADER    = wa_header.
        move wa_header-total_value to wa_it_disp-ZZPOVAL.
        move wa_header-currency to wa_it_disp-ZZPOCUR.
        append wa_it_disp to it_disp.
      endloop.
    *  write : wa_it_disp-zzpono.
    ENDFORM.                    " FETCH_PO_DET
    *&      Form  BUILD_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM BUILD_FCAT .
      g_repid = sy-repid.
      g_title = 'LOI details'.
      g_print_alv-no_print_listinfos = 'X'.
      g_variant-report = sy-repid.
      g_variant-variant = sy-title.
      CLEAR g_layout.
      g_layout-f2code = ' '.
      wa_layout-zebra       = 'X'.
      g_layout-flexible_key = 'X'.
      g_layout-colwidth_optimize = 'X'.
      g_layout-detail_initial_lines = 'X'.
      g_layout-box_fieldname = 'ZZCHECK'.
    *g_layout-box_tabname = 'ITAB_REPORT'.
    *Check box
      wa_fcat-fieldname = 'ZZCHECK'.
      wa_fcat-checkbox = 'X'.
      wa_fcat-outputlen = '1'.
      wa_fcat-col_pos = '1'.
      wa_fcat-edit = '1'.
      wa_fcat-seltext_m = 'No'.
      append wa_fcat to it_fcat.
    *Po no
      clear wa_fcat.
      wa_fcat-fieldname = 'ZZPONO' .
    wa_fcat-tabname = 'IT_DISP'.
    *  wa_fcat-seltext = 'Purchase Order'.
      wa_fcat-seltext_m  = 'Purchase Order'.
    *wa_fcat-seltext_s = 'Purchase Order.
    wa_fcat-icon = 'X'.
      wa_fcat-col_pos = '2'.
      wa_fcat-outputlen = 10.
      append wa_fcat to it_fcat.
    *Desc
      wa_fcat-fieldname = 'ZZPODESC' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'Description'.
      wa_fcat-seltext_m = 'Description'.
    *wa_fcat-seltext_s = 'Description'.
      wa_fcat-col_pos = '3'.
      wa_fcat-outputlen = 10.
      append wa_fcat to it_fcat.
    *Postign date
      wa_fcat-fieldname = 'ZZPODATE' .
    wa_fcat-tabname = 'IT_DISP'.
    wa_fcat-seltext_l = 'Posting Date'.
      wa_fcat-seltext_m = 'Posting Date'.
    *wa_fcat-seltext_s = 'Posting Date'.
      wa_fcat-col_pos = '4'.
      wa_fcat-outputlen = 8.
      append wa_fcat to it_fcat.
    *value
      wa_fcat-fieldname = 'ZZPOVAL' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'PO value'.
      wa_fcat-seltext_m = 'PO value'.
    *wa_fcat-seltext_s = 'PO value'.
      wa_fcat-col_pos = '5'.
      wa_fcat-outputlen = 15.
      append wa_fcat to it_fcat.
    *Currency
      wa_fcat-fieldname = 'ZZPOCUR' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'PO Currency'.
      wa_fcat-seltext_m = 'PO Currency'.
    *wa_fcat-seltext_s = 'PO Currency'.
      wa_fcat-col_pos = '6'.
      wa_fcat-outputlen = 5.
      append wa_fcat to it_fcat.
    *Creator
      wa_fcat-fieldname = 'ZZPOCREATOR' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'Buyer'.
      wa_fcat-seltext_m = 'Buyer'.
    *wa_fcat-seltext_s = 'Buyer'.
      wa_fcat-col_pos = '7'.
      wa_fcat-outputlen = 12.
      append wa_fcat to it_fcat.
    ENDFORM.                    " BUILD_FCAT
    *&      Form  ALV_DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM ALV_DISPLAY .
      sort it_disp by ZZPONO.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = g_repid
         I_CALLBACK_PF_STATUS_SET          = g_set_pf_stat
         I_CALLBACK_USER_COMMAND           = g_user_command
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
          I_GRID_TITLE                      = g_title
    *   I_GRID_SETTINGS                   =
          IS_LAYOUT                         = g_layout
          IT_FIELDCAT                       = it_fcat[]
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
          IS_VARIANT                        = g_variant
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
          IS_PRINT                          = g_print_alv
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = it_disp[]
       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.                    " ALV_DISPLAY
    *&      Form  user_command
    *       text
    *      -->R_UCOMM      text
    *      -->RS_SELFIELD  text
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.                             "#EC CALLED
      CASE R_UCOMM.
        WHEN 'PRINT'.
          READ TABLE IT_disp INTO WA_IT_DISP WITH KEY ZZCHECK = 'X'.
          IF SY-SUBRC EQ 0.
            loop at it_DISP INTO WA_IT_DISP.
              CALL FUNCTION 'POPUP_TO_CONFIRM'
                EXPORTING
                  TEXT_QUESTION = 'Print the LOI details?'
                  TEXT_BUTTON_1 = 'Yes'
                  TEXT_BUTTON_2 = 'No'.
    *      IMPORTING
    *        ANSWER        = w_answer.
              IF SY-SUBRC  0.
              ENDIF.
    *          PERFORM CALL_SF.
            endloop.
          ENDIF.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          LEAVE PROGRAM.
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM.                    "user_command
    *&      Form  set_pf_status
    *       text
    *      -->RT_EXTAB   text
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
      SET TITLEBAR sy-tcode.
    ENDFORM.                    "set_pf_status
    Now in my ALV grid o/p i can  see the check box  but if i select one row and then try to slect another the first one gets deselected.
    Can anybody tell me what is missing?

    Hi,
    if you need just a check box for each line, try to get rid of this line from your layout.
    g_layout-box_fieldname = 'ZZCHECK'.
    SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
    Cheers

  • Double click on list field in ALV grid control

    Hello all,
    I developed a report with a ALV grid control. I would like to move some functionality from marking a line and pressing a button in the status line to double clicking a specific field in the output list and execute a command there (i.e. double click on PO number and go to PO display TAC then). Can anybody provide some example coding for that?
    Thanks so much for your help!
    Torsten

    Here is your sample program.  Copy this code into a z program.  Create the screen 100 with a container in it and name it "ALV_CONTAINER".  Create the gui-status with "BACK".
    report zrich_0001.
    tables: ekko.
    data: begin of i_alv occurs 0,
          ebeln type ekko-ebeln,
          end of i_alv.
    *       CLASS cl_event_receiver DEFINITION      Handles Double Click
    class cl_event_receiver definition.
      public section.
        methods handle_double_click
          for event double_click of cl_gui_alv_grid
          importing e_row e_column.
      private section.
    endclass.
    *       CLASS CL_EVENT_RECEIVER IMPLEMENTATION    Handles Double Click
    class cl_event_receiver implementation.
      method handle_double_click.
        perform drill_down using e_row-index.
      endmethod.
    endclass.
    data: alv_container  type ref to cl_gui_custom_container.
    data: event_receiver type ref to cl_event_receiver.
    data: alv_grid       type ref to cl_gui_alv_grid.
    data: layout    type lvc_s_layo.
    data: fieldcat  type lvc_t_fcat.
    selection-screen begin of block b1 with frame title text-001 .
    select-options: s_ebeln for ekko-ebeln.
    selection-screen end of block b1.
    start-of-selection.
      perform get_data.
      call screen 100.
    *      Module  status_0100  OUTPUT
    module status_0100 output.
      set pf-status '0100'.
      set titlebar '0100'.
      data: variant type  disvariant.
      variant-report = sy-repid.
      variant-username = sy-uname.
    * Create Controls
      create object alv_container
             exporting
                   container_name    = 'ALV_CONTAINER'.
      create object alv_grid
             exporting
                   i_parent          =  alv_container.
    *  Create Event Receiver
      create object event_receiver.
    *  Populate Field Catalog
      perform get_fieldcatalog.
      call method alv_grid->set_table_for_first_display
          exporting
               is_layout              = layout
               is_variant             = variant
               i_save                 = 'U'
               i_structure_name       = 'I_ALV'
          changing
               it_outtab       = i_alv[]
               it_fieldcatalog = fieldcat[].
    *   handler for ALV grid
      set handler event_receiver->handle_double_click for alv_grid.
    endmodule.
    *      Module  USER_COMMAND_0100  INPUT
    module user_command_0100 input.
      case sy-ucomm.
        when 'BACK' or 'CANC'.
          if not alv_container is initial.
            call method alv_container->free.
            clear: alv_container.
            free : alv_container.
          endif.
          if sy-subrc = 0.
            set screen 0.
            leave screen.
          else.
            leave program.
          endif.
        when 'EXIT'.
          if not alv_container is initial.
            call method alv_container->free.
            clear: alv_container.
            free : alv_container.
          endif.
          leave program.
      endcase.
    endmodule.
    * FORM GET_DATA
    form get_data.
      select * into corresponding fields of table i_alv
                from ekko
                     where ebeln in s_ebeln.
      sort i_alv ascending by ebeln.
    endform.
    *      Form  Get_Fieldcatalog - Set Up Columns/Headers
    form get_fieldcatalog.
      data: ls_fcat type lvc_s_fcat.
      refresh: fieldcat.
      clear: ls_fcat.
      ls_fcat-reptext    = 'PO Number'.
      ls_fcat-coltext    = 'PO Number'.
      ls_fcat-fieldname  = 'EBELN'.
      ls_fcat-ref_table  = 'I_ALV'.
      ls_fcat-outputlen  = '12'.
      ls_fcat-col_pos    = 1.
      append ls_fcat to fieldcat.
    endform.
    * DRILL_DOWN
    form drill_down using index.
      read table i_alv index index.
      if sy-subrc = 0.
        set parameter id 'BES' field i_alv-ebeln.
        call transaction 'ME23' and skip first screen.
        if not alv_container is initial.
          call method alv_container->free.
          clear: alv_container.
          free : alv_container.
        endif.
      endif.
    endform.
    Regards,
    Rich Heilman

  • How to add a check box in ALV Grid using SAP R/3 release 4.6b?

    Hello everyone,
    I hope you all fine.
    I'm writing because I have a requirement with ALV Grid,  what I need to do, is to insert a checkbox into a cell, I already read the forum to know how to do that, but I'm using a SAP R/3 release 4.6b, and when I execute the program the checkbox is displayed greyout,  because this release doesn't have the EDIT property into the slis_t_fieldcat_alv.
    Does any body know how to enable the checkbox cell in the ALV Grid for this release?, so it will allow the user to mark the desired rows.
    I'll really appreciate if you guys could help me to find a solution.
    Thanks for your time.
    Regards,
    Guillermo

    Hi,
    if you need just a check box for each line, try to get rid of this line from your layout.
    g_layout-box_fieldname = 'ZZCHECK'.
    SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
    Cheers

  • List header for alv grid using abap objects

    Hai all,
          I have displayed alv grid in container control using abap objects i.e. using method set_table_for_first_display.
    now i need to display list header for this alv grid.
    please help me how to create with a sample coding.
    Thanks and regards,
    Prabu S.

    Create a splitter using CL_GUI_EASY_SPLITTER_CONTAINER with a top and bottom half.  Put the alv grid in the bottom half.  Use cl_dd_document (documented in help.sap.com )  to build the header in the top half.  Use events on CL_GUI_ALV_GRID to handle the top-of-list printing.
    Or, if available, use CL_SALV_TABLE, and read the documentation on that.  When I needed a header for my report, that's what I did.  There's plenty of good documentation about if you'll search for it.
    matt

  • Check box in alv grid

    Hi Gurus,
    I developed one alv(grid) report. the grid having first three columns are with check boxes. Now my requirement  is if I tick or on tick those check boxes I need to track which records check boxes are modiried.
    But I canot tracking the  modified records . after ticking or unticking those check boxs values are not modified in intrnal table.
    plese help this is very urgent.
    Regards,
    Shashikumar.G

    Hi Kiran,
    I displayed internal table with check boxes that is ok.
    after displaying the internal table if i tick or un tick the records  those are not modified in internal table but I need to track the records which are modified.
    please give me repply urgently.
    Regards,
    Shashikumar.G

  • Re: creating check boxes in ALV grid using web dynpro

    Hi Techies,
       I need to have a check box column in alv grid, and it should allow me to select the check box and the selected row has to be updated in the database.
      Kindly assist me with the steps to handle the above mentioned scenario
    Thanks in advance.

    Now to first make the last column of my ALV as a checkbox:
    method BUILD_ALV .
      data: l_ref_cmp_usage type ref to if_wd_component_usage.
    " Instantiate the ALV usage
      l_ref_cmp_usage =   wd_This->wd_CpUse_My_Alv( ).
      if l_ref_cmp_usage->has_active_component( ) is initial.
        l_ref_cmp_usage->create_component( ).
      endif.
    " Get reference to the model
      DATA: l_ref_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
      l_ref_INTERFACECONTROLLER =   wd_This->wd_CpIfc_My_Alv( ).
      data: lr_config type ref to Cl_Salv_Wd_Config_Table.
      lr_config = l_ref_INTERFACECONTROLLER->Get_Model( ).
    |" Set read only mode to false (and display edit toolbar)
      lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).
      data: lr_table_settings type ref to if_salv_wd_table_settings.
      lr_table_settings ?= lr_config.
      lr_table_settings->set_read_only( abap_false ).
      data: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lt_columns         TYPE        salv_wd_t_column_ref,
            lr_checkbox1        TYPE REF TO cl_salv_wd_uie_checkbox,
            lr_checkbox2        TYPE REF TO cl_salv_wd_uie_checkbox.
      FIELD-SYMBOLS <fs_column> LIKE LINE OF lt_columns.
    "  Embed the UI elements within the ALV
      lr_column_settings ?= lr_config.
      lt_columns = lr_column_settings->get_columns( ).
    " Embed an checkbox within the column APPROVE
      LOOP AT lt_columns ASSIGNING <fs_column>.
        CASE <fs_column>-id.
          WHEN 'APPROVE'.
            CREATE OBJECT lr_checkbox1
              EXPORTING
                checked_fieldname = <fs_column>-id.
            <fs_column>-r_column->set_cell_editor( lr_checkbox1 ).
            FREE lr_checkbox1.
        ENDCASE.
      ENDLOOP.
    ENDMETHOD.                    "BUILD_ALV

  • List box in alv column

    Hi Experts,
       I have an requirement as follows. i ma getting the text from summary of notification.it is dispalyed in summary as four lines and it need to be displayed as same in the webdympro column i.e if summary is as follows:
    USERNAME DATE
    MATERIAL NO
    REASON FOR REPLCEMANT
    it shud be displayed as same in the  int webdynpro alv column?
    i wanted to use list box , but i couldnot find any class pertaining to list box which can be used in the ALV column.
    Can anyone plz advice me h can i cheive this...........
    Cheers,
    Madhu

    Hi,
    See the sample report in sap technical web site.
    follow this link  saptechnical com/Tutorials/ALV/Dropdown/list.htm
    YOu can also refer this sap standard report RSDEMO_TABLE_CONTROL
    Regards,
    Pravin
    Edited by: pravin s. on Sep 21, 2010 9:05 AM

Maybe you are looking for

  • Is there any way to view 2, 3, 4, etc. days beginning on any day?

    Is there any way to view 2, 3, 4, etc. days beginning on any day? In pre-Lion iCal, opt-cmd-2 displayed 2 days, opt-cmd-3 displayed 3 days, etc. The first day could be any day of your choice. With Lion iCal, if you begin in any view other than week v

  • Urgent! CL_GUI_PDFVIEWER

    Is it allowed to use class CL_GUI_PDFVIEWER???? to display and print pdf files?????

  • Calling javascript function with StageWebView problems

    I have a test html page I made to R&D some functionality, in my view I have a stageWebView and am calling a local html file from inside the app like this: stageWebView.loadURL(new File(new File('app:/assets/html/reports.html?stuff=1234').nativePath).

  • War with WAR files :-)

    HI All: I believe there are lot of issues with the current WAR file packaging which hinders its usage in many many practical scenarios. (1) Once I package an app in a WAR file, all the jars and classes inside that are merely becoming useless to exter

  • Cannot sync - BB8900 with BB Desktop Manager for Mac

    After first downloading Desktop Manager, I was able to sync with my 8900 once.  Now, every time I connect the device (via USB), Desktop Manager opens, attempts to connect to the device, and fails.  Status of the device shows at 'not connected'. I've