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

PF-STATUS: Get function codes

Former Member
0 Likes
1,935

Hi forum,

I'm programming with dynpros, and I have to include an Authority Check in order to control access to my application. Well, the auth check setup includes a function codes blocking, i. e., gray-coloured texts and deactivated function for the menu bar elements. My question is, how can I get the function codes in a dynpro? I tried with method if_wb_program~wb_manager->get_status, but it generates an error. May be any execution environment.

Does exist any FM, Method, or table reading in order to get the function codes?

My target is set PF-STATUS, and fill the table g_ti_excl_fcodes:

SET PF-STATUS p_status EXCLUDING g_ti_excl_fcodes.

Thanks in advance,

JORGE ROJAS

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
810

Here you go:


  data:
    l_is_allowed        type sap_bool,
    lt_exclude_fcode    like rsmpe-func occurs 10,
    ls_function_list    like rsmpe_funl,
    lt_function_list    like rsmpe_funl occurs 10.
*
* Read in the functions defined in the PF-STATUS
*
  call function 'RS_CUA_GET_STATUS_FUNCTIONS'
    exporting
      language      = sy-langu
      program       = gc_this_program  "set a constant somewhere
      status        = '0300_UPDATE'    "GUI status name
    tables
      function_list = lt_function_list
    exceptions
      others        = 1.

  if not sy-subrc is initial.
    exit.  "... internal error!
  endif.
*
* Then do your exclude logic e.g.
*
  loop at lt_function_list into ls_function_list.

    perform some_business_rule  "your code...
      using
        ls_function_list-fcode
      changing
        l_is_allowed.  "X or space = sap_bool

    if l_is_allowed = gc_is_false.  "space
      append ls_function_list-fcode to lt_exclude_fcode.
    endif.

  endloop.

Jonathan

2 REPLIES 2
Read only

Former Member
0 Likes
811

Here you go:


  data:
    l_is_allowed        type sap_bool,
    lt_exclude_fcode    like rsmpe-func occurs 10,
    ls_function_list    like rsmpe_funl,
    lt_function_list    like rsmpe_funl occurs 10.
*
* Read in the functions defined in the PF-STATUS
*
  call function 'RS_CUA_GET_STATUS_FUNCTIONS'
    exporting
      language      = sy-langu
      program       = gc_this_program  "set a constant somewhere
      status        = '0300_UPDATE'    "GUI status name
    tables
      function_list = lt_function_list
    exceptions
      others        = 1.

  if not sy-subrc is initial.
    exit.  "... internal error!
  endif.
*
* Then do your exclude logic e.g.
*
  loop at lt_function_list into ls_function_list.

    perform some_business_rule  "your code...
      using
        ls_function_list-fcode
      changing
        l_is_allowed.  "X or space = sap_bool

    if l_is_allowed = gc_is_false.  "space
      append ls_function_list-fcode to lt_exclude_fcode.
    endif.

  endloop.

Jonathan

Read only

0 Likes
810

Jonathan

Thanks so much for your answer. It was so fast and clear, really.

Thanks a lot, again.

JORGE ROJAS