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

add a button to the pf_status using add_function

Former Member
0 Likes
6,361

Hi,

I want to add a button pf_status using cl_salv_table. I have search but i couldn't find useful things. I'm new on abap.

How can i add button?

I prepared the codes below:

METHOD SET_PF_STATUS.

     DATA: LO_FUNCTIONS TYPE REF TO CL_SALV_FUNCTIONS_LIST.

     LO_FUNCTIONS = CO_ALV->GET_FUNCTIONS( ).

     LO_FUNCTIONS->SET_ALL( ABAP_TRUE ).

     TRY.

         LO_FUNCTIONS->ADD_FUNCTION(

                     NAME     = 'BILFORM'

                     ICON     = '@DF@'

                     TEXT     = 'Bildirim Form'

                     TOOLTIP  = 'Bildirim Form'

                     POSITION = IF_SALV_C_FUNCTION_POSITION=>RIGHT_OF_SALV_FUNCTIONS ).

       CATCH CX_SALV_WRONG_CALL CX_SALV_EXISTING.

     ENDTRY.

     LO_FUNCTIONS->SET_LAYOUT_LOAD( ABAP_TRUE ).

     LO_FUNCTIONS->SET_LAYOUT_MAINTAIN( ABAP_TRUE ).

     LO_FUNCTIONS->SET_LAYOUT_SAVE( ABAP_TRUE ).

   ENDMETHOD.                    "set_pf_status

I couldn't understand, because i couldn't create the function.

3 REPLIES 3
Read only

Former Member
0 Likes
3,171

Hi,

You should use a reference to class CL_SALV_FUNCTIONS.

Please have a look to program SALV_DEMO_TABLE_FUNCTIONS...

Kr,

Manu.

Read only

0 Likes
3,171

Hi again,

I have searched about this, i tried something, but i couldn't make it.

Read only

0 Likes
3,171

Well, what about:

*... §3.1 activate ALV generic Functions
    data: lr_functions type ref to cl_salv_functions,
          l_text       type string,
          l_icon       type string.

    lr_functions = gr_table->get_functions( ).
    lr_functions->set_all( gc_true ).

*... §3.2 include own functions
    l_text = text-b01.
    l_icon = icon_complete.
    try.
      lr_functions->add_function(
        name     = 'MYFUNCTION'
        icon     = l_icon
        text     = l_text
        tooltip  = l_text
        position = if_salv_c_function_position=>right_of_salv_functions ).
      catch cx_salv_existing cx_salv_wrong_call.
    endtry.

This comes from SALV_DEMO_TABLE_FUNCTIONS. Have you try this way?

If you are displaying the ALV in fullscreen mode (without a container) then you should do as describe in form display_fullscreen and create your own pf-status in SE80.

Manu.