‎2008 Jul 21 5:29 AM
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
‎2008 Jul 21 5:39 AM
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.
‎2008 Jul 21 6:10 AM
Hi,
Refer this link,it may help you-
http://help.sap.com/saphelp_nw70/helpdata/en/52/6712ac439b11d1896f0000e8322d00/content.htm
http://articles.techrepublic.com.com/5100-10878_11-5110893.html
/thread/871214 [original link is broken]
Regards,
Sujit