‎2007 Nov 12 8:32 AM
Hi,
I am trying to make one program with object oriented alv.My grid do not be refresh.
My code is like that....
CLEAR G_CONTAINER.
CREATE OBJECT G_CONTAINER
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
CREATE OBJECT ALV_DISP
EXPORTING
I_PARENT = G_CONTAINER.
call method ALV_DISP->set_ready_for_input
exporting i_ready_for_input = 0.
CALL METHOD ALV_DISP->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'ZPMS_OUTPUT_V3'
CHANGING
IT_OUTTAB = IT_PMT
IT_FIELDCATALOG = gt_fieldcatalog
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ' NO DATA FOUND !!!' TYPE 'E'.
ENDIF.
CALL METHOD ALV_DISP->REFRESH_TABLE_DISPLAY
EXCEPTIONS
FINISHED = 1
OTHERS = 2.
Please help me to trace out this situation.
Regards,
Gurprit Bhatia
‎2007 Nov 12 12:08 PM
Hi Gurprit,
Check the sample code.
CALL METHOD gd_tree->set_table_for_first_display
EXPORTING
is_layout = gd_layout
CHANGING
it_fieldcatalog = gd_fieldcat
it_sort = it_sortcat
it_outtab = it_report.
CALL method gd_tree->REFRESH_TABLE_DISPLAY.
CALL METHOD cl_gui_cfw=>flush.
Reward If Useful.
Regards,
Chitra
‎2007 Nov 12 7:36 PM
‎2007 Nov 22 9:53 AM
try this....
if g_container is initial.
CREATE OBJECT G_CONTAINER
EXPORTING
CONTAINER_NAME = 'CONTAINER'.
CREATE OBJECT ALV_DISP
EXPORTING
I_PARENT = G_CONTAINER.
else.
CALL METHOD ALV_DISP->REFRESH_TABLE_DISPLAY
EXCEPTIONS
FINISHED = 1
OTHERS = 2.
endif.
call method ALV_DISP->set_ready_for_input
exporting i_ready_for_input = 0.
CALL METHOD ALV_DISP->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'ZPMS_OUTPUT_V3'
CHANGING
IT_OUTTAB = IT_PMT
IT_FIELDCATALOG = gt_fieldcatalog
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ' NO DATA FOUND !!!' TYPE 'E'.
ENDIF.
‎2007 Nov 23 4:50 AM
hai
try this code
it is helpful to u
&----
*& Report ZALVREP *
*& *
&----
*& *
*& *
&----
REPORT ZALVREP .
class alv_event_receiver definition deferred.
data: ok_code like sy-ucomm,
g_repid like sy-repid,
gs_layout type lvc_s_layo,
gt_fieldcat type lvc_t_fcat with header line,
cont_on_main type scrfname value 'CONTAINER1',
cont_on_dialog type scrfname value 'CONTAINER2',
grid1 type ref to cl_gui_alv_grid,
grid2 type ref to cl_gui_alv_grid,
custom_container1 type ref to cl_gui_custom_container,
custom_container2 type ref to cl_gui_custom_container,
event_receiver type ref to alv_event_receiver.
data : begin of i_ekko occurs 0,
ebeln like ekko-ebeln,
aedat like ekko-aedat,
ernam like ekko-ernam,
lifnr like ekko-lifnr,
end of i_ekko.
data : begin of i_ekpo occurs 0,
ebelp like ekpo-ebelp,
txz01 like ekpo-txz01,
matnr like ekpo-matnr,
werks like ekpo-werks,
end of i_ekpo.
set screen 100.
class alv_event_receiver definition.
public section.
methods:
handle_double_click
for event double_click of cl_gui_alv_grid
importing e_row e_column.
private section.
endclass.
class alv_event_receiver implementation.
method handle_double_click.
data: ls_sflight like line of gt_sflight.
*read table gt_sflight index e_row-index into ls_sflight.
*perform select_table_sbook using ls_sflight
changing gt_sbook.
select ebelp txz01 matnr werks from ekpo into table i_ekpo where ebeln
eq i_ekko-ebeln.
call screen 101 starting at 10 5.
endmethod.
endclass.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
module STATUS_0100 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
g_repid = sy-repid.
if custom_container1 is initial.
select ebeln aedat ernam lifnr from ekko into table i_ekko.
CREATE OBJECT custom_container1
EXPORTING
container_name = 'CONTAINER1'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6 .
CREATE OBJECT grid1
EXPORTING
i_parent = custom_container1 .
CALL METHOD grid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = gs_layout
CHANGING
it_outtab = i_ekko .
create object event_receiver.
set handler event_receiver->handle_double_click for grid1.
endif.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid1 .
endmodule. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module USER_COMMAND_0100 input.
case sy-ucomm.
when 'CAN'.
leave program.
endcase.
perform exit_program.
endmodule. " USER_COMMAND_0100 INPUT
&----
*& Module STATUS_0101 OUTPUT
&----
text
----
module STATUS_0101 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
if custom_container2 is initial.
CREATE OBJECT custom_container2
EXPORTING
PARENT =
container_name = 'CONTAINER2'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6 .
CREATE OBJECT grid2
EXPORTING
i_parent = custom_container2 .
perform mask_columns tables gt_fieldcat.
CALL METHOD grid2->set_table_for_first_display
EXPORTING
IS_LAYOUT = gs_layout
CHANGING
it_outtab = i_ekpo
IT_FIELDCATALOG = gt_fieldcat[] .
else.
CALL METHOD grid2->refresh_table_display
endif.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid2 .
CALL METHOD cl_gui_cfw=>flush .
endmodule. " STATUS_0101 OUTPUT
&----
*& Module USER_COMMAND_0101 INPUT
&----
text
----
module USER_COMMAND_0101 input.
case sy-ucomm.
when 'RETURN'.
leave to screen 0.
endcase.
endmodule. " USER_COMMAND_0101 INPUT
&----
*& Form mask_columns
&----
text
----
-->P_GT_FIELDCAT text
----
form mask_columns tables p_gt_fieldcat type lvc_t_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_INTERNAL_TABNAME = 'i_ekpo'
CHANGING
ct_fieldcat = p_gt_fieldcat[].
loop at p_gt_fieldcat.
if p_gt_fieldcat-fieldname = 'EBELN'
or p_gt_fieldcat-fieldname = 'EBELP'.
p_gt_fieldcat-key_sel = 'X'.
p_gt_fieldcat-no_out = 'X'.
modify p_gt_fieldcat.
set left alignment for the two key fields left...
elseif p_gt_fieldcat-fieldname = 'EBELP'
or p_gt_fieldcat-fieldname = 'TXZ01'
or p_gt_fieldcat-fieldname = 'MATNR'
or p_gt_fieldcat-fieldname = 'WERKS'
p_gt_fieldcat-just = 'L'.
modify p_gt_fieldcat.
endif.
endloop.
endform. " mask_columns
&----
*& Form exit_program
&----
text
----
--> p1 text
<-- p2 text
----
form exit_program .
CALL METHOD custom_container1->free .
if not custom_container2 is initial.
CALL METHOD custom_container2->free .
ENDIF.
CALL METHOD cl_gui_cfw=>flush .
endform. " exit_program