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

Authority check

Former Member
0 Likes
1,228

Hi Guru's,

I am creating one authority object(YXC_OM) in a T-code , the authority should be users from sales org 'GR01' is only able to use the T-Code also i have to restrict the Activity to

Create, Change and Display, Execute, Maintain, Confirm, Save, Delete, update , Enter, cancel

Currently i am using the following code. But it is giving me a dump, can somebody tell me what wrong thing i am doing?

I have never worked with authority object before.

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '01'

ID 'ACTVT' FIELD '02'

ID 'ACTVT' FIELD '03'

ID 'ACTVT' FIELD '06'

ID 'ACTVT' FIELD '16'

ID 'ACTVT' FIELD '21'

ID 'ACTVT' FIELD '31'

ID 'ACTVT' FIELD '32'

ID 'ACTVT' FIELD '76'

ID 'ACTVT' FIELD 'G7'.

Regards,

Khan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
697

At a time activity field can take only one value But u have specified multiple one at the same time thats why it is giving dump.

It should be like this:

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '01'.

if Create, Change and Display, Execute, Maintain, Confirm, Save, Delete, update , Enter, cancel means all the access for the activity then u can put '*' for ACTVT. Like:

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '*'.

Otherwise u have to check one by one..like

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '01'.

if sy-subrc = 0.

endif.

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '02'.

if sy-subrc = 0.

endif.

................

................

................

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD 'G7'.

if sy-subrc = 0.

endif.

Regards,

Joy.

Hi Guru's,

I am creating one authority object(YXC_OM) in a T-code , the authority should be users from sales org 'GR01' is only able to use the T-Code also i have to restrict the Activity to

Create, Change and Display, Execute, Maintain, Confirm, Save, Delete, update , Enter, cancel

Currently i am using the following code. But it is giving me a dump, can somebody tell me what wrong thing i am doing?

I have never worked with authority object before.

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '01'

ID 'ACTVT' FIELD '02'

ID 'ACTVT' FIELD '03'

ID 'ACTVT' FIELD '06'

ID 'ACTVT' FIELD '16'

ID 'ACTVT' FIELD '21'

ID 'ACTVT' FIELD '31'

ID 'ACTVT' FIELD '32'

ID 'ACTVT' FIELD '76'

ID 'ACTVT' FIELD 'G7'.

Regards,

Khan

2 REPLIES 2
Read only

Former Member
0 Likes
698

At a time activity field can take only one value But u have specified multiple one at the same time thats why it is giving dump.

It should be like this:

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '01'.

if Create, Change and Display, Execute, Maintain, Confirm, Save, Delete, update , Enter, cancel means all the access for the activity then u can put '*' for ACTVT. Like:

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '*'.

Otherwise u have to check one by one..like

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '01'.

if sy-subrc = 0.

endif.

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD '02'.

if sy-subrc = 0.

endif.

................

................

................

AUTHORITY-CHECK OBJECT 'YXC_OM'

ID 'VKORG' FIELD 'GR01'

ID 'ACTVT' FIELD 'G7'.

if sy-subrc = 0.

endif.

Regards,

Joy.

Read only

Former Member
0 Likes
697

Hi ,

It already helped me a bit, but can you guys tell me, if i pass any variable instead of the value will it work or not?

AUTHORITY-CHECK OBJECT 'XP_OM'

ID 'VKORG' FIELD LV_VKORG

ID 'ACTVT' FIELD '06'.

IF SY-SUBRC NE 0.

perform AUTHORITY_ERROR_MSG.

ENDIF.

In the above code, i have one variable LV_VKORG which is having the value GR01, so will this code work or not.