Um mit Loriot zu antworten: Ach!a-dead-trousers hat geschrieben:Debuggen
Code: Alles auswählen.
class lcl_handler_2002 definition.
public section.
methods: (...)
, on_f4_2002
for event onf4 of cl_gui_alv_grid
importing es_row_no
.
endclass. "LCL_ALV_HANDLER DEFINITION
class lcl_handler_2002 implementation.
(...)
method on_f4_2002.
perform handle_f4_2002 using es_row_no.
endmethod. "on_f4_2002
endclass. "lcl_handler_2002 IMPLEMENTATION
Code: Alles auswählen.
form pbo_2002 .
data: ls_layout type lvc_s_layo
, lt_excl_func type ui_functions
, lt_fieldcat type lvc_t_fcat
, ls_fieldcat type lvc_s_fcat
, lt_f4 type lvc_t_f4
, ls_f4 type lvc_s_f4
.
perform produktid_ermitteln.
************************************************************************
* Custom-Container für Dynpro aufbauen
************************************************************************
if g_gpcontainer is initial.
perform: fieldcat_2002 changing lt_fieldcat
, toolbar_function_2002 changing lt_excl_func
.
create object g_gpcontainer
exporting
container_name = 'GPCONTAINER'.
create object g_gpgrid
exporting
i_parent = g_gpcontainer.
************************************************************************
* ALV-Layout definieren
************************************************************************
move: 'X' to ls_layout-zebra
, 'X' to ls_layout-col_opt
, 'FARBE' to ls_layout-ctab_fname
, 'ZEILE' to ls_layout-stylefname
.
************************************************************************
* Eingabeevent registrieren
************************************************************************
call method g_gpgrid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter
exceptions
others = 0.
call method g_gpgrid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified
exceptions
others = 0.
************************************************************************
* F4-Hilfe definieren
************************************************************************
move: 'ROLE' to ls_f4-fieldname
, 'X' to ls_f4-register
, 'X' to ls_f4-chngeafter
.
append ls_f4 to lt_f4.
call method g_gpgrid->register_f4_for_fields
exporting
it_f4 = lt_f4.
************************************************************************
* * ALV ausgeben
************************************************************************
call method g_gpgrid->set_table_for_first_display
exporting
i_structure_name = 'ZCRT_GPZUORD_T'
is_layout = ls_layout
it_toolbar_excluding = lt_excl_func
changing
it_outtab = gt_gpzuord
it_fieldcatalog = lt_fieldcat.
************************************************************************
* ALV auf eingabebereit setzen
************************************************************************
call method g_gpgrid->set_ready_for_input
exporting
i_ready_for_input = 1.
create object g_gphandler.
set handler: g_gphandler->on_toolbar_2002 for g_gpgrid
, g_gphandler->on_user_command_2002 for g_gpgrid
, g_gphandler->on_f4_2002 for g_gpgrid
.
call method g_gpgrid->set_toolbar_interactive.
else.
refresh lt_fieldcat.
perform fieldcat_2002 changing lt_fieldcat.
call method g_gpgrid->set_frontend_fieldcatalog
exporting
it_fieldcatalog = lt_fieldcat.
call method g_gpgrid->refresh_table_display
exceptions
finished = 1
others = 2.
endif.
endform. " pbo_2002