Selection using check box in std ALV grid!

Hi all,
I have written a custom report to show the O/p in ALV grid.
This is my code:
TABLES :zpo_loi.
TYPE-POOLS : slis.
TYPE-POOLS: icon.
TABLES : sscrfields.
DATA : ls_composer TYPE ssfcompop,
           ls_control TYPE ssfctrlop.
DATA : wa_return TYPE TABLE OF bapiret2  ,
        wa_address TYPE bapiaddr3.
DATA : wa_crmd_orderadm_h TYPE zpo_loi,
       it_po TYPE TABLE OF crmd_orderadm_h,
       wa_po TYPE bbp_pds_header.
DATA : it_tab TYPE TABLE OF zpo_loi.
DATA :  it_data TYPE TABLE OF crmd_orderadm_h,
        wa_data TYPE bbp_pds_header,
        et_data TYPE bbps_sf_po_output.
DATA : w_formname TYPE tdsfname ,
       w_sfname TYPE rs38l_fnam.
DATA :it_po_no TYPE TABLE OF select_be_obj_id,
      wa_it_po_no  LIKE LINE OF it_po_no.
DATA :r_itab TYPE ddshretval OCCURS 0.
DATA : it_output LIKE TABLE OF zloi,
       wa_output TYPE zloi.
DATA : w_answer TYPE c.
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.
*       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.
DATA : it_sf_po TYPE TABLE OF crmd_orderadm_h,
       wa_sf_po TYPE bbp_pds_header.
*SELECTION-SCREEN:
*  BEGIN OF SCREEN 500 AS WINDOW TITLE title,
*  END OF SCREEN 500.
*DATA : functxt TYPE smp_dyntxt.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS sel_po FOR zpo_loi-zobject_id.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : pr_loi RADIOBUTTON GROUP grp1 USER-COMMAND ucom,
             pr_fondo RADIOBUTTON GROUP grp1.
SELECTION-SCREEN END OF BLOCK b2.
*       At selection-screen output                                    *
AT SELECTION-SCREEN OUTPUT.
  IF pr_fondo = 'X'.
    REFRESH sel_po.
    LOOP AT SCREEN.
      IF screen-name = text-003 OR screen-name = text-004.
        screen-input = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF pr_loi = 'X'.
    LOOP AT SCREEN.
      IF screen-name = text-003 OR screen-name = text-004.
        screen-input = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
*       At selection-screen on radiobutton                            *
AT SELECTION-SCREEN ON RADIOBUTTON GROUP grp1.
  IF pr_fondo  = 'X'.
    REFRESH sel_po.
    LOOP AT SCREEN.
      IF screen-name = text-003 OR screen-name = text-004.
        screen-input = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF pr_loi = 'X'.
    LOOP AT SCREEN.
      IF screen-name = text-003 OR screen-name = text-004.
        screen-input = '1'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_po-low.
  PERFORM populate_table.
  PERFORM f4_help.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_po-high.
  PERFORM populate_table.
  PERFORM f4_help.
*       At selection-screen                                           *
AT SELECTION-SCREEN.
*---CHECKING THE INPUT >>>
  IF sy-ucomm = 'ONLI'.
    PERFORM f002-check_input.
    PERFORM f001-check.
  ENDIF.
*&      Form  POPULATE_TABLE
*       text
*  -->  p1        text
*  <--  p2        text
FORM populate_table .
  SELECT zobject_id
           description
  FROM zpo_loi
  INTO CORRESPONDING FIELDS OF TABLE it_tab.
  SORT it_tab BY zobject_id ASCENDING.
ENDFORM.                    " POPULATE_TABLE
*&      Form  F4_HELP
*       text
*  -->  p1        text
*  <--  p2        text
FORM f4_help .
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      ddic_structure = ' '
      retfield       = 'ZOBJECT_ID'
      dynpprog       = sy-repid
      dynpnr         = sy-dynnr
      dynprofield    = 'A'
      value_org      = 'S'
    TABLES
      value_tab      = it_tab
      return_tab     = r_itab.
ENDFORM.                                                    " F4_HELP
*&      Form  F001-CHECK
*       text
*  -->  p1        text
*  <--  p2        text
FORM f001-check .
  IF pr_fondo = 'X'.
    PERFORM display_expiring_fondos.
  ELSEIF pr_loi = 'X'.
    PERFORM fetch_po_det.
    PERFORM build_fcat.
    PERFORM alv_display.
  ENDIF.
ENDFORM.                    " F001-CHECK
*&      Form  F002-CHECK_INPUT
*       text
*  -->  p1        text
*  <--  p2        text
FORM f002-check_input .
  IF pr_loi = 'X'.
    REFRESH it_po.
    IF sel_po-low IS NOT INITIAL.
      SELECT object_id
      FROM crmd_orderadm_h
      INTO CORRESPONDING FIELDS OF TABLE it_po
      WHERE object_type = 'BUS2201'
      AND object_id = sel_po-low.
      IF sy-subrc NE 0.
        IF sel_po-high IS NOT INITIAL.
          SELECT object_id
          FROM crmd_orderadm_h
          INTO CORRESPONDING FIELDS OF TABLE it_po
          WHERE object_type = 'BUS2201'
          AND  object_id = sel_po-high.
          IF sy-subrc NE 0.
            MESSAGE e009(zsrm).
          ENDIF.
        ENDIF.
        MESSAGE e007(zsrm).
      ENDIF.
    ELSE.
      MESSAGE e010(zsrm).
    ENDIF.
    IF sel_po-high IS NOT INITIAL.
      SELECT object_id
      FROM crmd_orderadm_h
      INTO CORRESPONDING FIELDS OF TABLE it_po
      WHERE object_type = 'BUS2201'
      AND  object_id = sel_po-high.
      IF sy-subrc NE 0.
        MESSAGE e008(zsrm).
      ENDIF.
    ENDIF.
  ENDIF.
