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: 

How to hiden buttons by permission

1190_5939_439
Active Participant
0 Kudos

Hi Experts

In the bellow screenshot there are two buttons. Now as business requirement is changed, I need hiden buttons by permission.

IE. When I open it and I will find the two buttons.The others don't find it.

Thanks in advance.

1 ACCEPTED SOLUTION

matt
Active Contributor

SET PF-STATUS has an EXCLUDING addtion - check the ABAP documentaiton for details.

You need something like:

DATA exclusions TYPE STANDARD TABLE OF okcode.
AUTHORITY-CHECK for_button_1...
IF sy-subrc IS NOT INITIAL.
  INSERT c_okcode_for_button_1 INTO TABLE exclusions.
ENDIF
AUTHORITY-CHECK for_button_2...
IF sy-subrc IS NOT INITIAL.
  INSERT c_okcode_for_button_2 INTO TABLE exclusions.
ENDIF.
SET PF-STATUS 'MYSTATUS' EXCLUDING exclusions.
4 REPLIES 4

matt
Active Contributor

SET PF-STATUS has an EXCLUDING addtion - check the ABAP documentaiton for details.

You need something like:

DATA exclusions TYPE STANDARD TABLE OF okcode.
AUTHORITY-CHECK for_button_1...
IF sy-subrc IS NOT INITIAL.
  INSERT c_okcode_for_button_1 INTO TABLE exclusions.
ENDIF
AUTHORITY-CHECK for_button_2...
IF sy-subrc IS NOT INITIAL.
  INSERT c_okcode_for_button_2 INTO TABLE exclusions.
ENDIF.
SET PF-STATUS 'MYSTATUS' EXCLUDING exclusions.

1190_5939_439
Active Participant
0 Kudos

Hi Matthew

When I try to use it as your method. But I don't know how define authorization object ? Thanks.

matt
Active Contributor
0 Kudos

That's covered in help.sap com and many online blogs and tutorials.

Often though, you should be using an existing object. Ask your security team or functional team

1190_5939_439
Active Participant