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: 

Authority check

former_member156446
Active Contributor
0 Kudos

Can some body explain me the below code...

AUTHORITY-CHECK OBJECT 'S_TRVL_BKS'

ID 'ACTVT' FIELD '02'

ID 'CUSTTYPE' FIELD 'B'.

IF SY-SUBRC <> 0.

MESSAGE E...

ENDIF.

I know that Object is the authority object..

what is ACTVT ? field 01 02 03 for c / v / display

what is CUSTTYPE and field B?

how to code if I want to add authorization to some field say ' it_itab-cost'.

Thank you.

2 REPLIES 2

Former Member
0 Kudos

The ACTVT field indicates what kind of authority you want to check for. In this case 02 indicates that you are checking to make sure that the user has been granted the authority to change.

The custtype field is a field defined in the authorization object 'S_TRVL_BKS', in this case this looks like a standard SAP authorization object. The security people when they setup this authorization object will configure it so that only certain CUSTTYPE's have the ACTVT = 02 setup which means only certain user will have the authority to change.

So to summarize when the statement you have given is executed, this statement will check the configuration of authorization object 'S_TRVL_BKS' to see if the current user has the authority to change for CUSTTYPE = B. If the user does have the authority to change the sy-subrc will be zero, else it will be non-zero, in which case a message will be shown. If this helps please give points

former_member156446
Active Contributor
0 Kudos

thanks