0% found this document useful (0 votes)
270 views3 pages

Calling A Popup and Setting A Link Click and Event and Setting A GUI Status

The document describes the definition and implementation of a CLASS called cl_event_handler. The class contains methods that handle events for a SALV table object. The methods include event handlers for before/after SALV functions, added functions, top/end of page, and double click/link click. The code sample then shows how sample data is loaded into an internal table and the SALV table is displayed, attaching the event handler class methods.

Uploaded by

aravindsap123
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
270 views3 pages

Calling A Popup and Setting A Link Click and Event and Setting A GUI Status

The document describes the definition and implementation of a CLASS called cl_event_handler. The class contains methods that handle events for a SALV table object. The methods include event handlers for before/after SALV functions, added functions, top/end of page, and double click/link click. The code sample then shows how sample data is loaded into an internal table and the SALV table is displayed, attaching the event handler class methods.

Uploaded by

aravindsap123
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

PROGRAM zkmalve2.

DATA: gt_usr gs_usr

TYPE TABLE OF usr02, TYPE usr02.

*----------------------------------------------------------------------* * CLASS cl_event_handler DEFINITION *----------------------------------------------------------------------* CLASS cl_event_handler DEFINITION. PUBLIC SECTION. CLASS-METHODS on_before_salv_function " BEFORE_SALV_FUNCTION FOR EVENT if_salv_events_functions~before_salv_function OF cl_salv_events_table IMPORTING e_salv_function. CLASS-METHODS on_after_salv_function " AFTER_SALV_FUNCTION FOR EVENT if_salv_events_functions~before_salv_function OF cl_salv_events_table IMPORTING e_salv_function. CLASS-METHODS on_added_function " ADDED_FUNCTION FOR EVENT if_salv_events_functions~added_function OF cl_salv_events_table IMPORTING e_salv_function. CLASS-METHODS on_top_of_page FOR EVENT if_salv_events_list~top_of_page OF cl_salv_events_table IMPORTING r_top_of_page page table_index. CLASS-METHODS on_end_of_page FOR EVENT if_salv_events_list~end_of_page OF cl_salv_events_table IMPORTING r_end_of_page page. " TOP_OF_PAGE

" END_OF_PAGE

CLASS-METHODS on_double_click " DOUBLE_CLICK FOR EVENT if_salv_events_actions_table~double_click OF cl_salv_events_table IMPORTING row column. CLASS-METHODS on_link_click " LINK_CLICK FOR EVENT if_salv_events_actions_table~link_click OF cl_salv_events_table IMPORTING row column. ENDCLASS. "cl_event_handler DEFINITION *----------------------------------------------------------------------*

* CLASS cl_event_handler IMPLEMENTATION *----------------------------------------------------------------------* CLASS cl_event_handler IMPLEMENTATION. METHOD on_before_salv_function. BREAK-POINT. ENDMETHOD. "on_before_salv_function METHOD on_after_salv_function. BREAK-POINT. ENDMETHOD. "on_after_salv_function METHOD on_added_function. BREAK-POINT. ENDMETHOD. METHOD on_top_of_page. BREAK-POINT. ENDMETHOD. METHOD on_end_of_page. BREAK-POINT. ENDMETHOD. METHOD on_double_click. BREAK-POINT. ENDMETHOD. METHOD on_link_click. BREAK-POINT. ENDMETHOD. ENDCLASS.

"on_added_function

"on_top_of_page

"on_end_of_page

"on_double_click

"on_link_click "cl_event_handler IMPLEMENTATION

*&---------------------------------------------------------------------* *& START-OF-SELECTION *&---------------------------------------------------------------------* START-OF-SELECTION. * read sample data to internal table SELECT * FROM usr02 UP TO 30 ROWS APPENDING CORRESPONDING FIELDS OF TABLE gt_usr ORDER BY bname. PERFORM display_alv. *&---------------------------------------------------------------------* *& Form display_alv *&---------------------------------------------------------------------* FORM display_alv. DATA: lo_table lo_events lo_columns lo_column

TYPE TYPE TYPE TYPE

REF REF REF REF

TO TO TO TO

cl_salv_table, cl_salv_events_table, cl_salv_columns_table, cl_salv_column_list.

TRY. CALL METHOD cl_salv_table=>factory IMPORTING r_salv_table = lo_table CHANGING t_table = gt_usr. lo_events = SET HANDLER SET HANDLER SET HANDLER SET HANDLER SET HANDLER SET HANDLER SET HANDLER * lo_table->get_event( ). cl_event_handler=>on_before_salv_function FOR lo_events. cl_event_handler=>on_after_salv_function FOR lo_events. cl_event_handler=>on_added_function FOR lo_events. cl_event_handler=>on_top_of_page FOR lo_events. cl_event_handler=>on_end_of_page FOR lo_events. cl_event_handler=>on_double_click FOR lo_events. cl_event_handler=>on_link_click FOR lo_events.

ALV-Toolbar lo_table->set_screen_status( pfstatus = 'STANDARD_FULLSCREEN' report = 'SAPLSLVC_FULLSCREEN' set_functions = lo_table->c_functions_all ). Set column as hotspot lo_columns = lo_table->get_columns( ). lo_column ?= lo_columns->get_column( 'BNAME' ). lo_column->set_cell_type( if_salv_c_cell_type=>hotspot ). lo_table->display( ). CATCH cx_salv_msg. " cl_salv_table=>factory() WRITE: / 'cx_salv_msg exception'. STOP. CATCH cx_salv_not_found. " cl_salv_columns_table->get_column() WRITE: / 'cx_salv_not_found exception'. STOP.

Note: CX_ROOT is the root exception for all the CL_SALV_TABLE ENDTRY. ENDFORM. "display_alv

You might also like