2010 Jan 20 10:16 AM
Hi all,
I created an Alv grid with Abap objects, pushing a button from the alv grid I have to open a second alv in a popup, it works but in the popup (built with a second screen) the alv grid are replicated... and every time I push the button it create a new alv without deleteing the previous one. My code is:
FORM table_log_display .
IF custom_container_log IS INITIAL.
CREATE OBJECT custom_container_log
EXPORTING
container_name = mycontainer_log
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = text-002.
ENDIF.
CREATE OBJECT grid_log
EXPORTING i_parent = custom_container_log.
ENDIF.
PERFORM prepare_field_catalog_log CHANGING gt_fieldcat_log.
PERFORM prepare_layout_log.
gs_print-reservelns = 2.
IF event_receiver_log IS INITIAL.
CREATE OBJECT event_receiver_log.
SET HANDLER event_receiver_log->handle_toolbar_log FOR grid_log.
SET HANDLER event_receiver_log->handle_menu_button_log FOR grid_log.
SET HANDLER event_receiver_log->handle_user_command_log FOR grid_log.
SET HANDLER event_receiver_log->handle_top_of_list FOR grid_log.
SET HANDLER event_receiver_log->handle_top_of_page FOR grid_log.
SET HANDLER event_receiver_log->handle_end_of_list FOR grid_log.
SET HANDLER event_receiver_log->handle_end_of_page FOR grid_log.
ENDIF.
CALL METHOD grid_log->set_table_for_first_display
EXPORTING
is_print = gs_print
is_layout = gs_layout
CHANGING
it_outtab = gt_log
it_fieldcatalog = gt_fieldcat_log.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid_log.
ENDFORM. " table_log_display
FORM handle_user_command_log USING p_e_ucomm.
DATA: ls_output TYPE yfiq_sacein,
lt_rows TYPE lvc_t_row,
ls_row TYPE lvc_s_row,
lt_return TYPE bapiret2_t.
CASE p_e_ucomm.
WHEN 'EXIT'.
CALL METHOD custom_container_log->free
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
IF sy-subrc <> 0.
MESSAGE a000(db).
ENDIF.
FREE custom_container_log.
FREE grid_log.
REFRESH gt_log.
CLEAR event_receiver_log.
CALL METHOD cl_gui_cfw=>flush.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDFORM. " HANDLE_USER_COMMAND_log
Could someone tell me what is the error???
Thanks
GN
Hi all,
I created an Alv grid with Abap objects, pushing a button from the alv grid I have to open a second alv in a popup, it works but in the popup (built with a second screen) the alv grid are replicated... and every time I push the button it create a new alv without deleteing the previous one. My code is:
FORM table_log_display .
IF custom_container_log IS INITIAL.
CREATE OBJECT custom_container_log
EXPORTING
container_name = mycontainer_log
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = text-002.
ENDIF.
CREATE OBJECT grid_log
EXPORTING i_parent = custom_container_log.
ENDIF.
PERFORM prepare_field_catalog_log CHANGING gt_fieldcat_log.
PERFORM prepare_layout_log.
gs_print-reservelns = 2.
IF event_receiver_log IS INITIAL.
CREATE OBJECT event_receiver_log.
SET HANDLER event_receiver_log->handle_toolbar_log FOR grid_log.
SET HANDLER event_receiver_log->handle_menu_button_log FOR grid_log.
SET HANDLER event_receiver_log->handle_user_command_log FOR grid_log.
SET HANDLER event_receiver_log->handle_top_of_list FOR grid_log.
SET HANDLER event_receiver_log->handle_top_of_page FOR grid_log.
SET HANDLER event_receiver_log->handle_end_of_list FOR grid_log.
SET HANDLER event_receiver_log->handle_end_of_page FOR grid_log.
ENDIF.
CALL METHOD grid_log->set_table_for_first_display
EXPORTING
is_print = gs_print
is_layout = gs_layout
CHANGING
it_outtab = gt_log
it_fieldcatalog = gt_fieldcat_log.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid_log.
ENDFORM. " table_log_display
FORM handle_user_command_log USING p_e_ucomm.
DATA: ls_output TYPE yfiq_sacein,
lt_rows TYPE lvc_t_row,
ls_row TYPE lvc_s_row,
lt_return TYPE bapiret2_t.
CASE p_e_ucomm.
WHEN 'EXIT'.
CALL METHOD custom_container_log->free
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
IF sy-subrc <> 0.
MESSAGE a000(db).
ENDIF.
FREE custom_container_log.
FREE grid_log.
REFRESH gt_log.
CLEAR event_receiver_log.
CALL METHOD cl_gui_cfw=>flush.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDFORM. " HANDLE_USER_COMMAND_log
Could someone tell me what is the error???
Thanks
GN
2010 Jan 20 10:34 AM
Simply try freeing custom container + ALV each time you call pop up
free: custom_container_log, grid_log.
clear custom_container_log, grid_log.
create custom_container_log.
...
create grid_log.
....
Don't do any check like if custom_container_log is initial .
This should help, as the process of object creation takes place each time you enter pop up. It is however more performance intense for system but will work for you.
Regards
Marcin
2010 Jan 20 10:36 AM
Hi,
Please enclose your code between tags.
Have you called your second screen on the push of a button properly?
METHOD HANDLE_USER_COMMAND.
CASE E_UCOMM.
WHEN 'DISP'. "Custom button on the ALV Grid
CALL SCREEN '0200'.
ENDCASE.
ENDMETHOD. "HANDLE_USER_COMMAND
2010 Jan 20 10:44 AM
I try your suggest but it doesn't work again...
Edited by: Gabriele Nota on Jan 20, 2010 11:55 AM
2010 Jan 20 11:04 AM
I try to post my code with tags but it appears as follows:
FORM table_log_display
FREE grid_log.
CLEAR: grid_log, custom_container_log.
CREATE OBJECT custom_container_log
EXPORTING
container_name = mycontainer_log
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = text-002.
ENDIF.
CREATE OBJECT grid_log
EXPORTING i_parent = custom_container_log.
PERFORM prepare_field_catalog_log CHANGING gt_fieldcat_log.
PERFORM prepare_layout_log.
gs_print-reservelns = 2.
IF event_receiver_log IS INITIAL.
CREATE OBJECT event_receiver_log.
SET HANDLER event_receiver_log->handle_toolbar_log FOR grid_log.
SET HANDLER event_receiver_log->handle_menu_button_log FOR grid_log.
SET HANDLER event_receiver_log->handle_user_command_log FOR grid_log.
SET HANDLER event_receiver_log->handle_top_of_list FOR grid_log.
SET HANDLER event_receiver_log->handle_top_of_page FOR grid_log.
SET HANDLER event_receiver_log->handle_end_of_list FOR grid_log.
SET HANDLER event_receiver_log->handle_end_of_page FOR grid_log.
ENDIF.
CALL METHOD grid_log->set_table_for_first_display
EXPORTING
is_print = gs_print
is_layout = gs_layout
CHANGING
it_outtab = gt_log
it_fieldcatalog = gt_fieldcat_log.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid_log.
ENDFORM. " table_log_display
FORM handle_user_command_log USING p_e_ucomm.
DATA: ls_output TYPE yfiq_sacein,
lt_rows TYPE lvc_t_row,
ls_row TYPE lvc_s_row,
lt_return TYPE bapiret2_t.
CASE p_e_ucomm.
WHEN 'EXIT'.
CALL METHOD grid_log->free
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
CALL METHOD custom_container_log->free
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.
IF sy-subrc <> 0.
MESSAGE a000(db).
ENDIF.
REFRESH gt_log.
CLEAR event_receiver_log.
CALL METHOD cl_gui_cfw=>flush.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDFORM. " HANDLE_USER_COMMAND_logEdited by: Gabriele Nota on Jan 20, 2010 12:06 PM
Edited by: Gabriele Nota on Jan 20, 2010 12:07 PM
Edited by: Gabriele Nota on Jan 20, 2010 12:07 PM
Edited by: Gabriele Nota on Jan 20, 2010 12:10 PM
Edited by: Gabriele Nota on Jan 20, 2010 12:10 PM
2010 Jan 20 11:44 AM
I solved deleting all free and clear instructions, at exit I only set screen 0 and then when I open again the screen I only refresh the ALV with following method:
CALL METHOD grid_log->refresh_table_display.It woeks fine.
thanks
GN
2010 Jan 21 4:18 PM
Check this link for the solution:
cheers
Aveek
Edited by: Aveek Ghose on Mar 5, 2010 10:48 AM
Edited by: Aveek Ghose on Mar 10, 2010 6:42 PM
Edited by: Aveek Ghose on Mar 11, 2010 8:37 AM
2010 Jan 27 8:00 AM
Hi,
As in my previous post the OO program will be able to resolve your issues.
cheers
Aveek
2010 Feb 05 1:06 PM
2010 Feb 12 1:35 PM
Hi,
The program deals with downloading ABAP to HTML and meets your queries.
cheers
Aveek
2010 Feb 28 4:48 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |