‎2008 Feb 26 12:05 PM
hi,
i 've used the following code in the PBO of the screen that i'm calling to display my output, where it_itm contains my output data.
Problem that i'm facing is that while i run my report with one
date the it_itm contains say 1 record then it shows one record in output but when i go back and enter another date the it_itm contains say 2 record but it displays the same old record instead of the new two records.
All i can see is that it is not getting refreshed.
Plz help.
*********************************************************
IF g_container IS INITIAL.
CREATE OBJECT g_container
EXPORTING
container_name = 'C_CONTAINER'.
CREATE OBJECT g_grid
EXPORTING
i_parent = g_container.
CALL METHOD g_grid->set_table_for_first_display
CHANGING
it_outtab = it_itm
it_fieldcatalog = it_fldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
‎2008 Feb 26 12:11 PM
Hi
Do the following changes in your code: (written in bold)
IF g_container IS INITIAL.
CREATE OBJECT g_container
EXPORTING
container_name = 'C_CONTAINER'.
CREATE OBJECT g_grid
EXPORTING
i_parent = g_container.
CALL METHOD g_grid->set_table_for_first_display
CHANGING
it_outtab = it_itm
it_fieldcatalog = it_fldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*else.*
*call method g_grid->refresh_table_display*
*exporting*
*is_stable = 'XX'.*
ENDIF.
Thanks
Vijay
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 26, 2008 12:24 PM
‎2008 Feb 26 12:09 PM
Hi Annie,
give Refresh it_itm
after CALL METHOD g_grid->set_table_for_first_display.
Thanks
bgan.
‎2008 Feb 26 12:11 PM
Hi
Do the following changes in your code: (written in bold)
IF g_container IS INITIAL.
CREATE OBJECT g_container
EXPORTING
container_name = 'C_CONTAINER'.
CREATE OBJECT g_grid
EXPORTING
i_parent = g_container.
CALL METHOD g_grid->set_table_for_first_display
CHANGING
it_outtab = it_itm
it_fieldcatalog = it_fldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*else.*
*call method g_grid->refresh_table_display*
*exporting*
*is_stable = 'XX'.*
ENDIF.
Thanks
Vijay
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 26, 2008 12:24 PM
‎2008 Feb 26 12:18 PM
Hi,
in the CASE of corresponding user-command.
Try to refresh table ( Which you are displaying in the ALV) whenever you are going to click on BACK button.
Inorder to refresh table use below method.
*Method handles online changes in ALV GRID
CALL METHOD grid_flresults->refresh_table_display.
then proceed with ALV display as usual
‎2008 Feb 26 12:34 PM
Hi,
Try this program, it will help u.
REPORT ZCL_OOPS_INT_ALV_GRID .
type-pools : slis.
data : t_ekko type table of ekko.
data : t_ekpo type table of ekpo.
data : v_ebeln like ekko-ebeln.
data : x_ekko like ekko.
data : x_layout type lvc_s_layo,
x_layout_dtl type lvc_s_layo.
data : grid_ekko type ref to cl_gui_alv_grid,
grid_ekpo type ref to cl_gui_alv_grid,
cont_ekko type ref to cl_gui_custom_container,
cont_ekpo type ref to cl_gui_custom_container.
----
INTERFACE lintf_handler
----
*
----
interface lintf_handler.
class-methods : handle_hotspot_click
for event hotspot_click of cl_gui_alv_grid
importing e_row_id.
endinterface. "lintf_handler
class lcl_event_receiver definition.
public section.
interfaces lintf_handler.
aliases handler1 for lintf_handler~handle_hotspot_click.
endclass. "lcl_event_receiver DEFINITION
----
CLASS lcl_event_receiver IMPLEMENTATION
----
*
----
class lcl_event_receiver implementation.
method lintf_handler~handle_hotspot_click.
if not e_row_id is initial.
clear x_ekko.
read table t_ekko into x_ekko index e_row_id-index.
v_ebeln = x_ekko-ebeln.
if not v_ebeln is initial.
perform get_detail_data.
if not t_ekpo[] is initial.
call screen 200.
endif.
endif.
endif.
endmethod. "lintf_handler~handle_hotspot_click
endclass. "lcl_event_receiver IMPLEMENTATION
*--END OF CLASS IMPL
start-of-selection.
set screen 100.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
module status_0100 output.
set pf-status 'T111'.
set titlebar 'TITLE11' WITH 'PO HEADER DETAILS'.
endmodule. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module user_command_0100 input.
case sy-ucomm.
when 'EXIT'.
perform exit_program.
when 'BACK'.
perform exit_program.
when others.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
&----
*& Module set_pbo OUTPUT
&----
text
----
module set_pbo output.
if cont_ekko is initial.
perform select_data.
create object cont_ekko
exporting container_name = 'CUST_CONT1'.
create object grid_ekko
exporting i_parent = cont_ekko.
*--LAYOUT INFORMAITON
x_layout-grid_title = 'Posting Master Data'.
x_layout-keyhot = 'X'.
x_layout-ZEBRA = 'X'.
call method grid_ekko->set_table_for_first_display
exporting
i_structure_name = 'EKKO'
is_layout = x_layout
changing
it_outtab = t_ekko.
set handler lcl_event_receiver=>handler1 for all instances.
call method grid_ekko->set_toolbar_interactive.
else.
call method grid_ekko->refresh_table_display.
endif.
call method cl_gui_control=>set_focus
exporting
control = grid_ekko.
endmodule. " set_pbo OUTPUT
&----
*& Form select_data
&----
text
----
form select_data .
select * from ekko
into table t_ekko
UP TO 10 ROWS.
endform. " select_data
&----
*& Form get_detail_data
&----
text
----
form get_detail_data .
select * from ekpo
into table t_ekpo
where ebeln = v_ebeln.
endform. " get_detail_data
&----
*& Form exit_program
&----
text
----
form exit_program .
call method cont_ekko->free.
if not cont_ekpo is initial.
call method cont_ekpo->free.
endif.
call method cl_gui_cfw=>flush.
if sy-subrc ne 0.
call function 'POPUP_TO_INFORM'
exporting
titel = 'ZCL_OOPS_INT_ALV_GRID'
txt1 = 'Error in Flush'
txt2 = sy-subrc.
endif.
leave program.
endform. " exit_program
&----
*& Module STATUS_0200 OUTPUT
&----
text
----
module status_0200 output.
set pf-status 'T111'.
set titlebar 'TITLE11' WITH 'Posting Details'.
endmodule. " STATUS_0200 OUTPUT
&----
*& Module pbo_200 OUTPUT
&----
text
----
module pbo_200 output.
if cont_ekpo is initial.
create object cont_ekpo
exporting container_name = 'CUST_CONT2'.
create object grid_ekpo
exporting i_parent = cont_ekpo.
x_layout_dtl-grid_title = 'Posting Detail Data'.
call method grid_ekpo->set_table_for_first_display
exporting
i_structure_name = 'EKPO'
is_layout = x_layout_dtl
changing
it_outtab = t_ekpo.
else.
call method grid_ekpo->refresh_table_display.
endif.
call method cl_gui_control=>set_focus
exporting
control = grid_ekpo.
endmodule. " pbo_200 OUTPUT
&----
*& Module USER_COMMAND_0200 INPUT
&----
text
----
module user_command_0200 input.
case sy-ucomm.
when 'BACK'.
leave to screen 100.
when others.
endcase.
endmodule. " USER_COMMAND_0200 INPUT
REgards
Rohini.