Application Development 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: 

pf status- hide self created custom button

Former Member
0 Kudos

i have created one custom pf status.. with some standard buttons and few mine custom..

now i want hide one of custom whose fcode is XYZ depending on some condition on selection screen,, unable to acieve it,,,, seek help !!

9 REPLIES 9

Former Member
0 Kudos

what i have done is ..

DATA: lo_functions TYPE REF TO cl_salv_functions,
            lt_func_list TYPE salv_t_ui_func,
            la_func_list LIKE LINE OF lt_func_list,
            found TYPE abap_bool.

  lo_functions = lo_alv->get_functions( ).
  lt_func_list = lo_functions->get_functions( ).
  LOOP AT lt_func_list INTO la_func_list.
    IF la_func_list-r_function->get_name( ) = 'XYZ'.
      found = abap_true.
      la_func_list-r_function->set_visible( ' ' ).
      EXIT.
    ENDIF.
  ENDLOOP.

the loop loops through all the standard functions.. suppose instead of 'XYZ' if i give '&DETAIL'... FOUND variable becomes true..

but it never finds 'XYZ' so i cant hide it... seems like it only loops through .. standard functions..

suggest accurate solutions..

Hi,

Know that this is an old question, but I faced the same issue recently and somehow discovered that newly added functions are not visible via get_functions method call. But if you create a new copy of your pf-status and use it everything will work just fine.

Former Member
0 Kudos

Hi,

SET PF-STATUS 'STATUS' excluding FCTcode.

Based on condition use the set pf_status with the exculding keyword so that the keyword will disable.

Regards,

G.Aditya

0 Kudos

it hides all the custom button and keeping only the standard ones.

0 Kudos

?? did you specify the function code assigned to your custom function button? This works....you have an error in your code.

0 Kudos

basically code looks like ..

DATA : lo_alv      TYPE REF TO cl_salv_table,
         lo_function TYPE REF TO cl_salv_functions_list,
         lo_cols     TYPE REF TO cl_salv_columns,
         lo_events   TYPE REF TO cl_salv_events_table,
         lo_event    TYPE REF TO lcl_handle_events,

TRY .
      cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv
                              CHANGING  t_table      = pc_t_output ).
      lo_alv->set_screen_status( pfstatus      = 'STATUS'
                                 report        = sy-repid
                                 set_functions = lo_alv->c_functions_all ).
    CATCH cx_salv_msg.
  ENDTRY.
lo_function = lo_alv->get_functions( ).
  lo_function->set_all( ).
  lo_function->set_group_aggregation( ).
  lo_function->set_group_export( ).
  lo_function->set_group_filter( ).
  lo_function->set_group_layout( ).
  lo_function->set_group_sort( ).
  lo_function->set_group_subtotal( ).
  lo_function->set_group_view( ).

'STATUS' is combination of standard plus 3 customs.. i now i want to hide .. 1 custom button... can you tweak it... m confused

0 Kudos

Why cant you do like this..

after setting pf-status

lo_functions->enable_function( name = 'XYZ' boolean = space ).
or
lo_functions->REMOVE_FUNCTION( name = 'XYZ' ).

I personally not tried.. u can try...

0 Kudos

Short dump...

exception.. wrong call..

Former Member
0 Kudos

Hi,

As you want to hide the custom buttons on some condition do the same in AT SELECTION SCREEN OUTPUT event

AT SELECTION-SCREEN OUTPUT.
 
  REFRESH fcode.
 
  IF s_inc IS INITIAL.
    APPEND 'CRTE' TO fcode.
    APPEND 'CHNG' TO fcode.
    APPEND 'DISP' TO fcode.
    APPEND 'PRNI' TO fcode.
    APPEND 'CRTL' TO fcode.
    *SET PF-STATUS 'STATUS_IN' EXCLUDING fcode.* 
  ENDIF.

Thanks,

Shailaja Ainala.