<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do use SAP Select All functionality in checkbox in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237108#M1011601</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Report or module pool?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Aug 2008 20:02:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-12T20:02:41Z</dc:date>
    <item>
      <title>How do use SAP Select All functionality in checkbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237107#M1011600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a screen which I show the user with each row having a checkbox on the left side of the screen. The user can click on 1 or more checkbox and select close order button on top of screen. If they wanted to do Select all to mark all checkbox, how would I do such a thing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2008 19:57:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237107#M1011600</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-12T19:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do use SAP Select All functionality in checkbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237108#M1011601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Report or module pool?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2008 20:02:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237108#M1011601</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-12T20:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do use SAP Select All functionality in checkbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237109#M1011602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a new button called Select all or you can use the standard button available in the tool bar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When ever it is clicked, Loop the table and modify each record with table-check = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and you have to call the method &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DATA  ls_ref1                      TYPE REF TO cl_gui_alv_grid  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CALL METHOD ls_ref1-&amp;gt;refresh_table_display .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after this you will be able to see all the check boxes as marked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkatesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2008 20:04:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237109#M1011602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-12T20:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do use SAP Select All functionality in checkbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237110#M1011603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Venkatesh,&lt;/P&gt;&lt;P&gt;How do I activate the standard Select All functionality button? If I use that button, would it automatically set the checkbox to 'X' and I just have to call the refresh table display?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2008 20:15:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237110#M1011603</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-12T20:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do use SAP Select All functionality in checkbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237111#M1011604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want the similar output of  the program &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;BCALV_EDIT_05&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2008 20:43:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237111#M1011604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-12T20:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do use SAP Select All functionality in checkbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237112#M1011605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vijay,&lt;/P&gt;&lt;P&gt;Thanks for the lead. But in my environment, we do not have a BCALV_EDIT_05. We have a 01 through 04 but do not have a 05. Do you mind posting the piece of code found there?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Aug 2008 20:57:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237112#M1011605</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-12T20:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do use SAP Select All functionality in checkbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237113#M1011606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is long program. Which version are you in..any way here is the code. This is the standard code.&lt;/P&gt;&lt;P&gt;custm controll name BCALV_GRID_DEMO_0100_CONT1 on screen 100.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;program bcalv_edit_05.
*&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;
* 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
*-----------------------------------------------------------------
*&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;
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=&amp;gt;mc_style_enabled.
          ls_celltab-style = cl_gui_alv_grid=&amp;gt;mc_style_disabled.
         else.
          ls_celltab-style = cl_gui_alv_grid=&amp;gt;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-&amp;gt;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.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  BUILD_FIELDCAT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--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.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  CREATE_AND_INIT_ALV
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--P_GT_OUTTAB  text
*      &amp;lt;--P_GT_FIELDCAT  text
*      &amp;lt;--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-&amp;gt;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-&amp;gt;catch_doubleclick for g_grid.

* Set editable cells to ready for input initially
  call method g_grid-&amp;gt;set_ready_for_input
   exporting
    i_ready_for_input = 1.


endform.                               "CREATE_AND_INIT_ALV

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  EXCLUDE_TB_FUNCTIONS
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--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=&amp;gt;mc_fc_loc_copy_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_delete_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_append_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_insert_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_move_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_copy.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_cut.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_paste.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_paste_new_row.
  append ls_exclude to pt_exclude.
  ls_exclude = cl_gui_alv_grid=&amp;gt;mc_fc_loc_undo.
  append ls_exclude to pt_exclude.


endform.                               " EXCLUDE_TB_FUNCTIONS
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_data
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  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=&amp;gt;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=&amp;gt;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
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  generate_entries
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--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_date+4(2) = l_month+0(2).
      l_date+6(2) = l_day+0(2).
      ls_sflight-fldate = l_date.
      append ls_sflight to pt_slfight.
    enddo.
  enddo.
endform.                               " generate_entries
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  select_all_entries
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--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-&amp;gt;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-&amp;gt;refresh_table_display.

  endif.

endform.                               " select_all_entries
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  deselect_all_entries
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--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-&amp;gt;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-&amp;gt;refresh_table_display.

  endif.



