1 1 1 1 1 Rating 0% (0 Votes)
Access this URL (http://abapblog.com/files/nugg/ZAB_MASS_REPLACE.nugg)ZAB_MASS_REPLACE.nugg
If you imported NUGG file from previous article you could be surprised that there is one additional FM available called Z_AB_POPUP_GRID_MULTI_SEL. This FM can be used to call a popup with ALV grid which allows multiple row selects. 
1) In order to prepare such popup you'll need to firstly define some global variables in FG which you can find bellow:

constantsc_ccname_grid_popup type scrfname value 'CC_GRID_POPUP'.
datago_popup_custom_cont      type ref to cl_gui_custom_container.
datago_popup_grid             type ref to cl_gui_alv_grid.
datags_popup_layout           type lvc_s_layo.
datags_popup_variant          type disvariant.
datagt_popup_fcat             type lvc_t_fcat.
datag_popup_question          type char70.
field-symbols<gt_popup_outtab> type standard table.

2) Then you need to create GUI status with Cancel and Enter Buttons
3) You may also want to create a title for the popup
4) Once you have GUI Status and GUI Title you should create own screen, I called it 0501. In this screen you should create a space for custom container for ALV grid and space for the question which will be passed to the users. Just to be able to call it from any place.
5) Next step would be to create proper flow logic for this screen. In fact we need only PBO and PAI, in which creation of custom container and ALV object will take place and user command will be handled.
PBO / PAI code belllow:

module pbo_0501 output.
  set pf-status 'STATUS_0501'.
  set titlebar  'TITLE_0501'.

  create object go_popup_custom_cont
*    parent                      = i_parent_container
    container_name              c_ccname_grid_popup
*    style                       = style
*    lifetime                    = lifetime_default
*    repid                       = repid
*    dynnr                       = dynnr
*    no_autodef_progid_dynnr     = no_autodef_progid_dynnr
    cntl_error                  1
    cntl_system_error           2
    create_error                3
    lifetime_error              4
    lifetime_dynpro_dynpro_link 5
    others                      6
  if sy-subrc eq 0.

  gs_popup_variant-report         sy-repid.
  gs_popup_layout-zebra           abap_true.
  gs_popup_layout-no_toolbar      abap_true.
  gs_popup_layout-cwidth_opt      abap_true.
  gs_popup_layout-sel_mode        'C'.

  create object go_popup_grid
*      i_shellstyle      = 0
*      i_lifetime        = i_lifetime
    i_parent          go_popup_custom_cont
*      i_appl_events     = space
*      i_parentdbg       = i_parentdbg
*    i_applogparent    = i_applog_container
*      i_graphicsparent  = i_graphicsparent
*      i_name            = i_name
*      i_fcat_complete   = SPACE
    error_cntl_create 1
    error_cntl_init   2
    error_cntl_link   3
    error_dp_create   4
    others            5
  if sy-subrc eq 0.

*      i_buffer_active               = i_buffer_active
*      i_bypassing_buffer            = i_bypassing_buffer
*      i_consistency_check           = i_consistency_check
*      i_structure_name              = i_structure_name
      is_variant                    gs_popup_variant
*      i_default                     = 'X'
      is_layout                     gs_popup_layout
*      is_print                      = is_print
*      it_special_groups             = it_special_groups
*      it_toolbar_excluding          = gt_toolbar_excluding
*      it_hyperlink                  = it_hyperlink
*      it_alv_graphics               = it_alv_graphics
*      it_except_qinfo               = it_except_qinfo
*      ir_salv_adapter               = ir_salv_adapter
      it_outtab                     <gt_popup_outtab>
*        it_sort                       = gt_sort
*        it_filter                     = gt_filter
      invalid_parameter_combination 1
      program_error                 2
      too_many_lines                3
      others                        4
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      call method go_popup_grid->set_ready_for_input
          i_ready_for_input 1.

endmodule.                    "pbo_0501 OUTPUT

*  MODULE pai_0501 INPUT
module pai_0501 input.
  case g_okcode.
    when 'ENTER'.
      leave screen.
    when 'CANCEL'.
      leave screen.
endmodule.                    "pai_0501 INPUT


6) All needed elements are ready now, so it's time for FM . As import parameter we need fieldcatalog and the question which will be displayed on the screen. As changing parameter we pass a table with options that should be displayed. What is important here is that this table will be changed (only selected entires will be left in the table) and in case of cancel button or confirm button but without selecting any row this table will be refreshed.

function z_ab_popup_grid_multi_sel.
*"*"Local Interface:
  field-symbols<structure> type any.
  dataft_row_no type lvc_t_roid .
  dataft_table_ref type ref to data.
  field-symbols<temptable> type standard table.

  check ct_outtab[] is not initial.

  "to be able to use it in PBO/PAI
  assign ct_outtab to <gt_popup_outtab>.

  gt_popup_fcat[] it_fcat[].
  g_popup_question i_question.

  call screen 0501 starting at 1 1.

  case g_okcode.
    when 'ENTER'.
          "et_index_rows = et_index_rows
          et_row_no     ft_row_no
      if ft_row_no[] is initial.
        refresh ct_outtab[].
        sort ft_row_no by row_id ascending.
        create data ft_table_ref like ct_outtab.
        assign ft_table_ref->to <temptable>.
        <temptable>[] ct_outtab[].
        loop at <temptable> assigning <structure>.
          read table ft_row_no with key row_id sy-tabix binary search transporting no fields.
          if sy-subrc ne 0.
            delete ct_outtab index sy-tabix.
    when 'CANCEL'.
      refresh ct_outtab[].
  clear g_okcode.


I've updated demo program which can be found in attached NUGG file and now also popup usage can be found there. In user_command_0100 module you can find the call of popup FM.


In the new demo program click on POPUP DEMO button on the screen.

A popup will be called with the same entries as in the main window (that was done on purpose).


After you select lines and confirm selection popup screen will be closed and grid on the main screen will contain only selected values.