Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3316

Re: Get functions method

$
0
0

Hi,

 

How to use get_function:

 

Some code:

 

*----------------------------------------------------------------------*

*----------------------------------------------------------------------*

CLASS cl_event_receiver DEFINITION .

 

  PUBLIC SECTION.

 

    CONSTANTS: c_select_a TYPE salv_de_function VALUE 'Select_all ' .

    CONSTANTS: c_select_d TYPE salv_de_function VALUE 'Select_none' .

 

 

    METHODS added_function FOR EVENT added_function OF cl_salv_events

        IMPORTING e_salv_function .

 

ENDCLASS .                    "cl_event_receiver DEFINITION

*----------------------------------------------------------------------*

CLASS cl_event_receiver IMPLEMENTATION.

 

METHOD added_function .

 

* Your code....

  ENDMETHOD .

 

ENDCLASS .                    "cl_event_receiver IMPLEMENTATION

*----------------------------------------------------------------------*

*----------------------------------------------------------------------*

 

PBO:

 

 

 

DATA: ob_salv_functions    TYPE REF TO cl_salv_functions .

 

 

ob_salv_functions = ob_salv_table->get_functions( ) .

 

DATA: icon_name TYPE string .

DATA: icon_text TYPE string .

DATA: icon_tool TYPE string .

 

icon_name = icon_select_all .

icon_text = 'Select All' .

icon_tool = 'Select All Rows'  .

 

ob_salv_functions->add_function(

name     = cl_event_receiver=>c_select_a

icon     = icon_name

text     = icon_text

tooltip  = icon_tool

position = if_salv_c_function_position=>right_of_salv_functions  ) .

 

icon_name = icon_deselect_all .

icon_text = 'Deselect' .

icon_tool = 'Deselect All Rows'  .

 

ob_salv_functions->add_function(

name     = cl_event_receiver=>c_select_d

icon     = icon_name

text     = icon_text

tooltip  = icon_tool

position = if_salv_c_function_position=>right_of_salv_functions  ) .

 

DATA: ob_salv_events    TYPE REF TO cl_salv_events_table.

DATA: ob_event_receiver TYPE REF TO cl_event_receiver .

 

ob_salv_events = ob_salv_table->get_event( ).

 

  CREATE OBJECT ob_event_receiver

    EXPORTING

      ob_salv_table = ob_salv_table.

 

SET HANDLER ob_event_receiver->added_function       FOR ob_salv_events . 

  

Regards.


Viewing all articles
Browse latest Browse all 3316

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>