Application Development and Automation 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: 
Read only

Problem with method get_selected_rows in ALV

Former Member
0 Likes
2,092

Hi!

I´m using class CL_GUI_ALV_GRID in my screen.

I created a STATUS-GUI with button in toolbar. When i click in this button, in PAI i execute method get_selected_rows to get lines selected. In the first time that i click on this button this method work fine. But in another time it not work, importing table return null. Why? How can i resolve that?

Please, help me!

1 ACCEPTED SOLUTION
Read only

ShyamPindiproli
Active Participant
0 Likes
847

Check out the sample report : BCALV_EDIT_05

In the PAI module you need to invoke the method  to get selected rows:

 

MODULE user_command_0100 INPUT.

  CASE ok_code.

    WHEN 'EDIT'.

       DATA: v_ridx TYPE lvc_t_row.

       CALL METHOD g_grid->get_selected_rows              <<<<<<<  Get Rows Selected (Row Index)

        IMPORTING

          et_index_rows = v_ridx.

  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

Points to remember while using the method:

  • If only cells or columns are selected, the ALV Grid Control returns an empty table. 
  • If the user has selected multiple rows, the indexes are generally sorted in ascending order in the table.

2 REPLIES 2
Read only

ShyamPindiproli
Active Participant
0 Likes
848

Check out the sample report : BCALV_EDIT_05

In the PAI module you need to invoke the method  to get selected rows:

 

MODULE user_command_0100 INPUT.

  CASE ok_code.

    WHEN 'EDIT'.

       DATA: v_ridx TYPE lvc_t_row.

       CALL METHOD g_grid->get_selected_rows              <<<<<<<  Get Rows Selected (Row Index)

        IMPORTING

          et_index_rows = v_ridx.

  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

Points to remember while using the method:

  • If only cells or columns are selected, the ALV Grid Control returns an empty table. 
  • If the user has selected multiple rows, the indexes are generally sorted in ascending order in the table.

Read only

Former Member
0 Likes
847

Without reviewing your code, my first thought is that you are not re-initializing your variables after the first selection, or you are not setting the values for subsequent clicks.  Set a debug and check what the values are during the first click.  Then click again and compare the first set of values to the values on subsequent clicks.  If you are using loop counters, be sure to check those for reinitializing also.

mr.kim