data: gr_selections typeref to CL_SALV_SELECTIONS.
******************************************************************************
* START-OF-SELECTION *
******************************************************************************
START-OF-SELECTION.
select * into corresponding fields of table ispfli from SPFLI up to 100 rows.
call method CL_SALV_TABLEfactory importing r_salv_table = gr_table
changing t_table = ispfli.
* Set up selections.
gr_selections = gr_tableget_selections( ).
ה( שימוש/הפעילות/האפשרותFunction) ה( מחלקהClass) ( שיטהMethod)
הגדרת/קביעתסוג( הבחירהSelection
Type Set)
CL_SALV_SELECTIONS
SET_SELECTION_MODE
השגת/קבלתסוג( הבחירהSelection Type
Get)
GET_SELECTION_MODE
gr_selectionsset_selection_mode( 1 ). " Single
* Display
gr_tabledisplay( ).
( אירוע מנהליEvent Handlers( האירוע עבור )Event:)-ADDED_FUNCTION( המחלקה באמצעותClass:)-
CL_SALV_EVENTS_TABLE
43.
הבא השלב(Next Step)יהיהיצירת/התאמת(מקומית מחלקהLocal Class Create)כ ישמש אשר ,( האירוע מנהלEvent Handler)במסגרת
הגדרת( האירוע מנהל שיטתEvent Handler Method Define)עבור( האירועEvent):-ADDED_FUNCTION.הגדרתשדה/משתנהשיוך/ייחוס
( האובייקטObject Reference Variable Define)ה עבורמחלקהה( מקומיתLocal Class).ה אובייקט לשגתאירועים(Events Object
Retrieve)מתוךGR_TABLEאובייקט צור/התאם ,( אירוע מנהלEvent Handler Object Create)ו-הגדר( האירוע מנהל שיטתEvent Handler
Method Set),לסיום .הוספת(Add)יישום( האירוע מנהל שיטתEvent Handler Method Implementation):-ON_USER_COMMAND.
report ZALVOM_DEMO3.
*======================================================================*
* Data Declaration *
*======================================================================*
data: ispfli type table of SPFLI, xspfli type SPFLI.
data: gr_table type ref to CL_SALV_TABLE.
data: gr_events type ref to CL_SALV_EVENTS_TABLE.
data: gr_selections type ref to CL_SALV_SELECTIONS.
************************************************************************
* SELECTION-SCREEN *
************************************************************************
* CLASS lcl_handle_events DEFINITION
*----------------------------------------------------------------------*
44.
class lcl_handle_events definition.
publicsection.
methods:
on_user_command for event added_function of CL_SALV_EVENTS
importing e_salv_function.
endclass. " lcl_handle_events DEFINITION
data: event_handler type ref to lcl_handle_events.
******************************************************************************
* START-OF-SELECTION *
******************************************************************************
START-OF-SELECTION.
select * into corresponding fields of table ispfli from SPFLI up to 100 rows.
call method CL_SALV_TABLEfactory importing r_salv_table =
gr_table changing t_table = ispfli.
gr_tableset_screen_status( pfstatus = 'SALV_TABLE_STANDARD'
report = SY-REPID
set_functions = gr_tablec_functions_all ).
gr_events = gr_tableget_event( ).
create object event_handler.
set handler event_handleron_user_command for gr_events.
* Set up selections.
gr_selections = gr_tableget_selections( ).
gr_selectionsset_selection_mode( 1 ). "Single
* Display
gr_tabledisplay( ).
************************************************************************
* CLASS lcl_handle_events IMPLEMENTATION *
************************************************************************
class lcl_handle_events implementation.
method on_user_command.
* Get the selection rows
data: lr_selections type ref to CL_SALV_SELECTIONS.
data: lt_rows type SALV_T_ROW.
data: ls_rows type i.
data: message type string.
case e_salv_function.
when 'CURRENT'. " 'MYFUNCTION'.
lr_selections = gr_tableget_selections( ).
lt_rows = lr_selectionsget_selected_rows( ).
read table lt_rows into ls_rows index 1.
read table ispfli into xspfli index ls_rows.
concatenate xspfli-carrid xspfli-connid xspfli-cityfrom xspfli-cityto
into message separated by space.
MESSAGE I001(00) with 'You pushed the button!' message.
45.
endcase.
endmethod.
endclass.
בעתהפעלה(""הרצה)( התוכניתRunProgram),( בחרSelect)/רשומה(שורהRow)באמצעות/הקשה( יחידה הקלדהSingle Clicking)
ו גביה על-( הקשה/הקלדהClick)גבי על( סמל/צלםIcon)עבורשימוש/פעילות/אפשרותחדש/ה(New Function)אשרנוסף(Added).
( להבחין ניתןNoticeמהנתוני חלק כי )/הרשומה( שורהRow Data)אשרהוקשה/הוקלדה(Clicked)ה במסגרת כעת מוצגת( הודעהMessage
).
( אירוע מנהליEvent Handlers( האירוע עבור )Event:)-DOUBLE_CLICK
הגדרת( האירוע מנהל שיטתEvent Handler Method Define)עבור( האירועEvent):-DOUBLE_CLICKו-הוספת(Add)יישוםמנהל שיטת
( האירועEvent Handler Method Implementation):-ON_DOUBLE_CLICKל לזכור יש .הגדיר/קבוע( האירוע מנהלEvent Handler Set).
report ZALVOM_DEMO3.
*======================================================================*
* Data Declaration *
*======================================================================*
data: ispfli type table of SPFLI, xspfli type SPFLI.
data: gr_table type ref to CL_SALV_TABLE.
data: gr_functions type ref to CL_SALV_FUNCTIONS_LIST.
data: gr_events type ref to CL_SALV_EVENTS_TABLE.
data: gr_selections type ref to CL_SALV_SELECTIONS.
************************************************************************
* SELECTION-SCREEN *
************************************************************************
************************************************************************
* CLASS lcl_handle_events DEFINITION *
************************************************************************
class lcl_handle_events definition.
public section.
46.
methods:
on_user_command for eventadded_function of CL_SALV_EVENTS
importing e_salv_function,
on_double_click for event double_click of CL_SALV_EVENTS_TABLE
importing row column.
endclass.
data: event_handler type ref to lcl_handle_events.
******************************************************************************
* START-OF-SELECTION *
******************************************************************************
START-OF-SELECTION.
select * into corresponding fields of table ispfli from SPFLI up to 100 rows.
call method CL_SALV_TABLEfactory importing r_salv_table = gr_table
changing t_table = ispfli.
gr_tableset_screen_status( pfstatus = 'SALV_TABLE_STANDARD' report = SY-REPID
set_functions = gr_tablec_functions_all ).
gr_events = gr_tableget_event( ).
create object event_handler.
set handler event_handleron_user_command for gr_events.
set handler event_handleron_double_click for gr_events.
* Set up selections.
gr_selections = gr_tableget_selections( ).
gr_selectionsset_selection_mode( 1 ). "Single
* Display
gr_tabledisplay( ).
************************************************************************
* CLASS lcl_handle_events IMPLEMENTATION *
************************************************************************
class lcl_handle_events implementation.
method on_user_command.
* Get the selection rows
data: lr_selections type ref to CL_SALV_SELECTIONS.
data: lt_rows type salv_t_row.
data: ls_rows type i.
data: message type string.
case e_salv_function.
when 'MYFUNCTION'.
lr_selections = gr_tableget_selections( ).
lt_rows = lr_selectionsget_selected_rows( ).
read table lt_rows into ls_rows index 1.
read table ispfli into xspfli index ls_rows.
concatenate xspfli-carrid xspfli-connid xspfli-cityfrom xspfli-cityto
into message separated by space.
MESSAGE I001(00) with 'You pushed the button!' message.
endcase.
endmethod.
*----------------------------------------------------------------------*
method on_double_click.
data: message type string.
data: row_c(4) type c.
row_c = row.