12-23-2011 12:56 PM
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 !!
12-23-2011 1:30 PM
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..
06-29-2015 4:19 AM
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.
12-23-2011 1:33 PM
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
12-23-2011 1:53 PM
it hides all the custom button and keeping only the standard ones.
12-23-2011 1:55 PM
?? did you specify the function code assigned to your custom function button? This works....you have an error in your code.
12-23-2011 1:56 PM
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
12-23-2011 2:55 PM
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...
12-23-2011 3:02 PM
12-23-2011 4:32 PM
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.