Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Select All / None in REUSE_ALV_GRID_DISPLAY_LVC

henk_devries2
Explorer
0 Kudos

Hi,

Another question regarding these ALV grids.

I am using the function REUSE_ALV_GRID_DISPLAY_LVC to display a grid as popup window in a standard CRM transaction (called from an action).

The user is able to select checkboxes in this grid but I want to add "select all/none" buttons to be able to check all checkboxes for all records in one shot.

I have tried several things with the I_CALLBACK_PF_STATUS_SET parameter but I can't really get it to work. Do you have any ideas?

Regards,

Henk

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Hi Henk,

You need to do few things...

There is anothe alternative is , Copy the PF status from some standard program using SE41.

here is one such..SAPLKKBL, PF status STANDARD_FULLSCREEN

Go to SE41, give the program, and pfstatus.

now click on copy button, give your program , and pfstaus .copy it and activate it. now add tow buttons for select all and deselect all.

now use it in your program..

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
      I_CALLBACK_PROGRAM = V_REPID
     <b> I_CALLBACK_PF_STATUS_SET = 'PFSTAT'.</b>



FORM PFSTAT USING P_EXTAB TYPE SLIS_T_EXTAB.
 
*- Pf status
  <b>SET PF-STATUS 'PFSTAT'</b>. "this is we copied
                          "it is having all you want     
ENDFORM.   

form user_command using r_ucomm     like sy-ucomm
                               rs_selfield type slis_selfield.

  case r_ucomm.

  when 'SALL'.
   loop at itab.
  itab-check = 'X'.
  modify itab index sy-tabix.
  endloop.

  WHEN 'DALL'.
  loop at itab.
  itab-check = ''.
  modify itab index sy-tabix.
  endloop.
  endcase.
rs_selfield-refresh = 'X'.
endform.                    "USER_COMMAND

Regards

vijay

4 REPLIES 4

Former Member
0 Kudos

Did you try REUSE_ALV_POPUP_TO_SELECT?

Regards,

Ravi

Former Member
0 Kudos

Hi,

u r pf status form should be in this way

FORM PF_STATUS USING T_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'ASH' EXCLUDING T_EXTAB.

ENDFORM.

then only it will be called

inside this pf status try to create a button in application toolbar. and handle using user_command and form for this should be something like this.

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

R_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN 'ASHOK'.

WRITE : 'ASHOK'.

WRITE : 'ASHOK'.

ENDCASE.

ENDFORM.

Regards,

Manohar.

former_member188685
Active Contributor
0 Kudos

Hi Henk,

You need to do few things...

There is anothe alternative is , Copy the PF status from some standard program using SE41.

here is one such..SAPLKKBL, PF status STANDARD_FULLSCREEN

Go to SE41, give the program, and pfstatus.

now click on copy button, give your program , and pfstaus .copy it and activate it. now add tow buttons for select all and deselect all.

now use it in your program..

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
      I_CALLBACK_PROGRAM = V_REPID
     <b> I_CALLBACK_PF_STATUS_SET = 'PFSTAT'.</b>



FORM PFSTAT USING P_EXTAB TYPE SLIS_T_EXTAB.
 
*- Pf status
  <b>SET PF-STATUS 'PFSTAT'</b>. "this is we copied
                          "it is having all you want     
ENDFORM.   

form user_command using r_ucomm     like sy-ucomm
                               rs_selfield type slis_selfield.

  case r_ucomm.

  when 'SALL'.
   loop at itab.
  itab-check = 'X'.
  modify itab index sy-tabix.
  endloop.

  WHEN 'DALL'.
  loop at itab.
  itab-check = ''.
  modify itab index sy-tabix.
  endloop.
  endcase.
rs_selfield-refresh = 'X'.
endform.                    "USER_COMMAND

Regards

vijay

Former Member
0 Kudos

Hi Henk,

check this...

DATA: ls_toolbar TYPE stb_button,

i_object TYPE REF TO cl_alv_event_toolbar_set.

CLEAR ls_toolbar.

MOVE 3 TO ls_toolbar-butn_type.(Button type that will be added to the toolbar. Available button types are:

0 Button (normal)

1 Menu and default button

2 Menu

3 Separator

4 Radio button

5 Checkbox

6 Menu entry

APPEND ls_toolbar TO i_object->mt_toolbar.

For Adding two functions to be subentries for the menu button with function code ‘EXCH’ (in your case you can put select all/select none in the menu) or leave this and put two normal buttons with BUTN_TYPE = 0.

CASE i_ucomm .

WHEN 'EXCH' .

CALL METHOD i_object->add_function

EXPORTING

fcode = 'EU'

text = 'Euro' .

CALL METHOD i_object->add_function

EXPORTING

fcode = 'TRL'

text = 'Turkish Lira' .

.. ..

ENDCASE .

now in the event 'user_command'.

DATA lt_selected_rows TYPE lvc_t_roid .

DATA ls_selected_row TYPE lvc_s_roid .

CALL METHOD gr_alvgrid->get_selected_rows

IMPORTING

et_row_no = lt_selected_rows .

READ TABLE lt_selected_rows INTO ls_selected_row INDEX 1 .

IF sy-subrc ne 0 .

MESSAGE s000(su) WITH 'Select a row!'(203) .

ENDIF .

CASE i_ucomm .

WHEN 'EU' .

write the code(here you can select/deselect the checkboxes)

ENDCASE ..

hope this helps.

regards,

vidya