endform.                               " deselect_all_entries
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  reset_selected_entries
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--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-&amp;gt;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-&amp;gt;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-&amp;gt;check_changed_data
              importing
                 e_valid = l_valid.

  if l_valid eq 'X'.
    call method g_grid-&amp;gt;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-&amp;gt;refresh_table_display.

  endif.

endform.                               " switch_activation

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  check_lock
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_LS_OUTTAB  text
*      &amp;lt;--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=&amp;gt;mc_style_disabled.
        p_locked = 'X'.
      else.
        p_locked = space.
      endif.
    endif.
  endloop.

endform.                               " check_lock&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Aug 2008 04:31:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237113#M1011606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-13T04:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do use SAP Select All functionality in checkbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237114#M1011607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hii!&lt;/P&gt;&lt;P&gt;  Check this sample code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT z_sdn.
*" Data declarations...................................................
*"--------------------------------------------------------------------*
* Work variables                                                      *
*"--------------------------------------------------------------------*
DATA:
  BEGIN OF fs_spfli,
    carrid   LIKE spfli-carrid,        " Airline Code
    connid   LIKE spfli-connid,        " Flight Connection Number
    airpfrom LIKE spfli-airpfrom,      " Departure airport
    airpto   LIKE spfli-airpto,        " Destination airport
    deptime  LIKE spfli-deptime,       " Departure time
    arrtime  LIKE spfli-arrtime,       " Arrival time
  END OF fs_spfli,

  BEGIN OF fs_sflight,
    carrid   LIKE sflight-carrid,       " Airline Code
    connid   LIKE sflight-connid,       " Flight Connection Number
    fldate   LIKE sflight-fldate,       " Flight date
    seatsmax LIKE sflight-seatsmax,     " Maximum seats in economy class
    seatsocc LIKE sflight-seatsocc,     " Occupied seats in economyclass
  END OF fs_sflight,
  w_checkbox TYPE c,                    " Variable for checkbox
  w_currentline TYPE i,                 " Variable to display current
                                        " line
  w_lines TYPE i,
  w_read TYPE c .

*"--------------------------------------------------------------------*
* Internal Table to hold flight schedule information                  *
*"--------------------------------------------------------------------*
DATA:
  t_spfli LIKE
    TABLE OF
          fs_spfli.

*"--------------------------------------------------------------------*
* Internal Table to hold flight information                           *
*"--------------------------------------------------------------------*
DATA:
  t_sflight LIKE
      TABLE OF
            fs_sflight,
  t_sflight1 LIKE t_sflight.

*"--------------------------------------------------------------------*
*    START-OF-SELECTION Event                                         *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
  PERFORM get_data_spfli.

*"--------------------------------------------------------------------*
*    END-OF-SELECTION Event                                           *
*"--------------------------------------------------------------------*
END-OF-SELECTION.
  SET PF-STATUS 'MENU'.
  PERFORM display_data_spfli.

*"--------------------------------------------------------------------*
*    TOP-OF-PAGE Event                                                *
*"--------------------------------------------------------------------*
TOP-OF-PAGE.
  PERFORM header_table_spfli.

*"--------------------------------------------------------------------*
*    AT LINE-SELECTION EVENT                                          *
*"--------------------------------------------------------------------*
AT LINE-SELECTION.
  SET PF-STATUS space.
  IF sy-lsind EQ 1 AND sy-lilli GE 4.
    PERFORM get_data_sflight.
    PERFORM display_data_sflight.
    PERFORM flag_line.
  ENDIF.                               " IF sy-lsind EQ 1..

*"--------------------------------------------------------------------*
*    AT USER-COMMAND                                                  *
*"--------------------------------------------------------------------*
AT USER-COMMAND.
  IF sy-lsind EQ 1.
    SET PF-STATUS space.
    CASE sy-ucomm.
      WHEN 'DISPLAY'.
        PERFORM get_data_sflight1.
        PERFORM display_data_sflight.
      WHEN 'SELECTALL'.
        PERFORM select_all.
        PERFORM flag_line.
      WHEN 'DESELECTAL'.
        PERFORM deselect_all.
        PERFORM flag_line.
    ENDCASE.                           " CASE sy-ucomm
  ENDIF.                               " IF sy-lsind EQ 1

*"--------------------------------------------------------------------*
*    TOP-OF-PAGE DURING LINE-SELECTION                                *
*"--------------------------------------------------------------------*
TOP-OF-PAGE DURING LINE-SELECTION.
  PERFORM sec_list_heading.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  get_data_spfli
