Report ZALV.
*=== class handler for ALV POPUP
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: gt_qmel TYPE TABLE OF qmel,
l_r_qmel TYPE qmel,
g_repid LIKE sy-repid,
gs_layout1 TYPE lvc_s_layo,
gt_fieldcat1 TYPE lvc_t_fcat WITH HEADER LINE,
cont_on_main TYPE scrfname VALUE 'ALV_CONTAINER',
grid2 TYPE REF TO cl_gui_alv_grid,
*=== references to custom container: neccessary to bind ALV Control
custom_container1 TYPE REF TO cl_gui_custom_container,
event_receiver TYPE REF TO lcl_event_receiver.
DATA: l_it_fieldcat TYPE lvc_t_fcat, l_wa_fieldcat TYPE lvc_s_fcat.
*&---------------------------------------------------------------------*
*CLASS lcl_event_receiver for double click
*----------------------------------------------------------------------
*=== class definition to Handle Double click
class lcl_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 lcl_event_receiver IMPLEMENTATION
*---------------------------------------------------------------------*
class lcl_event_receiver implementation.
method handle_double_click.
data: ls_qmel like line of gt_qmel.
*=== e_row contains the selected row index value
Read table gt_qmel index e_row-index into ls_qmel.
*=== notification which is selectd needs to be displayed
set parameter id 'IQM' field ls_qmel-qmnum.
call transaction 'QM03' and skip first screen .
endmethod. "handle_double_clickendclass.
*&---------------------------------------------------------------------*
*& Module STATUS_0809 OUTPUT
*&---------------------------------------------------------------------*
module status_0809 output.
*== set status set pf-status '0809'.
data: l_text(80) type c. g_repid = sy-repid.
* set the container for ALV if custom_container1 is initial.
create object custom_container1
exporting
container_name = cont_on_main
exceptions
cntl_error = 1 cntl_system_error = 2.
*=== create an instance of alv control
create object grid2 exporting i_parent = custom_container1.
*=== change title
concatenate text-111 ':' viqmel-kfz_ident_nr into l_text.
gs_layout-grid_title = l_text.
*=== adjust field catalog*=== to suppress the output of already displayed key fields of qmel perform field_catalog_103.
call method grid2->set_table_for_first_display
exporting
is_layout = gs_layout
changing
it_fieldcatalog = l_it_fieldcat[]
it_outtab = gt_qmel.
*=== Event for Double click
create object event_receiver.
set handler event_receiver->handle_double_click for grid2.
call method cl_gui_control=>set_focus exporting control = grid2.
call method cl_gui_cfw=>flush.
else.
call method grid2->refresh_table_display.
endif. "IF grid2 IS INITIAL.
endmodule. " STATUS_0809 OUTPUT
*&---------------------------------------------------------------------*
*& Form field_catalog.
*&---------------------------------------------------------------------*
form field_catalog_103.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'QMEL'
changing
ct_fieldcat = l_it_fieldcat[].
perform delete_feildcat_103.
endform. " mask_columns
*&---------------------------------------------------------------------*
*& Form delete_feildcat
*&---------------------------------------------------------------------*
form delete_feildcat_103.
*=== delete fieldcatalog other then the fieldname
delete l_it_fieldcat where ( fieldname ne 'MATNR' and fieldname ne 'SPART' and fieldname ne 'KUNUM' and fieldname ne 'QMNUM' ).
endform. " delete_feildcat
No comments:
Post a Comment