2013 Oct 28 5:58 PM
Hi guys,
I need to do a validation of some users (like this)
IF SY-UNAME = 'ES1234' AND SY-UNAME = 'FR2345' AND [......] " lots of users
ADD 1 TO CONT.
MESSATE S34(ZHR) TYPE 'I'.
ENDIF.
The quantity of users are a lot to write 'IF SY-UNAME = ''
I don't know if I can use a rol or something like this.
Thanks a lot.
Best regards.
Ana.
2013 Oct 29 5:24 AM
Hi Ana,
If all the user fall into a single role, then you can use authorization object which can be assigned to the ROLE.. And in your program you can check that authorization object's value and write your code accordingly.
Check the following link:
Hope this helps.
Regards,
Ajit
2013 Oct 28 6:09 PM
Hi Ana,
I do not think you should hard code the user ids. Can they be put into a configuration type of table and retrieved in the program and loaded into a range table? Then you can use "If sy-uname in r_uname....
Regards,
Steve
2013 Oct 28 9:08 PM
Never hard code checks on user IDs. Please explain more about the rationale for this check, otherwise it is not possible to recommend a good solution.
Thomas
2013 Oct 28 9:41 PM
Hi Ana,
In case of some kind of validation, usually the best practice is to create configuration table along with a simple program for filling the entries. Then when you need to validate something in any of your programs you can just declare you configuration table, e.g. :
TABLES: zconf1.
and then do an 'empty' select:
SELECT SINGLE * FROM zconf1
WHERE some condition.
IF sy-subrc = 0.
Entry exists.
ELSE.
Entry doesn't exists.
ENDIF.
Hope it helps.
Best regards,
Vladimir
2013 Oct 29 2:10 AM
Hi,
In this case, I recommend you use user group(Tab Groups in SU01).
Groups can be maintained in SUGR.
The user's group information is stored in table USGRP_USER.
Thanks.
Jim
2013 Oct 29 5:24 AM
Hi Ana,
If all the user fall into a single role, then you can use authorization object which can be assigned to the ROLE.. And in your program you can check that authorization object's value and write your code accordingly.
Check the following link:
Hope this helps.
Regards,
Ajit
2013 Oct 30 5:18 PM
Thanks Ajit . I have do it a new role with all users.
Then I used the function module 'CRM_ROLES_OF_USER_GET' , in the report to validate the user.
CALL FUNCTION 'CRM_ROLES_OF_USER_GET'
EXPORTING
USER_NAME = SY-UNAME
TABLES
ROLES_OF_USER = T_ROLES
EXCEPTIONS
NO_ROLES_AVAILABLE = 1
OTHERS = 2.
Thanks to all.
Regards.
Ana.
2013 Oct 29 6:56 AM
If the users in question are only technical users (developers and other geeks), who want to see some technical background of the program, I would recommend a log-point or even break-point with checkpoint ID. Users can subscribe to the checkpoint ID using transaction SAAB.Only when they activated the checkpoint for themselves, the data will be logged at the log-point, and only then the system will stop at a "break-point id ..." statement.
See