ENDFORM.                    " F002-CHECK_INPUT
*&      Form  FETCH_PO_DET
*       text
*  -->  p1        text
*  <--  p2        text
FORM fetch_po_det .
  REFRESH it_po.
  it_po_no[] = sel_po[].
  DATA : w_count TYPE i,
         w_lines TYPE c,
         wa_header TYPE bbp_pds_po_header_d.
  REFRESH : it_po,it_output.
  IF sel_po-high IS NOT INITIAL.
    SELECT object_id
           description
           posting_date
           created_by
    FROM crmd_orderadm_h
    INTO CORRESPONDING FIELDS OF TABLE it_po
    WHERE object_type = 'BUS2201'
    AND object_id BETWEEN sel_po-low AND sel_po-high.
  ELSE.
    SELECT object_id
           description
           posting_date
           created_by
    FROM crmd_orderadm_h
    INTO CORRESPONDING FIELDS OF TABLE it_po
    WHERE object_type = 'BUS2201'
    AND object_id = sel_po-low.
  ENDIF.
  w_lines = sy-dbcnt.
  w_count = 1.
  DO.
    IF w_count LE w_lines.
      READ TABLE it_po INTO wa_po INDEX w_count.
      MOVE wa_po-object_id TO wa_output-zzpono.
      MOVE wa_po-description TO wa_output-zzpodesc.
      MOVE wa_po-posting_date TO wa_output-zzpodate.
      MOVE wa_po-created_by TO wa_output-zzpocreator.
      CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
        EXPORTING
          i_object_id = wa_output-zzpono
        IMPORTING
          e_header    = wa_header.
      CALL FUNCTION 'BAPI_USER_GET_DETAIL'
        EXPORTING
          username = wa_output-zzpocreator
        IMPORTING
          address  = wa_address
        TABLES
          return   = wa_return.
      CLEAR wa_output-zzpocreator.
      CONCATENATE wa_address-firstname '   '  wa_address-lastname INTO wa_output-zzpocreator .
      MOVE wa_header-total_value TO wa_output-zzpoval.
      MOVE wa_header-currency TO wa_output-zzpocur.
      APPEND wa_output TO it_output.
      w_count = w_count + 1.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
ENDFORM.                    " FETCH_PO_DET
*&      Form  BUILD_FCAT
*       text
*  -->  p1        text
*  <--  p2        text
FORM build_fcat .
  g_repid = sy-repid.
  g_title = 'Print 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'.
  REFRESH it_fcat.
*Po no
  CLEAR wa_fcat.
  wa_fcat-fieldname = 'ZZPONO' .
  wa_fcat-tabname = 'IT_DISP'.
  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.
*Description
  CLEAR wa_fcat.
  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.
*Posting date
  CLEAR wa_fcat.
  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
  CLEAR wa_fcat.
  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.
  wa_fcat-no_zero = 'X'.
  APPEND wa_fcat TO it_fcat.
*Currency
  CLEAR wa_fcat.
  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
  CLEAR wa_fcat.
  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_output BY zzpono.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program       = g_repid
      i_callback_pf_status_set = g_set_pf_stat
      i_callback_user_command  = g_user_command
      i_grid_title             = g_title
      is_layout                = g_layout
      it_fieldcat              = it_fcat[]
      is_variant               = g_variant
      is_print                 = g_print_alv
    TABLES
      t_outtab                 = it_output[]
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.
  IF sy-subrc <> 0.
  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
  DATA: gd_repid LIKE sy-repid, "Exists
  ref_grid TYPE REF TO cl_gui_alv_grid.
  IF ref_grid IS INITIAL.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
        e_grid = ref_grid.
  ENDIF.
  IF NOT ref_grid IS INITIAL.
    CALL METHOD ref_grid->check_changed_data .
  ENDIF.
  rs_selfield-refresh = 'X'.
  CASE r_ucomm.
    WHEN 'PRINTLOI'.
      PERFORM call_sf.
    WHEN 'BACK'.
      CALL SELECTION-SCREEN 1000.
    WHEN 'CANCEL'.
      CALL SELECTION-SCREEN 1000.
    WHEN 'EXIT'.
      CALL SELECTION-SCREEN 1000.
  ENDCASE.
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 'ZALV' EXCLUDING rt_extab.
  SET TITLEBAR 'ZALV'.
ENDFORM.                    "set_pf_status
*&      Form  CALL_SF
*       text
*  -->  p1        text
*  <--  p2        text
FORM call_sf .
  REFRESH it_sf_po.
  LOOP AT it_output INTO wa_output WHERE zzcheck = 'X'.
    wa_sf_po-object_id = wa_output-zzpono.
    APPEND wa_sf_po TO it_sf_po.
  ENDLOOP.
  w_formname = 'ZSR_EBP_DOCU_LETTEROFINTENT1'.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = w_formname
    IMPORTING
      fm_name            = w_sfname
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.
  IF sy-subrc <> 0.
  ENDIF.
  ls_composer-tdnewid = 'X'.
  ls_control-no_dialog = 'X'.
  LOOP AT it_sf_po INTO wa_sf_po.
    CALL FUNCTION w_sfname
      EXPORTING
        control_parameters = ls_control
        output_options     = ls_composer
        wa_object          = wa_sf_po
      EXCEPTIONS
        formatting_error   = 1
        internal_error     = 2
        send_error         = 3
        user_canceled      = 4
        OTHERS             = 5.
    IF sy-subrc <> 0.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " CALL_SF
