User Logged In SAP Logon
Group Or Directly
How to check whether a user is logged in through logon
group or directly?
Solution:
This can be catch during logon time.
I remember at the times of the old OSS - when you tried
to logon directly to one of the application servers - you got the error
message: "Please don't use a direct logon but rather the group logon
- and you got logged of."
There's a user exit for that:
Note 37724 - Customer exits in SAP logon.
You may be able to modify the exit according to suit your
needs.
Note 609863 - How to lock out users using GUIs of wrong
version.
Here's some example code where you can create a table
whose users may directly logon to application servers. All others are kicked
out:
*DATA: it_zsbc_lm_config LIKE zsbc_lm_config OCCURS 1,
* wa_zsbc_lm_config LIKE LINE OF it_zsbc_lm_config,
* it_logondata TYPE bapilogond,
* it_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER
LINE,
* bapi_username TYPE xubname,
* can_logon TYPE c,
* errmessage(128) TYPE c.
*
*can_logon = ‘N’.
*
*SELECT
* *
*FROM
* zsbc_lm_config
*INTO TABLE
* it_zsbc_lm_config
*WHERE
* server = sy-host.
*IF sy-subrc = 0.
* “At this point, we know that a logon group restriction
has been
* “entered for this server
* bapi_username = sy-uname.
* CALL FUNCTION ‘BAPI_USER_GET_DETAIL’
* EXPORTING
* username = bapi_username
* IMPORTING
* logondata = it_logondata
* TABLES
* return = it_return.
* LOOP AT it_zsbc_lm_config INTO wa_zsbc_lm_config.
* IF wa_zsbc_lm_config-ugroup = it_logondata-class.
* can_logon = ‘Y’.
* ENDIF.
* ENDLOOP.
* IF can_logon = ‘N’.
* CONCATENATE
* ‘You are not authorized to log on to this server. Please’
* ‘choose a different server.’
* INTO
* errmessage
* SEPARATED BY
* space.
* CALL FUNCTION ‘POPUP_TO_INFORM’
* EXPORTING
* titel = ‘ERROR!’
* txt1 = errmessage
* txt2 = ‘You will now be logged off.’.
*
* CALL ‘SYST_LOGOFF’.
* ENDIF.
*
*ENDIF.
Get help for your Basis problems
Do you have
a SAP Basis Question?
SAP Basis Admin Books
SAP
System Administration, Security, Authorization, ALE, Performance Tuning
Reference Books
SAP Basis Tips
SAP BC Tips and
Basis Components Discussion Forum
Administration In
SAP - Sapgui, Unix, SAP ITS, Router, Client Copy and IDES
Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
All product names are trademarks of their respective
companies. The site www.erpgreat.com is in no way affiliated with
SAP AG.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
The content on this site may not be reproduced
or redistributed without the express written permission of
www.erpgreat.com or the content authors.
|