‎2008 Jun 02 2:04 PM
Hi,
When i use AUTHORITY_CHECK. It dumps with the following message
Error analysis
Only message types A, E, I, W, S, and X are allowed.
How to correct the error
Probably the only way to eliminate the error is to correct the program.
-
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"MESSAGE_TYPE_UNKNOWN" " "
"" or ""
"%_SEL_SCREEN_O"
at selection-screen OUTPUT.
CALL FUNCTION 'AUTHORITY_CHECK'
EXPORTING
USER = SY-UNAME
OBJECT = 'S_PROGRAM'
FIELD1 = 'ACTVT'
VALUE1 = ' '
EXCEPTIONS
USER_DONT_EXIST = 1
USER_IS_AUTHORIZED = 2
USER_NOT_AUTHORIZED = 3
USER_IS_LOCKED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
>>>>> MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
>>>>> is the Error stmt.
Regards,
FS
‎2008 Jun 02 2:20 PM
Hi,
Try the below code
AUTHORITY-CHECK OBJECT 'S_PROGRAM'
ID 'P_GROUP' FIELD 'MMDLMAT'
ID 'P_ACTION' FIELD 'SUBMIT'.
IF sy-subrc = 0.
MESSAGE 'User Has Authorization' TYPE 'S'.
ELSE.
MESSAGE 'User Has no authorization' TYPE 'E'.
ENDIF.
Refer the below documentation
Definition
Authorization to execute ABAP programs by program group.
You can assign authorizations by program group for the following
activities:
o Starting a program
o Scheduling a program to run as a background job
o Maintaining variants
Defined fields
The object consists of two fields:
o Authorization group ABAP program: Name of the program group that the
user is authorized to work with.
Programs that are not assigned to a program group can be started and
maintained by any user. The function does not support generic names.
o User action ABAP program: Permitted activities.
Possible values:
- SUBMIT: Start the program
- BTCSUBMIT: Schedule the program to run as a background job
- VARIANT: Maintain variants (The SUBMIT authorization is
necessary here as well, since programs are executed during
variant maintenance)
(The activity EDIT has been obsolete since Release 3.0. Authorizations
for attributes, text elements and ABAP utility functions are checked
using the S_DEVELOP object).
Example
This authorization allows a user to execute programs in the MMDLMAT
authorization group.
Field Value
Authorization group ABAP program MMDLMAT
User action ABAP program SUBMIT
Reward if found helpful.
Regards,
Boobalan Suburaj
‎2008 Jun 03 5:18 AM
Hi,
These are the standard Programs where the Authority_check is implemented.
LBTCHFXX
LCJ00U18
LCOPIU29
LCOPIU30
LCRFCU01
LSBPTU04
LSUSEU12
RSWUDI06
SAPMSQIO
Regards,
Jagadish.
‎2008 Jun 03 8:15 AM
hi,
I'm using the function module AUTHORITY_CHECK
In the object value I'm passing the Z program name in which i'm using AUTHORITY_CHECK. Whenever i execute the program it says i'm not authorized me being the owner of the program.
Please let me know if this is correct:
REPORT ZXYZ.
AT SELECTION-SCREEN OUTPUT.
CALL FUNCTION 'AUTHORITY_CHECK'
EXPORTING
USER = SY-UNAME
OBJECT = 'S_PROGRAM'
FIELD1 = 'ACTVT'
VALUE1 = 'ZXYZ'
EXCEPTIONS
USER_DONT_EXIST = 1
USER_IS_AUTHORIZED = 2
USER_NOT_AUTHORIZED = 3
USER_IS_LOCKED = 4
OTHERS = 5.
IF SY-SUBRC <> 2.
RESULT = sy-subrc.
CASE RESULT.
WHEN 1.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
TEXTLINE1 = 'User dont exist'.
LEAVE PROGRAM.
WHEN 2.
EXIT.
WHEN 3.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
TEXTLINE1 = 'User not authorized'.
LEAVE PROGRAM.
WHEN OTHERS.
LEAVE PROGRAM.
ENDCASE.
ENDIF.
Regards,
FS