*&amp;amp;---------------------------------------------------------------------*
*  This subroutine fetches the data from SPFLI
*----------------------------------------------------------------------*
* This subroutine does not have parameters to pass
*----------------------------------------------------------------------*
FORM get_data_spfli .

  SELECT carrid                        " Airline Code
         connid                        " Flight Connection Number
         airpfrom                      " Departure airport
         airpto                        " Destination airport
         deptime                       " Departure time
         arrtime                       " Arrival time
    FROM spfli
    INTO TABLE t_spfli.

ENDFORM.                               " GET_DATA_SPFLI

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  display_data_spfli
*&amp;amp;---------------------------------------------------------------------*
* This subroutine displays the data of SPFLI
*----------------------------------------------------------------------*
* This subroutine does not have parameters to pass
*----------------------------------------------------------------------*
FORM display_data_spfli .
  LOOP AT t_spfli INTO fs_spfli.
    WRITE: /02 w_checkbox AS CHECKBOX,
            05 w_read,
               fs_spfli-carrid UNDER text-001,
               fs_spfli-connid UNDER text-002,
               fs_spfli-airpfrom UNDER text-003,
               fs_spfli-airpto UNDER text-004,
               fs_spfli-deptime UNDER text-005,
               fs_spfli-arrtime UNDER text-006.
    HIDE:
      fs_spfli-carrid,
      fs_spfli-connid.
  ENDLOOP.                             " LOOP AT t_spfli..
ENDFORM.                               " DISPLAY_DATA_SPFLI

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  header_table_spfli
*&amp;amp;---------------------------------------------------------------------*
* This subroutine diplays the headings of table spfli
*----------------------------------------------------------------------*
* This subroutine does not have parameters to pass
*----------------------------------------------------------------------*
FORM header_table_spfli .

  WRITE: /10 text-001 COLOR 4,
          25 text-002 COLOR 4,
          40 text-003 COLOR 4,
          55 text-004 COLOR 4,
          70 text-005 COLOR 4,
          85 text-006 COLOR 4.

ENDFORM.                               " HEADER_TABLE

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  get_data_sflight
*&amp;amp;---------------------------------------------------------------------*
* This subroutine fetches the data from SFLIGHT
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM get_data_sflight .

  SELECT carrid                        " Airline Code
         connid                        " Flight Connection Number
         fldate                        " Flight date
         seatsmax                      " Maximum seats in economy class
         seatsocc                      " Occupied seats in economyclass
    FROM sflight
    INTO TABLE t_sflight
   WHERE carrid EQ fs_spfli-carrid
     AND connid EQ fs_spfli-connid.

ENDFORM.                               " GET_DATA_SFLIGHT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  display_data_sflight
*&amp;amp;---------------------------------------------------------------------*
* This subroutine displays the SFLIGHT data
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM display_data_sflight .

  LOOP AT t_sflight INTO fs_sflight.
    WRITE: / fs_sflight-carrid UNDER text-001,
             fs_sflight-connid UNDER text-002,
             fs_sflight-fldate UNDER text-007,
             fs_sflight-seatsmax UNDER text-008 LEFT-JUSTIFIED,
             fs_sflight-seatsocc UNDER text-009 LEFT-JUSTIFIED.
  ENDLOOP.
  CLEAR: fs_sflight.
ENDFORM.                               " DISPLAY_DATA_sflight

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  sec_list_heading
*&amp;amp;---------------------------------------------------------------------*
*  This subroutine diplays the headings of table spfli
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM sec_list_heading .

  WRITE: /2 text-001 COLOR 4,
         15 text-002 COLOR 4,
         33 text-007 COLOR 4,
         45 text-008 COLOR 4,
         60 text-009 COLOR 4.

