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 in get_selected_rows

Former Member
0 Likes
830

hi

REFRESH gt_selected_rows.

CALL METHOD g_alv->get_selected_rows

IMPORTING et_index_rows = gt_selected_rows.

IF NOT gt_selected_rows[] IS INITIAL.

CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'

EXPORTING

textline1 = text-114

titel = text-115 "#EC NOTEXT

start_column = 25

start_row = 6

cancel_display = ''

IMPORTING

answer = lv_flag.

IF lv_flag EQ 'J'.

PERFORM selected_rows .

ELSE.

  • MESSAGE WHEN NO LINES SELECTED!!!

MESSAGE i113(z2).

ENDIF.

in this code my get_selected_row FM is gettin value onle once.Being in the same screen if i again select the rows the value returned by the FM is initial.....

wat should i do...

4 REPLIES 4
Read only

Former Member
0 Likes
663

Hi Neha ,

The get selected rows should be in somewhere event please send me the whole code .

Read only

0 Likes
663

hi

actually wat i mdoin is i m usin cl_gui_alv_grid.its having reset button so after selecting the perticular field i press reset button it does some processin. so in this situation the get_selected works fine first time the next time witout exiting i select some more rows n press reset the get_selected is not workin

CLASS lcl_reset_event_receiver DEFINITION.

PUBLIC SECTION.

METHODS :

  • To add new functional buttons to the ALV toolbar

handle_toolbar_0100

FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING e_object e_interactive,

  • To implement user commands

handle_user_command

FOR EVENT user_command OF cl_gui_alv_grid

IMPORTING e_ucomm,

  • Double-click in screen 0100

handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row .

ENDCLASS. "class lcl_reset_event_receiver definition.

===========================================================

CLASS lcl_reset_event_receiver IMPLEMENTATION .

METHOD handle_toolbar_0100.

ENDMETHOD.

METHOD handle_user_command .

CLEAR lv_flag.

  • get selected rows

REFRESH gt_selected_rows.

CALL METHOD g_alv->get_selected_rows

IMPORTING et_index_rows = gt_selected_rows.

IF NOT gt_selected_rows[] IS INITIAL.

CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'

EXPORTING

textline1 = text-114

titel = text-115 "#EC NOTEXT

start_column = 25

start_row = 6

cancel_display = ''

IMPORTING

answer = lv_flag.

IF lv_flag EQ 'J'.

PERFORM selected_rows USING

CHANGING gt_success.

ELSE.

  • MESSAGE WHEN NO LINES SELECTED!!!

MESSAGE i113(z2).

===========================================================

MODULE user_command_0100 INPUT.

CASE sy-ucomm.

WHEN 'BACK' .

LEAVE PROGRAM.

WHEN 'RESET'.

SET HANDLER gv_event_handler->handle_user_command FOR g_alv.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

ENDIF.

ENDIF. "IF gt_selected_rows[] IS INITIAL

ENDMETHOD.

===============================================

plz help me wid this

Read only

Former Member
0 Likes
663

Neha ,

Your problem is solved I feel

Just change this code .

MODULE user_command_0100 INPUT.

CASE sy-ucomm.

WHEN 'BACK' .

LEAVE PROGRAM.

********************Comment the code .

WHEN 'RESET'. -

*************End comment

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

ENDIF.

ENDIF. "IF gt_selected_rows[] IS INITIAL

Now when you have displayed the ALV GRID

AFTER that

write this code .

SET HANDLER gv_event_handler->handle_user_command FOR g_alv.

so the solution you have code set handlet only once.

and in the method user_command

check e_ucomm = 'RESET'.

Try this it will work.

Please reward if useful.

Read only

Former Member
0 Likes
663

Hi,

You might ahve selected only one row from the ALV.

MAke sure whether you are using multiple selection of rows in ALV.