Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get functions method

former_member497886
Participant
0 Likes
3,872


Hello Experts

Happy new year to everyone.

Thanks for all the help till now.

I am again stuck with one of the issue. The scenario goes like this-

i am displaying full screen ALv grid output using class cl_salv_table.

I havw created a custom GUI status which has 3 buttons. I want to hide one of them based on certain condition.

following is the code which i have written-

data : lr_functions TYPE REF TO cl_salv_functions,
            lt_func_list TYPE salv_t_ui_func.

lr_functions = o_alv->get_functions( )

lt_func_list = lr_functions->get_functions( ).

the list which i get lt_func_list does not populate with all the application toolbar functions which i added.

Please help.

Thanks.

1 ACCEPTED SOLUTION
Read only

Domi
Active Contributor
0 Likes
2,039

Hi

for functions the ALV buffer is used (FM ALV_CHECK_BUFFER)

just reset the buffer after STATUS changes with e.g.

- Report BALVBUFDEL

- Report BCALV_BUFFER_DELETE

- FM ALV_DELETE_BUFFER

- TX /$SYNC <== !!! reset all buffer

or just set the SET/GET parameter ALVBUFFER to a future date, like:


     DATA l_tomorrow TYPE dats.

     l_tomorrow = sy-datum + 1.

     SET PARAMETER ID 'ALVBUFFER' FIELD l_tomorrow.

     gr_table->set_screen_status(

       pfstatus      = 'ALV_STATUS'

       report        = l_repid

       set_functions = cl_salv_table=>c_functions_none ).

Regards

2 REPLIES 2
Read only

rosenberg_eitan
Active Contributor
0 Likes
2,039

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 .

Result:

 

Regards.

Read only

Domi
Active Contributor
0 Likes
2,040

Hi

for functions the ALV buffer is used (FM ALV_CHECK_BUFFER)

just reset the buffer after STATUS changes with e.g.

- Report BALVBUFDEL

- Report BCALV_BUFFER_DELETE

- FM ALV_DELETE_BUFFER

- TX /$SYNC <== !!! reset all buffer

or just set the SET/GET parameter ALVBUFFER to a future date, like:


     DATA l_tomorrow TYPE dats.

     l_tomorrow = sy-datum + 1.

     SET PARAMETER ID 'ALVBUFFER' FIELD l_tomorrow.

     gr_table->set_screen_status(

       pfstatus      = 'ALV_STATUS'

       report        = l_repid

       set_functions = cl_salv_table=>c_functions_none ).

Regards