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

Problem regarding Authorization object

Former Member
0 Likes
418

Hi friends,

In occupancy tab of REBDRO transaction, there is a field vacancy reason whose F4 help gives the multiple values.

Now, the requirement is to restrict the user to enter only a particular value.

To meet the above requirement, firstly I created an authorization object for the field Vacancy reason then in role i assigned the value '40' to the Vacancy reason field and '02' and '03' to the ACTVT field, then assigned the role to the user.

After that I created Enhancement implementation in which i wrote the code as-

AUTHORITY-CHECK OBJECT 'Z_VAC'

ID 'VACREASON' field '40'

ID 'ACTVT' FIELD '02' .

IF SY-SUBRC NE 0.

message 'You are not authorized to change the Vacancy Reason' type 'E'.

endif.

However, the SY-SUBRC remains zero for any value entered by the user i.e it does not restrict the user from entering value other than '40'.

Can somebody assist me regarding this, I will reward pts friends for the answers.

Thanks,

Rishi

2 REPLIES 2
Read only

Former Member
0 Likes
362

Sy-SUBRC is always zero because you have hardcoded value

of field VACREASON' as 40.

Instead of that give there screen field name in which user is entering value.

AUTHORITY-CHECK OBJECT 'Z_VAC'

ID 'VACREASON' field 'fieldname'

ID 'ACTVT' FIELD '02' .

IF SY-SUBRC NE 0.

message 'You are not authorized to change the Vacancy Reason' type 'E'.

endif.

Read only

Former Member
0 Likes
362