*&      Form  DISPLAY_EXPIRING_FONDOS
*       text
*  -->  p1        text
*  <--  p2        text
FORM display_expiring_fondos .
  SET PF-STATUS 'ZLOI'.
  SET TITLEBAR 'ZLOI'.
  TYPES : BEGIN OF ty_output1,
            guid TYPE bbp_guid,
            object_id TYPE crmt_object_id_db,
            description TYPE crmt_process_description,
            posting_date TYPE crmt_posting_date,
            zzfondo_dat TYPE zfondo_dat,
            created_by TYPE crmt_created_by,
           END OF ty_output1.
  DATA : it_output1 TYPE TABLE OF ty_output1,
         wa_output1 TYPE ty_output1,
          w_lines,
          w_count,
          it_fondo TYPE TABLE OF zsr_fondo,
          it_temp_fondo TYPE TABLE OF zsr_fondo,
          wa_temp_fondo TYPE zsr_fondo,
          wa_fondo TYPE zsr_fondo,
          w_diff TYPE p,
          wa_header1  TYPE bbp_pds_po_header_d.
  CONSTANTS : c_otype(8) VALUE 'BUS2201'.
  REFRESH : it_output1,it_temp_fondo,it_fondo.
  SELECT b~zzfondo_dat
         a~guid
         a~object_id
         a~description
         a~posting_date
         a~created_by
  INTO CORRESPONDING FIELDS OF TABLE it_output1
  FROM bbp_pdhsc AS b
  LEFT OUTER JOIN crmd_orderadm_h AS a ON b~guid = a~guid
  AND a~object_type = c_otype.
  LOOP AT it_output1 INTO wa_output1.
    CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
      EXPORTING
        date1            = sy-datum
        date2            = wa_output1-zzfondo_dat
      IMPORTING
        datediff         = w_diff
      EXCEPTIONS
        invalid_datetime = 1
        OTHERS           = 2.
    IF sy-subrc <> 0.
    ENDIF.
    IF w_diff <= '7'.
      wa_temp_fondo-zzpono = wa_output1-object_id.
      APPEND wa_temp_fondo TO it_temp_fondo.
    ENDIF.
  ENDLOOP.
*select the final entries for PO whose FONDO is expiring
  DESCRIBE TABLE it_temp_fondo LINES w_lines.
  w_count = 1.
  DO.
    IF w_count LE w_lines.
      READ TABLE it_temp_fondo INTO wa_temp_fondo INDEX w_count.
      IF sy-subrc = 0.
        CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
          EXPORTING
            i_object_id = wa_temp_fondo-zzpono
          IMPORTING
            e_header    = wa_header1.
        wa_fondo-zzpono = wa_temp_fondo-zzpono.
        wa_fondo-zzpodesc = wa_header1-description.
        wa_fondo-zzpodate =  wa_header1-posting_date.
        wa_fondo-zzexpdate = wa_header1-zzfondo_dat.
        wa_fondo-zzpoval = wa_header1-total_value.
        wa_fondo-zzpocur = wa_header1-currency.
        wa_fondo-zzpocreator = wa_header1-created_by.
        CLEAR : wa_address.
        REFRESH wa_return.
        CALL FUNCTION 'BAPI_USER_GET_DETAIL'
          EXPORTING
            username = wa_header1-created_by
          IMPORTING
            address  = wa_address
          TABLES
            return   = wa_return.
        CLEAR wa_fondo-zzpocreator.
        CONCATENATE wa_address-firstname '   '  wa_address-lastname INTO wa_fondo-zzpocreator .
        w_count = w_count + 1.
        APPEND wa_fondo TO it_fondo.
      ENDIF.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_structure_name = 'ZSR_FONDO'
      i_grid_title     = 'EXPIRING FONDOS'
    TABLES
      t_outtab         = it_fondo[]
    EXCEPTIONS
      program_error    = 1
      OTHERS           = 2.
  IF sy-subrc <> 0.
  ENDIF.
ENDFORM.                    " DISPLAY_EXPIRING_FONDOS
Now in my ALV grid o/p i can see the check box but if i select one row and then try to select another the first one gets deselected.
Can anybody tell me what is missing?

Hi,
Try like changing  this
insted of
g_layout-f2code = ' '.
use this
g_layout-f2code = 'DISP'. " Sets fcode for when double
and
g_layout-f2code = '&ETA'. " it will display POPUP screen
Best Regards
Ranga
Edited by: Ranga Swamy on Nov 1, 2008 11:07 PM
Edited by: Ranga Swamy on Nov 1, 2008 11:17 PM

