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

Similar Messages

  • 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

  • How to create check box in ALV Reports?

    how to create check box in ALV Reports?

    Hi
    check the report  BCALV_TEST_GRID_EDITABLE
    or
    check this report
    REPORT ZRFC346_TST.
    TABLES:SFLIGHT,RL034.
    TYPE-POOLS:SLIS.
    INCLUDE:<ICON>,<SYMBOL>.
    DATA: G_REPID          LIKE SY-REPID,
          G_FIELDCAT       TYPE SLIS_T_FIELDCAT_ALV,
          G_IT_SORT        TYPE SLIS_T_SORTINFO_ALV,
          G_LAYOUT         TYPE SLIS_LAYOUT_ALV,
          G_TABNAME_HEADER TYPE SLIS_TABNAME,
          G_TABNAME_ITEM   TYPE SLIS_TABNAME,
          G_KEYINFO        TYPE SLIS_KEYINFO_ALV,
          G_VARIANT        LIKE DISVARIANT,
          G_EXTAB          TYPE SLIS_T_EXTAB,
          I_SLIS_EXIT_BY_USER TYPE SLIS_EXIT_BY_USER.
    DATA: XEVENT         TYPE SLIS_T_EVENT,
          AEVENT         TYPE SLIS_ALV_EVENT,
          VARIANT        LIKE DISVARIANT,
          LAYOUT         TYPE SLIS_LAYOUT_ALV,
          ASP_GROUP      TYPE SLIS_SP_GROUP_ALV,
          GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
          EXTAB          TYPE SLIS_T_EXTAB WITH HEADER LINE,
          XFIELD         TYPE SLIS_T_FIELDCAT_ALV,
          AFIELD         TYPE SLIS_FIELDCAT_ALV,
          G_SUCOMM      LIKE SY-UCOMM,
          G_SELFLD       TYPE SLIS_SELFIELD.
    DATA: SAV_SY_REPID      LIKE SY-REPID.
    CONSTANTS: CON_SFLIGHT TYPE LVC_FNAME VALUE 'SFLIGHT',
               CON_DISPLAY_FULL TYPE I VALUE 3.
    Data to be displayed
    DATA: BEGIN OF GT_SFLIGHT OCCURS 0.
            INCLUDE STRUCTURE SFLIGHT.
    DATA:ACTIVATE(1).
    DATA: END OF GT_SFLIGHT.
    INITIALIZATION.
    *........Initialisierung...............................................
      PERFORM INITIALIZATION_RL034.
    *........Field cata....................................................
      PERFORM FIELD_CAT.
    *........SPECIAL GROUP.................................................
      PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
    START-OF-SELECTION.
    Selection
      SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
    *........ALV CALL.......................................................
      PERFORM ALV_CALL.
      PERFORM USER_COMMAND_LOCAL USING G_SUCOMM G_SELFLD.
          FORM USER_COMMAND_LOCAL                                       *
    -->  G_UCOMM                                                       *
    -->  G_SELFIELD                                                    *
    FORM USER_COMMAND_LOCAL USING G_UCOMM LIKE SY-UCOMM
                                  G_SELFIELD TYPE SLIS_SELFIELD.
      CASE G_UCOMM.
        WHEN 'ACT'.
      ENDCASE.
    ENDFORM.
          FORM ALV_CALL                                                 *
    FORM ALV_CALL.
    Call ABAP List Viewer (ALV)
    G_LAYOUT-BOX_FIELDNAME = 'ACTIVATE'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
                 EXPORTING
                I_BACKGROUND_ID         = 'ALV_BACKGROUND'
                   I_BYPASSING_BUFFER                = SPACE
                   I_BUFFER_ACTIVE                   = SPACE
                    I_CALLBACK_PROGRAM                = SAV_SY_REPID
                    I_CALLBACK_PF_STATUS_SET          = 'STATUS'
                   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND_LOCAL'
                I_CALLBACK_TOP_OF_PAGE            = ' '
                I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
                I_CALLBACK_HTML_END_OF_LIST       = ' '
                 I_STRUCTURE_NAME                  = 'SFLIGHT'
                I_BACKGROUND_ID                   = ' '
                I_GRID_TITLE                      =
                I_GRID_SETTINGS                   =
                  IS_LAYOUT                         = G_LAYOUT
                  IT_FIELDCAT                       = XFIELD[]
                IT_EXCLUDING                      =
                  IT_SPECIAL_GROUPS                 = GT_SP_GROUP[]
                IT_SORT                           =
                IT_FILTER                         =
                 IS_SEL_HIDE                       = 'X'
                I_DEFAULT                         = 'X'
                  I_SAVE                            = 'A'
                IS_VARIANT                        =
                 IT_EVENTS                         = XEVENT
                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_ADD_FIELDCAT                   =
                IT_HYPERLINK                      =
                I_HTML_HEIGHT_TOP                 =
                I_HTML_HEIGHT_END                 =
                IT_EXCEPT_QINFO                   =
              IMPORTING
                E_EXIT_CAUSED_BY_CALLER           =
                ES_EXIT_CAUSED_BY_USER            =
                  TABLES
                    T_OUTTAB                          = GT_SFLIGHT
              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.
          FORM status                                                   *
    -->  EXTAB                                                         *
    FORM STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STAT' EXCLUDING EXTAB.
    ENDFORM.                               " STATUS
    *&      Form  INITIALIZATION_RL034
          text
    -->  p1        text
    <--  p2        text
    FORM INITIALIZATION_RL034.
      SAV_SY_REPID = SY-REPID.
    ENDFORM.                    " INITIALIZATION_RL034
    *&      Form  DEFINE_EVENTS_RL034
          text
    -->  p1        text
    <--  p2        text
    FORM DEFINE_EVENTS_RL034.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = XEVENT.
       exceptions
            list_type_wrong = 1
            others          = 2.
    ENDFORM.                    " DEFINE_EVENTS_RL034
    *&      Form  FIELD_CAT
          text
    -->  p1        text
    <--  p2        text
    FORM FIELD_CAT.
      DATA: LS_FCAT TYPE SLIS_FIELDCAT_ALV,
            L_LIN   TYPE I.
      REFRESH XFIELD.
           1. per Default eingeblendete Felder                          *
    *........Ikone/Symbol..................................................
      CLEAR AFIELD.
      DATA: LS1_FCAT TYPE SLIS_FIELDCAT_ALV,
            L_LIN1   TYPE I.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_STRUCTURE_NAME       = CON_SFLIGHT
                I_BYPASSING_BUFFER     = SPACE
                I_BUFFER_ACTIVE        = SPACE
           CHANGING
                CT_FIELDCAT            = XFIELD
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
      DESCRIBE TABLE XFIELD LINES L_LIN1.
      ADD 1 TO L_LIN1.
      CLEAR LS_FCAT.
      LS1_FCAT-FIELDNAME = 'ACTIVATE'.
      LS1_FCAT-CHECKBOX  = 'X'.
    LS1_FCAT-KEY       = 'X'.
      LS1_FCAT-INPUT     = 'X'.
      LS1_FCAT-EDIT     = 'X'.
      LS1_FCAT-INTTYPE   = 'C'.
      LS1_FCAT-DATATYPE  = 'CHAR'.
      LS1_FCAT-INTLEN    = 1.
      LS1_FCAT-COL_POS   = L_LIN1.
      LS1_FCAT-SELTEXT_S = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SELTEXT_M = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SELTEXT_L = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SP_GROUP = 'A'.
      APPEND LS1_FCAT TO XFIELD.
      ADD 1 TO L_LIN.
    ENDFORM.                    " FIELD_CAT
    FORM E07_SP_GROUP_BUILD USING E07_LT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV.
      DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
      CLEAR  LS_SP_GROUP.
      LS_SP_GROUP-SP_GROUP = 'A'.
      LS_SP_GROUP-TEXT     = 'SPECIAL'.
      APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
    ENDFORM.
    Regards
    Shiva

  • How to create a user in UME Database using web dynpro java custom application

    Hi,
    Can you please suggest me how to create a user in UME Database using web dynpro java custom application.
    My Requirement is user can register his/her user id in SAP Portal 7.3 UME database.
    Please suggest me.
    Thanks and Regards,
    Amit

    Hi Amit,
    Generated Documentation (Untitled)
    This is what you're looking for, there's no real cook-book -- though Amey mentioned there might be some material on SDN, perhaps some tutorials.
    You should be looking into com.sap.security.api.IUserFactory, methods newUser(String) which gives you and IUserMaint and commitUser(IUserMaint, IUserAccount) -- IUserAccount can be obtained using com.sap.security.api.IUserAccountFactory, method newUserAccount(String)
    Hope it helps,
    D.

  • Creating a report in EP portal using Web Dynpro

    Hi all,
            Can anyone guide me how to create a Report in EP portal using Web Dynpro.
    Regards,
    R.V.Easter

    Hi,
    You should read the documentation ([Web Dynpro ABAP: Development in Detail|http://help.sap.com/saphelp_nw70/helpdata/en/03/0048413e466e24e10000000a155106/frameset.htm]) and study the tutorials : [Go and Create First Application with Web Dynpro ABAP|http://help.sap.com/saphelp_nw70/helpdata/en/e6/2c4b29dc87c6409d6469ec390e8f3d/frameset.htm] and [Creating a Simple Flight Info Application|http://help.sap.com/saphelp_nw70/helpdata/en/e6/2c4b29dc87c6409d6469ec390e8f3d/frameset.htm].
    Regards,
    Pierre

  • 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

  • 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

  • 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

  • How to show check box in ALV grid??

    Hi All,
         I am using an option edit in the feild catalogue which allows me to change the values in a few columns in the ALV list.
    What I want is to be able to show a check box in a few columns which user can check and use the value X in the program for the later processing....
    Can somebody tell me how to show a check box in the ALV screen in the changeable format??
    Win full point by answering this typical question..
    Thanks - Chandan

    hi go through the fallowing 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.

  • 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

  • Exporting content of ALV grid in Web Dynpro for ABAP

    Hello Experts
    I have a following request which seems to be giving some headaches.
    I need to export results from one of the Web Dynpro reports (ABAP) I have developed to the Excel spreadsheet. Results are stored on ALV component. Request is to add header to export file with additional information like report title, selection criteria, date when report has been executed. By default export file contains only column names and data. I have set the header for ALV grid with all extra information I need to be passed to Excel file but it does not seem to be transferred at all.
    At the moment I see 2 possible solutions: 1) write my own Excel export 2) use PDF export where it is possible to set header/footer text. None of these solutions are ideal, I'd rather set header in standard Excel export. Is that even possible? Please help.
    Regards
    Michael
    Edited by: Soltuion Manager on Apr 20, 2009 10:08 AM
    Edited by: Soltuion Manager on Apr 20, 2009 10:26 AM

    Hello Michael,
    I haven't tried using the builtin functionality of ALV to achieve a similar fnctionality as yours but can suggest you a workaround for that. As how you might be already knowing you can try using the CL_WD_RUNTIME_SERVICES=>attach_file_to_response to download the contents into Excel/notepad/word. So just can modify the internal table to contain the extra information that you need. You can use the approach below for using the attach_file_to_response method:
    1) First read the table's data into an internal table.
    2) Convert the internal table data to STRING format.
    3) Now convert it into tab separated format as how desired.
    4) Convert this STRING format to XSTRING format
    5) Make use of the attach_file_to_response method.
    Regards,
    Uday
    METHOD onactionon_submit .
      DATA: lv_node TYPE REF TO if_wd_context_node,
            lt_mara TYPE if_main=>elements_mara,
            wa_mara TYPE if_main=>element_mara,
            lead_selection_index TYPE i,
            mara_string  TYPE string,
            mara_xstring TYPE xstring.
      lv_node = wd_context->get_child_node( name = 'MARA' ).
      CALL METHOD lv_node->get_static_attributes_table
        IMPORTING
          table = lt_mara.
      LOOP AT lt_mara INTO wa_mara.
        CONCATENATE mara_string
                    wa_mara-matnr
                    wa_mara-ersda
                    wa_mara-ernam
                    wa_mara-matkl
                    wa_mara-meins
                    cl_abap_char_utilities=>cr_lf INTO mara_string
                                            SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      ENDLOOP.
    ** Now you need to add the column headers & the desired extra information through coding to
    ** mara_string
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text   = mara_string
        IMPORTING
          buffer = mara_xstring.
      CL_WD_RUNTIME_SERVICES=>attach_file_to_response(  i_filename  = 'TEMP.XLS'
                                                        i_content   = mara_xstring
                                                        i_mime_type = 'EXCEL' ).
    ENDMETHOD.

  • Create check box using pdfmark in postscript

    Dear all,
    We are creating check box in pdf file using pdfmark [via postscript to pdf conversion]
    We placed the below tag into the postscript and then created the pdf file.
    The check box working in acrobat professional but not working in adobe reader even after enabling the extend features in Adobe Reader.
    [ /Rect [6254 9972 6814 9480]
    /T (CB4)
    /FT /Btn
    /F 4 /H /O
    /BS << /W 1 /S /S >>
    /DA (/ZaDb 10 Tf 1 0 0 rg)
    /Subtype /Widget
    /ANN pdfmark
    Please help me on this to solve the issue.
    Regards,
    jkrishnanvenkat

    Regarding: "...but not working in adobe reader..."
    Does the check box appear on the page in the right place and looks the same as it does in Acrobat Pro 9?
    Does "not working" mean that you cannot "check" and "uncheck" the check box by clicking it?
    Are you running Acrobat Pro 9 and Adobe Reader X on the same machine, and if not, have you confirmed that the font for the check symbol is installed/available on both machines?

  • Check boxes in Data grid

    Hi,
    I have check boxes in data grid, using action script how do i get the values of check boxes that were selected ?
    Can anybody guide me here.
    <mx:DataGrid id="targetBaseAdd" width="100%" height="100%" dataProvider="
    {Application.application.ccModel.initializeBusinessUnitData.initializeBusinessUnit.baseArra y}">
     <mx:columns>
     <mx:DataGridColumn headerText="" width="20">
     <mx:itemRenderer>
     <mx:Component>
     <mx:HBox width="100%">
                    <mx:CheckBox horizontalCenter="0"/>  </mx:HBox>
     </mx:Component>
     </mx:itemRenderer>
     </mx:DataGridColumn>
     <mx:DataGridColumn headerText="Base" labelFunction="baseTargetList"/>
     </mx:columns>  
    </mx:DataGrid>
    Thank You,
    Anu.
    </mx:HBox>
     </mx:Component>
     </mx:itemRenderer>
     </mx:DataGridColumn>
     <mx:DataGridColumn headerText="Base" labelFunction="baseTargetList"/>
     </mx:columns>  
    </mx:DataGrid>
    Thank You,
    Anu.

    refer following examples:
    http://blog.flexmonkeypatches.com/2007/11/06/datagrid-checkbox-itemeditor/
    http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_23237167.ht ml

Maybe you are looking for