ENDFORM.                               " SEC_LIST_HEADING

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  get_data_sflight1
*&amp;amp;---------------------------------------------------------------------*
* This subroutine displays the data from SFLIGHT according to checkbox
* clicked.
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM get_data_sflight1 .

  DATA:
    lw_checkbox TYPE c.
  DESCRIBE TABLE t_spfli LINES w_lines.
  DO w_lines TIMES.
    w_currentline = 3 + sy-index.
    CLEAR:
      w_checkbox,
      fs_spfli.

    READ LINE w_currentline FIELD VALUE
      w_checkbox INTO lw_checkbox
      fs_spfli-carrid INTO fs_spfli-carrid
      fs_spfli-connid INTO fs_spfli-connid.
    IF sy-subrc EQ 0.
      IF lw_checkbox EQ 'X'.
        SELECT carrid                  " Airline Code
               connid                  " Flight Connection Number
               fldate                  " Flight Date
               seatsmax                " Max Seats
               seatsocc                " Occupied Seats
          FROM sflight
          INTO TABLE t_sflight1
         WHERE carrid EQ fs_spfli-carrid
           AND connid EQ fs_spfli-connid.
        IF sy-subrc EQ 0.
          APPEND LINES OF t_sflight1 TO t_sflight.
        ENDIF.                         " IF sy-subrc EQ 0.
      ENDIF.                           " IF lw_checkbox EQ 'X'
    ENDIF.                             " IF sy-subrc EQ 0.
  ENDDO.                               " DO w_lines TIMES

ENDFORM.                               " GET_DATA_SFLIGHT1

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  select_all
*&amp;amp;---------------------------------------------------------------------*
* This subroutine selects all the records of SPFLI
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM select_all .

  DESCRIBE TABLE t_spfli LINES w_lines.
  DO w_lines TIMES.
    w_currentline = sy-index + 3.
    READ LINE w_currentline FIELD VALUE
    w_checkbox INTO w_checkbox.
    IF sy-subrc = 0.
      MODIFY LINE w_currentline FIELD VALUE
      w_checkbox FROM 'X'.
    ENDIF.                             " IF sy-subrc = 0.
  ENDDO.                               " DO lw_line TIMES.

ENDFORM.                               " SELECT_ALL

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  deselect_all
*&amp;amp;---------------------------------------------------------------------*
* This subroutine deselects all the records of SPFLI
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM deselect_all .

  DESCRIBE TABLE t_spfli LINES w_lines.
  DO w_lines TIMES.
    w_currentline = sy-index + 3.
    READ LINE w_currentline FIELD VALUE
    w_checkbox INTO w_checkbox.
    IF sy-subrc = 0.
      MODIFY LINE w_currentline FIELD VALUE
      w_checkbox FROM ' '.
    ENDIF.                             " IF sy-subrc = 0.
  ENDDO.                               " DO lw_line TIMES.

ENDFORM.                               " DESELECT_ALL

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  flag_line
*&amp;amp;---------------------------------------------------------------------*
* This subroutine flags the line which has been read
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM flag_line .

  DESCRIBE TABLE t_spfli LINES w_lines.
  DO w_lines TIMES.
    w_checkbox = 'X'.
    READ LINE sy-lilli FIELD VALUE
      w_read INTO w_read
      w_checkbox INTO w_checkbox.
    IF sy-subrc EQ 0.

      MODIFY CURRENT LINE
      FIELD FORMAT w_checkbox INPUT OFF
      FIELD VALUE w_read FROM '*'.

    ENDIF.                             " IF sy-subrc EQ 0
  ENDDO.                               " DO w_lines TIMES

ENDFORM.                               " FLAG_LINE
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Abhijeety&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Aug 2008 04:43:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237114#M1011607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-13T04:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do use SAP Select All functionality in checkbox</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237115#M1011608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your at user-command ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case sy-ucomm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when 'SELECTALL'.&lt;/P&gt;&lt;P&gt; DESCRIBE TABLE &amp;lt;internal table &amp;gt; LINES w_lines.&lt;/P&gt;&lt;P&gt;  DO w_lines TIMES.&lt;/P&gt;&lt;P&gt;    w_currentline = sy-index + 3.&lt;/P&gt;&lt;P&gt;    READ LINE w_currentline FIELD VALUE&lt;/P&gt;&lt;P&gt;    w_checkbox INTO w_checkbox.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      MODIFY LINE w_currentline FIELD VALUE&lt;/P&gt;&lt;P&gt;      w_checkbox FROM 'X'.&lt;/P&gt;&lt;P&gt;    ENDIF.                             " IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  ENDDO.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;padma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Aug 2008 05:25:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-do-use-sap-select-all-functionality-in-checkbox/m-p/4237115#M1011608</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-13T05:25:37Z</dc:date>
    </item>
  </channel>
</rss>