Similar Messages

  • Check box color in alv grid

    Hi friends,
    My requirement is , i am displaying data in alv grid with check box,here i want when we select check box then that realated line should be appear in the Blue color,can any one support me , Thanku in advance

    Hi danish,
    Thanku for the reply,but i doesnt work ,can u observe this code and give me your suggestion eloborately.
      gwa_fldcat-col_pos       = 2.
      gwa_fldcat-fieldname     = 'CHK'.
      gwa_fldcat-tabname       = 'GT_FINAL'.
      gwa_fldcat-EMPHASIZE = 'C310'.
       gwa_fldcat-input        = 'X'.
      gwa_fldcat-edit          = 'X'.
      gwa_fldcat-checkbox      = 'X'.
      gwa_fldcat-just          = 'C'.
      gwa_fldcat-key           = 'X'.
      gwa_fldcat-outputlen     = 16.
      gwa_fldcat-seltext_l     = 'Selection'.
      APPEND gwa_fldcat TO git_fldcat.
      CLEAR gwa_fldcat.
    FORM build_catalog .
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-zebra             = 'CHK'.
      gs_layout-info_fieldname = 'LINE_COLOR'.
    gs_layout-box_fieldname     = 'CHK'.
      gs_layout-box_tabname       =  'GT_FINAL-CHK'.
    ENDFORM.                    " BUILD_CATALOG
    *&      Form  USER
    FORM user USING lv_okcode   LIKE sy-ucomm
                           rs_selfield TYPE slis_selfield.
    assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    CASE sy-ucomm.
    handle the code execution based on the function code encountered
      CASE lv_okcode.
    loop at gt_final where chk = 'X'.
      gt_final-line_color = 'C110' .
    endloop.
        WHEN 'EXECUTE'.
          PERFORM execute.
        WHEN 'SELECTALL'.
          PERFORM selectall.
        WHEN 'DESELCTALL'.
          PERFORM deselectall.
        WHEN 'ASCENDING'.
          PERFORM ascending.
        WHEN 'DESCENDING'.
          PERFORM descending.
      ENDCASE.
      PERFORM alv.
    ENDFORM.

  • Regard check box concept in alv grid display

    HI Friends,
            i am displaying the sales order details with check box. so my first field is checkbox. When user click on check box then he press the details icon.
            my question i need a logic for calling the tcode based on the vbeln when it is cheked.
            thanks in advance.
    Regards,
    Purna.

    hi,
    go through this program
    program bcalv_edit_05.
    Purpose:
    ~~~~~~~~
    This example shows how to use checkboxes within an ALV Grid Control.
    You learn:
    o how to define a column for editable checkboxes for an attribute
       of your list (see also remark below)
    o how to evaluate the checked checkboxes
    o how to switch between editable and non-editable checkboxes
    Important Remark
    ~~~~~~~~~~~~~~~~
    The checkbox functionality has been replaced by selection buttons
    in front of each row (field SEL_MODE of the layout structure
    set to 'A' or 'D'; when using the editable ALV Grid Control,
    these selection buttons are always visible).
    Class methods like GET_SELECTED_ROWS work only for this new
    functionality and not for checkboxes.
    Thus checkboxes should not be used for line selection but for
    a column as an additional or for an already existing attribute
    (like field SMOKER in SBOOK).
    To check program behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Try out the functions displayed in the application toolbar:
    o The first sets all checked lines to initial values.
      (see form reset_selected_entries)
    o The seconds marks all checkboxes that are input enabled
    o The third unmarks all checkboxes that are input enabled
    o To try the forth, you have to select a line first using
      the selection buttons on the left.
      The function deactivates/activates a checkbox.
    Checkboxes may be locked/unlocked using a double click on the
    checkbox cell.
    Essential steps (search for '§')
    ~~~~~~~~~~~~~~~
    This example focusses on two aspects of checkboxes in an
    editable ALV Grid Control:
    A How to integrate, set, reset and evaluate checkboxes
    B What you must do to lock particular checkboxes against input
    A) Integrate, set, reset and evaluate checkboxes
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    A1.Extend your output table by a checkbox field.
    A2.Add an entry for the checkbox in the fieldcatalog
    A3.Optionally, check checkboxes initially after selecting data.
    A4.Before you (a)set, (b)reset, (c)(de)activate or
       (d)evaluate checkboxes, you must check the input cells.
    B) Lock particular checkboxes against input
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    B1.Extend your output table by a field to dis- or enable
        cells for input.
    B2.After selecting data,
        assign a style for each row of your checkbox column.
    B3.Use the layout structure to aquaint additional field to ALV.
    B4.Switch the style to dis- or enable a cell for input
    class lcl_event_receiver definition deferred.  "for event handling
    data: ok_code like sy-ucomm,
          save_ok like sy-ucomm,
          g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',
          g_grid  type ref to cl_gui_alv_grid,
          g_custom_container type ref to cl_gui_custom_container,
          g_event_receiver type ref to lcl_event_receiver,
          gt_fieldcat type lvc_t_fcat,
          gs_layout type lvc_s_layo,
          g_max type i value 100.
    *§A1.Extend your output table by a checkbox field.
        If you do not want to lock sole checkboxes against input
        you do not need field 'celltab'.
    types: begin of gs_outtab.
    types: checkbox type c.                "field for checkbox
    §B1.Extend your output table by a field to dis- or enable
        cells for input.
    types: celltab type lvc_t_styl.        "field to switch editability
            include structure sflight.
    types: end of gs_outtab.
    data: gt_outtab type gs_outtab occurs 0 with header line.
    LOCAL CLASSES
    This local class only handles event DOUBLE_CLICK.
    Wenn the user double clicks on a checkbox cell the status of
    this cell is switched from editable to not editable and vice versa.
    class lcl_event_receiver definition.
    public section.
    methods: catch_doubleclick
             for event double_click of cl_gui_alv_grid
             importing
                e_column
                es_row_no
                sender.
    endclass.
    class lcl_event_receiver implementation.
    method catch_doubleclick.
      data: ls_outtab type gs_outtab,
            ls_celltab type lvc_s_styl.
    Function:
    Switch between 'editable' and 'not editable' checkbox.
    If the user clicked on another column there is
    nothing to do.
      if e_column-fieldname ne 'CHECKBOX'.
        exit.
      endif.
      read table gt_outtab into ls_outtab index es_row_no-row_id.
    The loop is only needed if there are other columns that
    use checkboxes. At this point the loop could be
    replaced by a READ of the first line of CELLTAB.
          loop at ls_outtab-celltab into ls_celltab.
            if ls_celltab-fieldname eq 'CHECKBOX'.
    §B4.Switch the style to dis- or enable a cell for input
             if ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
              ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
             else.
              ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
             endif.
             modify ls_outtab-celltab from ls_celltab.
            endif.
          endloop.
          modify gt_outtab from ls_outtab index es_row_no-row_id.
        call method sender->refresh_table_display.
    endmethod.
    endclass.
          MAIN                                                          *
    end-of-selection.
      call screen 100.
          MODULE PBO OUTPUT                                             *
    module pbo output.
      set pf-status 'MAIN100'.
      set titlebar 'MAIN100'.
      if g_custom_container is initial.
        perform create_and_init_alv.
      endif.
    endmodule.
          MODULE PAI INPUT                                              *
    module pai input.
      save_ok = ok_code.
      clear ok_code.
      case save_ok.
        when 'EXIT'.
          perform exit_program.
        when 'SELECT'.
          perform select_all_entries changing gt_outtab[].
        when 'DESELECT'.
          perform deselect_all_entries changing gt_outtab[].
        when 'RESET'.
          perform reset_selected_entries changing gt_outtab[].
        when 'SWITCH'.
          perform switch_activation changing gt_outtab[].
      endcase.
    endmodule.
          FORM EXIT_PROGRAM                                             *
    form exit_program.
      leave program.
    endform.
    *&      Form  BUILD_FIELDCAT
          text
         <--P_GT_FIELDCAT  text
    form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
      data ls_fcat type lvc_s_fcat.
      call function 'LVC_FIELDCATALOG_MERGE'
           exporting
                i_structure_name = 'SFLIGHT'
           changing
                ct_fieldcat      = pt_fieldcat.
    *§A2.Add an entry for the checkbox in the fieldcatalog
      clear ls_fcat.
      ls_fcat-fieldname = 'CHECKBOX'.
    Essential: declare field as checkbox and
               mark it as editable field:
      ls_fcat-checkbox = 'X'.
      ls_fcat-edit = 'X'.
    do not forget to provide texts for this extra field
      ls_fcat-coltext = text-f01.
      ls_fcat-tooltip = text-f02.
      ls_fcat-seltext = text-f03.
    optional: set column width
      ls_fcat-outputlen = 10.
      append ls_fcat to pt_fieldcat.
    endform.
    *&      Form  CREATE_AND_INIT_ALV
          text
         <--P_GT_OUTTAB  text
         <--P_GT_FIELDCAT  text
         <--P_GS_LAYOUT  text
    form create_and_init_alv.
      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 build_fieldcat changing gt_fieldcat.
    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.
      gs_layout-stylefname = 'CELLTAB'.
      call method g_grid->set_table_for_first_display
           exporting is_layout             = gs_layout
                     it_toolbar_excluding  = lt_exclude
           changing  it_fieldcatalog       = gt_fieldcat
                     it_outtab             = gt_outtab[].
      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.
    endform.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
          text
         <--P_LT_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  build_data
          text
    -->  p1        text
    <--  p2        text
    form build_data.
      data: lt_sflight type table of sflight,
            ls_sflight type sflight,
            ls_celltab type lvc_s_styl,
            lt_celltab type lvc_t_styl,
            l_index type i.
      select * from sflight into table lt_sflight up to g_max rows.
      if sy-subrc ne 0.
    generate own entries if db-table is empty so that this example
    still works
        perform generate_entries changing lt_sflight.
      endif.
    *§A3.Optionally, check checkboxes initially after selecting data.
    (Omitted in this example)
      loop at lt_sflight into ls_sflight.
        move-corresponding ls_sflight to gt_outtab.
      if gt_outtab-connid eq '400'.
        gt_outtab-checkbox = 'X'.
      endif.
        append gt_outtab.
      endloop.
    §B2.After selecting data,
       assign a style for each row of your checkbox column.
    Initially, set all checkbox cells editable.
      ls_celltab-fieldname = 'CHECKBOX'.
      ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
      loop at gt_outtab.
        l_index = sy-tabix.
        refresh lt_celltab.
        ls_celltab-fieldname = 'CHECKBOX'.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        insert ls_celltab into table lt_celltab.
        insert lines of lt_celltab into table gt_outtab-celltab.
        modify gt_outtab index l_index.
      endloop.
    endform.                               " build_data
    *&      Form  generate_entries
          text
         <--P_LT_SLFIGHT  text
    form generate_entries changing pt_slfight type standard table.
    This form is only needed for the case that there is no
    data in database table SFLIGHT.
      data: ls_sflight type sflight,
            l_month(2) type c,
            l_day(2) type c,
            l_date(8) type c.
      ls_sflight-carrid = 'LH'.
      ls_sflight-connid = '0400'.
      ls_sflight-currency = 'DEM'.
      ls_sflight-planetype = '747-400'.
      ls_sflight-seatsmax = 660.
      do 110 times.
        ls_sflight-price = sy-index * 100.
        ls_sflight-seatsocc = 660 - sy-index * 6.
        ls_sflight-paymentsum = ls_sflight-seatsocc * ls_sflight-price.
        l_month = sy-index / 10 + 1.
        do 2 times.
          l_day = l_month + sy-index * 2.
          l_date+0(4) = '2000'.
          l_date4(2) = l_month0(2).
          l_date6(2) = l_day0(2).
          ls_sflight-fldate = l_date.
          append ls_sflight to pt_slfight.
        enddo.
      enddo.
    endform.                               " generate_entries
    *&      Form  select_all_entries
          text
         <--P_GT_OUTTAB  text
    form select_all_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      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 pt_outtab 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 pt_outtab from ls_outtab.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " select_all_entries
    *&      Form  deselect_all_entries
          text
         <--P_GT_OUTTAB[]  text
    form deselect_all_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      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 pt_outtab 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 = ' '.
          endif.
          modify pt_outtab from ls_outtab.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " deselect_all_entries
    *&      Form  reset_selected_entries
          text
         <--P_GT_OUTTAB[]  text
    form reset_selected_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c.
    *§A4b. Before you set, (b)reset or 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 pt_outtab into ls_outtab.
          if     not ls_outtab-checkbox is initial
             and not ls_outtab-checkbox eq '-'.
            clear ls_outtab.
            modify pt_outtab from ls_outtab.
          endif.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " reset_selected_entries
    form switch_activation changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      data: l_valid type c,
            lt_row_no type lvc_t_roid with header line.
    *§A4c. Before you set, reset, (c)(de)activate
         or 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'.
        call method g_grid->get_selected_rows
          importing
             et_row_no     = lt_row_no[].
        loop at lt_row_no.
           read table pt_outtab into ls_outtab index lt_row_no-row_id.
           if ls_outtab-checkbox ne '-'.
             ls_outtab-checkbox = '-'.
           else.
             ls_outtab-checkbox = ' '.
           endif.
           modify pt_outtab from ls_outtab index lt_row_no-row_id.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.                               " switch_activation
    *&      Form  check_lock
          text
         -->P_LS_OUTTAB  text
         <--P_L_LOCKED  text
    form check_lock using    ps_outtab type gs_outtab
                    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
    Regards,
    Sindhu

  • How to handle check box click in ALV grid

    Hi Experts,
    I use ALV grid using FM.
    I have list of delivery note items with one custom field as check-box. When I check the checkbox, all other lines related to the same delivery note should be automaticaly checked.
    Is there any event or function code, where I can handle single click to checkbox?
    Thanks&regards, 
    Jirka

    HI
    you can use following code in user command function .
    DATA :BEGIN OF IT_MAINDATA OCCURS 0,
          MAINDATA(1),
          IT_RD1(1),
    END OF IT_MAINDATA.
    data: V_INDEX TYPE I.
    DESCRIBE TABLE itab LINES LINE.
      DO. " line times.
        READ LINE SY-INDEX FIELD VALUE Iitab-RD1.
        IF SY-SUBRC NE 0. EXIT. ENDIF.
        CHECK V_INDEX > 0.
        CHECK itab-RD1 = 'X'.
        MODIFY itab INDEX V_INDEX.
        IT_MAINDATA-IT_RD1 = Iitab-RD1.
      ENDDO.
    i think is work.
    regards,
    Abhi

  • Regarding enabled check box's in alv grid display

    hi ,
    in alv output i have three fields i have enabled check boxes of  this three field  i want to display the out put of them
    could u please explain clearly with code

    Hi,
    Go to Se38 --> Input BCALV_EDIT* and press F4. You can find many demo program with chekbox in ALV.
    Thanks,
    Sriram Ponna.

  • H ow we use check boxes in report

    how we use check boxes in report(alv,intrective)

    Hi,
    In the basic list we will display the Check box, once the check box is clicked then the recrod information should be displayed in the secondary list. so we will give the Check box for every reocrd then what ever we select the checkboxes. then we shoild provide the info of those records
    Reports with checkbox
    Regards
    Sudheer

  • "Always Use Selected Format" check box in line items report

    Hi Experts,
    I have an issue in ECC 6.0.
    From the transaction code FBL1N (Vendor Line Items) I am trying to export the report to spreadsheet by selecting the option  List> Export>Spreadsheet  then I have selected "Always Use Selected Format" check box.  But if I execute the same report again I am not getting this option "Always Use Selected Format". Please let me how can we retrieve that option. Is there any possibility to get that option again either functionally or technically. I would like to know all the possible ways to get this option again.
    Please do the needful.

    Hello,
    In one my thread Mr. Frank has replied as follows. I believe he has solved this.
    Hope this may be really helpful.
    The problem with the spreadsheet download is at one point, users have selected their default file type.
    That said, SAPGUI is working as it should. (gui710)
    Question though is how do we reset the values so they get the ?Select Spreadsheet Format? popup again.
    The following steps should be performed :
    - Call transaction SE38, enter program SALV_BS_ADMIN_MAINTAIN, and press F8.
    - Follow the parameters below :
    - Select ?DELETE? on the Actions Group
    - Select ?DETAILED SELECTION? on the General Data :
    - On Client - your number
    - User : <user name>
    -Hit EXECUTE.
    -Press ENTER on the POPUP
    - If there is an entry in the report that will need to be deleted. Also, make sure that the entry you will delete (for the user) has a value of GUI_ALV_XML_VER on field ?Parameter? .
    - Select the line and hit the DELETE icon .
    - Press ?Y? to continue delete. Press ENTER on the popup.
    - Then EXIT all the way out of the program.
    NOTE : When you run program SALV_BS_ADMIN_MAINTAIN, make sure they are out of any program that they are using for download.
    Re: "Always Use Selected Format" check box in line items report
    Regards,
    Ravi
    Edited by: Ravi Sankar Venna on May 15, 2009 2:31 PM

  • Enable to select a check box in ALV while accessing it through portal

    Hi All,
    Currently I have given a link on portal to run a transaction code. The output of the program is ALV report, where user any select the check boxes.
    Now when I try to select a check box, it is not getting selected. I click on the checkbox, the tick appear and then the screen refreshes itself and the tick goes off. This is happening only when accessing it through portal. If i run the program in R/3 directly, I am able to select the check box.
    Please advice on this.
    Thanks
    Namit

    Reported to SAP for the same.

  • How to add check box in the ALV list

    dear Experts,
                 i have a requirement.
    i want show the check boxes in my ALV list.
    can u please give the solution.
    thanks

    TYPE-POOLS: slis.
    *---internal tables
    DATA: BEGIN OF it_flight OCCURS 0,
    SEL, " add a single character field in the final output table
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight,
    *--internal tables for alv
    it_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fcat LIKE LINE OF it_fieldcat,
    layout TYPE slis_layout_alv,
    it_sort type slis_t_sortinfo_alv,
    wa_sort like line of it_sort.
    DATA: BEGIN OF it_flight_sel OCCURS 0,
    SEL,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight_sel.
    data: wa_flight like it_flight.
    In the layout set give the name of the field
    whose checkbox will be created ( SEL as it has 1 char only )
    layout-box_fieldname = 'SEL'.
    *---start-of-selection .
    START-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'IT_FLIGHT'
    i_inclname = sy-repid
    CHANGING
    ct_fieldcat = it_fieldcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2.
    *----get data
    SELECT carrid
    connid
    fldate
    seatsmax
    seatsocc
    FROM sflight
    INTO CORRESPONDING FIELDS OF TABLE it_flight
    UP TO 20 ROWS.
    wa_fcat-do_sum = 'X'.
    MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
    WHERE fieldname = 'SEATSOCC' .
    wa_sort-fieldname = 'CARRID'.
    wa_sort-group = 'UL'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    wa_sort-fieldname = 'CONNID'.
    wa_sort-subtot = 'X'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    is_layout = layout
    it_fieldcat = it_fieldcat
    it_sort = it_sort
    TABLES
    t_outtab = it_flight
    EXCEPTIONS
    program_error = 1.
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
    WHEN '&IC1'.
    Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
    Read data table, using index of row user clicked on
    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    Set parameter ID for transaction screen field
    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    Sxecute transaction ME23N, and skip initial data entry screen
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
    WHEN '&IC1'. "'&DATA_SAVE'. "user presses SAVE
    loop at it_flight into wa_flight.
    if wa_flight-Sel EQ 'X'.
    collecting records in table it_flight_sel to process further
    append wa_flight to it_flight_sel.
    clear wa_flight.
    TYPE-POOLS: slis.
    *---internal tables
    DATA: BEGIN OF it_flight OCCURS 0,
    SEL, " add a single character field in the final output table
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight,
    *--internal tables for alv
    it_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fcat LIKE LINE OF it_fieldcat,
    layout TYPE slis_layout_alv,
    it_sort type slis_t_sortinfo_alv,
    wa_sort like line of it_sort.
    DATA: BEGIN OF it_flight_sel OCCURS 0,
    SEL,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight_sel.
    data: wa_flight like it_flight.
    In the layout set give the name of the field
    whose checkbox will be created ( SEL as it has 1 char only )
    layout-box_fieldname = 'SEL'.
    *---start-of-selection .
    START-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'IT_FLIGHT'
    i_inclname = sy-repid
    CHANGING
    ct_fieldcat = it_fieldcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2.
    *----get data
    SELECT carrid
    connid
    fldate
    seatsmax
    seatsocc
    FROM sflight
    INTO CORRESPONDING FIELDS OF TABLE it_flight
    UP TO 20 ROWS.
    wa_fcat-do_sum = 'X'.
    MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
    WHERE fieldname = 'SEATSOCC' .
    wa_sort-fieldname = 'CARRID'.
    wa_sort-group = 'UL'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    wa_sort-fieldname = 'CONNID'.
    wa_sort-subtot = 'X'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    is_layout = layout
    it_fieldcat = it_fieldcat
    it_sort = it_sort
    TABLES
    t_outtab = it_flight
    EXCEPTIONS
    program_error = 1.
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
    WHEN '&IC1'.
    Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
    Read data table, using index of row user clicked on
    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    Set parameter ID for transaction screen field
    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    Sxecute transaction ME23N, and skip initial data entry screen
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
    WHEN '&IC1'. "'&DATA_SAVE'. "user presses SAVE
    loop at it_flight into wa_flight.
    if wa_flight-Sel EQ 'X'.
    collecting records in table it_flight_sel to process further
    append wa_flight to it_flight_sel.
    clear wa_flight.
    Please follow the code.

  • How to use check box in flash 8?

    How to use check box in flash 8?

    If you want it to happen when someone clicks the checkbox, then you need to add a listener for that event.
    var cbListener:Object = new Object();
    cbListener.click = function (evt:Object) {
        if (cb.selected) {
              gotoAndStop(2);
    cb.addEventListener("click", cbListener);
    (Note: "cb" and "cbListener" are names that were made up for this example.  They could be anything you want to name them)

  • How to disbale a group of checkboxes when i select one check box WEBDYNPRO

    Hi Friends,
    Can any body help me how to disbale a group of checkboxes when i select one check box WEBDYNPRO Abap
    Also can any body tell me how to handle chain endchain type of scenario in WEBDYNPRO Abap
    Thank you..
    Sai

    Hi
    In the context tab , create 2 context attributes ca_attr1 and ca_attr2   of type WDY_BOOLEAN under a context node cn_node
    now in ur Layout , bind the ENABLE property of CheckBoxGroup UI Element with this attribute ca_attr1
    bind the ENABLE property of CheckBox UI Element with this attribute ca_attr2
    create a action for ur Checkbox , for the OnToggle property of ur checkbox
    in OnactionToggle , check if ca_attr2 is 'X' , set ca_attr2 to ' ' ( for disable)
    this can be done by code wizard , press control +f7 and use read/set context attributes , use get_attribute and set_attribute methods
    // if ca_attr2 is 'X'
    DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
        DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
        DATA ls_cn_node TYPE wd_this->element_cn_node .
        DATA lv_attr  LIKE ls_city-ca_attr2.
        lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
    *   get element via lead selection
        lo_el_cn_node = lo_nd_cn_node->get_element(  ).
    *   get single attribute
        lo_el_cn_node->get_attribute(
          EXPORTING
            name =  `CA_ATTR2`
          IMPORTING
            value = lv_attr ).
    // if lv_attr2 is 'X' , use set_attribute method for ca_attr1
    IF lv_Attr EQ 'X' .
    DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
        DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
        DATA ls_cn_node TYPE wd_this->element_cn_node .
        DATA lv_attr  LIKE ls_city-ca_attr.
    *   navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
        lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
    *   get element via lead selection
        lo_el_cn_node = lo_nd_cn_node->get_element(  ).
    *   set single attribute
        lo_el_cn_node->set_attribute(
          EXPORTING
            name =  `CA_ATTR1`
            value = ' ').
    ENDIF.
    regards,
    amit

  • Cell wise and row wise check box in oops alv

    Normally column wise check box are possible in oops alv but how to possible check box in first row only in oops alv and Cell wise check box in oops alv?

    Hi,
    Try like changing  this
    insted of
    g_layout-f2code = ' '.
    use this
    g_layout-f2code = 'DISP'. " Sets fcode for when double
    and
    g_layout-f2code = '&ETA'. " it will display POPUP screen
    Best Regards
    Ranga
    Edited by: Ranga Swamy on Nov 1, 2008 11:07 PM
    Edited by: Ranga Swamy on Nov 1, 2008 11:17 PM

  • Use check box for report and form

    Hi Expert,
    I try to use check box to select multiple rows in a report and then click on a button to go to a form on another page to choose some values from the form and then do a mass update for records selected in reports.
    I read the "How to Work with Check Boxes" in 2 Day Developer guide, it works fine to select mutiple rows in report and do update with process in that report page.
    However, if I click on a button to go to another page which contains a form, seems the values stored in the package array are cleared and not passed to that page.
    Do you know how I could make this work?
    Thanks a lot,
    Jessie

    Hello Sakti,
    I am also in ECC6.0 & if i see the definition of the BAdI BADI_TAX1_XTXIT_SET, "Multiple Use" checkbox is checked! What are you trying to do - trying to create an implementation?
    @Prabhu: Although the BAdI is "multiple-use", but there is not filter applied to it. Next time do your checks properly before replying
    BR,
    Suhas

  • Uncheck one check box when we select other check boxes

    Hi All,
    This might be very simple question for experts. I just want to unselect one check box (this check box is to select 'ALL' and this will be selected by default) when we select any other check box (for individual categories) on same region. Can any one please suggest me how to implement this?
    Thanks in advance.
    Regards,
    Hari

    Hi Shijesh,
    Thanks for you reply.
    I'm using two items (check boxs), like P1_ALL and P1_TEST. I want to unselect P1_ALL when we select P1_TEST check box.Both the check boxes contains single value in List of values. For this I wrote script like
    <script type="text/javascript">
    function uncheckAll(pthis)
    elm = document.getElementsByName('P1_ALL');
    if(pthis.checked)
    elm.checked = false;
    </script>
    And in HTML form element attribute of P1_TEST, I have 'onclick=uncheckAll(this)'. But for some reason when I select 'P1_TEST', P1_ALL check box not getting un-selected.
    I would be grateful if you suggest what needs to correct in this one.
    Regards,
    Hari

  • How to display another window by using Check box

    Hi Friends,
    I have one doubt in Webdynpro with java. How to display another window by using Check box?
    For Exam My requirement is I am getting BAPI from ECC System. So I have to go given input details in first view and output details in Second View. So in Second View I will taken Table that data will displayed in rows. each and every row first check box is available.
    Here Select Check Box of particular row then click Edit button. That row data will be displayed in one popup window.
    empid, name, sal ,firstname, last Name
    empid, name, sal ,firstname, last Name
    empid, name, sal ,firstname, last Name
    Suppose I have to select check box in First Row Click on EDIT button That row data will be displayed in another popup window here customer will change details depending up requirement click on SAVE Button that update data will saved in ECC System.
    How to display another window by using Check box?
    Regards
    Vijay

    Hi Vijay
    Your question is not clear enough to give an answer. Do you have some difficulties with the code for opening a popup-window? There are many-many examples in the forum how to open/close a popup.
    Or you do not know how to bind the popup opening with clicking a check box? Just put the code in the onSelect event handler of the check box.
    BR, Siarhei
    Edited by: Siarhei Pisarenka on Mar 11, 2010 10:55 AM

Maybe you are looking for