2011 Jan 10 5:34 AM
Hi All,
My program displays an idoc list(screen 100). Then if user selects any row in the method
CALL METHOD g1_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.gets the index no and details of that idoc are displayed in another screen(screen 200) .User can make changes in that screen and then processing should be return to the idoc list again(screen 100) .
In PAI Screen 200 I have written
LEAVE TO SCREEN '100'.The control returns to screen 100 idoc list.But now if we select any row the below method does not give any row no. even if we select a row.
CALL METHOD g1_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.The row is not getting selected the second time after returning to that screen.
Kindly please suggest.
2011 Jan 10 6:27 AM
Hi Ujjwal,
In PBO module :
CALL METHOD g1_grid->refresh_table_display
Regards,
Jovito.
Hi All,
My program displays an idoc list(screen 100). Then if user selects any row in the method
CALL METHOD g1_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.gets the index no and details of that idoc are displayed in another screen(screen 200) .User can make changes in that screen and then processing should be return to the idoc list again(screen 100) .
In PAI Screen 200 I have written
LEAVE TO SCREEN '100'.The control returns to screen 100 idoc list.But now if we select any row the below method does not give any row no. even if we select a row.
CALL METHOD g1_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.The row is not getting selected the second time after returning to that screen.
Kindly please suggest.
2011 Jan 10 6:27 AM
Hi Ujjwal,
In PBO module :
CALL METHOD g1_grid->refresh_table_display
Regards,
Jovito.
2011 Jan 10 7:28 AM
Hi , I have used this too CALL METHOD g1_grid->refresh_table_display in PBO but it didn't work.
2011 Jan 10 12:14 PM
Hi Ujjwal,
I hope the statement CALL METHOD g1_grid->refresh_table_display is NOT inside condition IF g_custom_container IS INITIAL.
Code should be something like
IF g_custom_container IS INITIAL.
.........
endif.
CALL METHOD g1_grid->refresh_table_displayRegards,
Jovito
2011 Jan 11 4:10 AM
Hi dsouzajovito ,
I even tried that it didn't help.
Kindly help.
2011 Jan 11 4:52 AM
Hello,
Did you try CL_GUI_CFW=>FLUSH after the call to get_selected_rows method? (Check line 132 of program BCALV_GRID_05)
BR,
Suhas
2011 Jan 11 5:38 AM
Hi All,
I even tried this but didn't help. I checked the report BCALV_GRID_05 compared my code could not find any difference.
Hence pasting my code :
The screen 100 PBO block
*&----
*
*& Module STATUS_0100 OUTPUT
*&----
*
MODULE status_0100 OUTPUT.
*****Some unwanted code lines deleted***************IF ok_code EQ 'BACK'.
LEAVE TO SCREEN 0.
ELSE.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
Read data and create objects
IF go_custom_container IS INITIAL.
Read data from datbase table
PERFORM get_data.
Create objects for container and ALV grid
CREATE OBJECT go_custom_container
EXPORTING
container_name = 'DISPLAY_IDOCS_100'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
Create object for event_receiver class
and set handlers
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
SET HANDLER o_event_receiver->handle_double_click FOR go_grid.
PERFORM exclude_tb_functions CHANGING lt_exclude.
*****Some unwanted code lines deleted***************
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'LISTEDIDC'
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = lt_fcat
it_outtab = gi_edidc.
*-- End of grid setup -
-
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid. This is not necessary in this
example as there is only one control on the screen
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = go_grid.
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
ENDIF.
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = go_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUTThe screen 200 from where control returns
*&----
*
*& Module STATUS_0200 OUTPUT
*&----
*
MODULE status_0200 OUTPUT.
****Some unwanted code lines deleted**************
SET PF-STATUS 'MAIN200'.
SET TITLEBAR 'MAIN200'.
IF ok_code NE 'EDIT'.
IF ok_code NE 'ERROR'.
IF ok_code NE 'BACK'.
****Some code lines deleted**************
CREATE OBJECT go_docking
EXPORTING
dynnr = '200'
extension = 65
side = cl_gui_docking_container=>dock_at_top.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_docking.
*§1.Set status of all cells to editable using the layout structure.
gs_layout-edit = 'X'.
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
SET HANDLER o_event_receiver->handle_double_click FOR go_grid.
SET HANDLER o_event_receiver->handle_data_changed1 FOR go_grid.
SET HANDLER o_event_receiver->handle_data_changed_finished
FOR go_grid.
PERFORM build_fieldcatalogs_bkpf_200.
PERFORM exclude_tb_functions CHANGING lt_exclude.
PERFORM exclude_more_tb_functions CHANGING lt_exclude.
CLEAR lv_gridtitle.
CONCATENATE 'Header Data' space '-' space
gi_edidd-docnum INTO lv_gridtitle.
gs_layout-grid_title = 'Header Data'.
gs_layout-grid_title = lv_gridtitle.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = fieldcatalog1
it_outtab = gi_e1fikpf.
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
SET HANDLER o_event_receiver->handle_data_changed1 FOR go_grid.
*§2.Use SET_READY_FOR_INPUT to allow editing initially.
(state "editable and ready for input").
CALL METHOD go_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
CREATE OBJECT go_custom_container
EXPORTING
container_name = 'DISPLAY_IDOC_CONTENT_200'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
CLEAR lt_exclude.
PERFORM exclude_tb_functions CHANGING lt_exclude.
PERFORM build_fieldcatalogs_bseg_200.
gs_layout-grid_title = 'Line Item Data'.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = fieldcatalog1
it_outtab = gi_e1fiseg.
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
SET HANDLER o_event_receiver->handle_data_changed2 FOR go_grid.
IF NOT gi_e1finbu[] IS INITIAL.
*&--Add E1FINBU at the bottom of the screen
CREATE OBJECT go_docking
EXPORTING
dynnr = '200'
extension = 65
side = cl_gui_docking_container=>dock_at_bottom.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_docking.
PERFORM build_fieldcatalogs_bnbu_200.
PERFORM exclude_more_tb_functions CHANGING lt_exclude.
gs_layout-grid_title = 'Vendor Line Item Data'.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = fieldcatalog1
it_outtab = gi_e1finbu.
ENDIF.
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
SET HANDLER o_event_receiver->handle_data_changed3 FOR go_grid.
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
ENDIF.
ENDIF.
ENDIF.
ENDMODULE. "status_0200 OUTPUT
PAI of screen 100
*&----
*
*& Module USER_COMMAND_0100 INPUT
*&----
*
MODULE user_command_0100 INPUT.
****Some code lines deleted**************
WHEN 'CHANGE'.
DATA: l_valid TYPE c.
REFRESH gi_index_rows.
CLEAR g_selected_row.
CALL METHOD go_grid->check_changed_data
IMPORTING
e_valid = l_valid.
Read index of selected rows
IF l_valid EQ 'X'.
CALL METHOD go_grid->get_selected_rows ****this is the place where value comes out 0 after cback from screen 200
IMPORTING
et_index_rows = gi_index_rows.
ENDIF.
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
PERFORM change_idoc.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
PAI of screen 200 where screen 100 is called.
*&----
*
*& Module USER_COMMAND_0200 INPUT
*&----
*
text
*----
*
MODULE user_command_0200 INPUT.
****Some code lines deleted**************
WHEN 'EDIT'.
Refresh grid
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN '100'.
****Some code lines deleted**************
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
Kindly suggest.
Edited by: ujjwal_d15 on Jan 11, 2011 6:38 AM
Edited by: ujjwal_d15 on Jan 11, 2011 6:39 AM
Edited by: ujjwal_d15 on Jan 11, 2011 6:40 AM
2011 Jan 11 5:42 AM
Hello,
Of course there is a difference. There is a
LEAVE TO SCREEN 0instead of SCREEN '100' as in your code.
Check if this is the cause.
BR,
Suhas
2011 Jan 11 5:53 AM
Hi , that is only for back condition. The code is fine.
The issue is not yet solved ....Whether it's related with the object name.
2011 Jan 11 6:58 AM
2011 Jan 10 6:37 AM
2011 Jan 11 9:57 AM
Hi Ujjwal,
Remove these lines.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
*****Some unwanted code lines deleted***************
*IF ok_code EQ 'BACK'. "Comment
* LEAVE TO SCREEN 0. "Comment
*ELSE. "Comment this and corresponding END IF
SET PF-STATUS 'MAIN100'. "Continue from here
SET TITLEBAR 'MAIN100'Regards,
Jovito
2011 Jan 11 11:42 AM
2011 Jan 11 12:14 PM
Hi,
Remove single quotes:
LEAVE TO SCREEN '100'. "Becomes LEAVE TO SCREEN 100.Also try :
LEAVE TO SCREEN '0100'.Since I dont have your code, these are the best guesses i can give.
Regards,
Jovito
2011 Jan 11 1:33 PM
Hi ,
In program BCALV_GRID_05 there is a tool bar for which
handle_user_commandworks.
To make my program exactly work like that i need to generate event on application tool bar.
How events from application toolbar can be catched in handle_user_command of cl_gui_alv_grid ?
2011 Jan 12 5:35 AM
Hi Ujjwal,
1. Declare the receiver class
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
ENDCLASS.2. Define / Implement the Class.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'BOOKINGS' TO ls_toolbar-function.
MOVE icon_employee TO ls_toolbar-icon.
MOVE 'Show Bookings'(111) TO ls_toolbar-quickinfo.
MOVE 'Detail'(112) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
DATA: lt_rows TYPE lvc_t_row.
CASE e_ucomm.
WHEN 'BOOKINGS'.
CALL METHOD grid1->get_selected_rows
IMPORTING et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc ne 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
else.
perform show_booking_table tables lt_rows.
ENDIF.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS.3. Create an object of the class.
data: event_receiver TYPE REF TO lcl_event_receiver.4. In PBO Event, Set the Command Receiver.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_user_command FOR grid1.
SET HANDLER event_receiver->handle_toolbar FOR grid1.
CALL METHOD grid1->set_toolbar_interactive.Regards,
Jovito
2011 Jan 12 3:19 PM
Hi all, thanks for all the replies. Actually the problem was with the same name object used in both the screen in 100 and 200. So i think same names for objects should not have been used for custom control and other that was creating problem.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |