Sie sind auf Seite 1von 8

Generated by Jive on 2014-01-07+01:00

1
Advance notification for SAP userid (GUI)
validity expiration
1. Introduction
Scenario: Consider any SAP User in any SAP ABAP landscape who has a validity date expiring for its SAP
userid in 5 days. This user would not know his/her userid is expired until he/she is not able to logon to the
system after the 5
th
day and gets the SAP error message .
After this the user would need to follow the process of contacting helpdesk or his/her manager to
raise an appropriate validity extension request which would take SLA turnaround time of 1-2 days
with approvals. Till this time, the users work may be impacted.

Solution: To avoid this situation, this document provides the details of how to provide advance notification to
the SAP Users whose userids are bound to expire in near future say n number of days.
Advantage This would help them to take the necessary proactive action of raising the
appropriate approvals/requests to extend their validity date for userids well before they get
expired.

2. Prerequisites
v Every SAP Userids should have the Valid through date maintained in SU01 under tab Logon
Data field Valid through.
v Every SAP Userids correct email-id need to be maintained in the SAP ABAP system under
transaction code SU01 under tab Address field E-Mail Address.
v SMTP configuration needs to be set-up by SAP Basis team with the required exchange server details under
transaction code SCOT for the SAP system.

3. Solutions

We are listing below 2 possible solutions depending upon limitation on configuration of SMTP in the existing
SAP system environment.

Solution I: Due to business reasons, if SMTP configuration cannot be activated. Then an enhancement would
be required to be included in the appropriate user exit.
The expiring users would get a notification pop-up stating a reminder of in number of days when their
validity would be expired & the process to get it extended.
Advance notification for SAP userid (GUI) validity expiration
Generated by Jive on 2014-01-07+01:00
2

Limitation: The userid needs to logon to SAP system within the window before the validity expiration date.


Solution II: If STMP is configured in the SAP system, a daily background job would run an ABAP report and
perform below 3 steps:
i. Fetch all user id(s) expiring in n number of days.
ii. Get user emailid details from USR21 and ADR6 tables for all the user(s) fetched in step i.
iii. If Email id is maintained in system, then send Email to all the user(s) as reminder for validity
extension.

4. Steps required to implement the Solution I

1) Execute transaction CMOD (Project maintenance). Enter a custom project name.
2) Goto Enhancement window by clicking the enhancement button in the application tool bar. Write
SUSR0001 in the enhancement column and press enter.


3) Goto Components window where it will show the exits included in the enhancement. Double click on the
Function exit EXIT_SAPLSUSF_001.

4) The following function source code will be displayed in the function editor. Double click on the include
ZXUSRU01. If it will ask to create the include say yes.
5) In the ZXUSRU01 include, write the following code.

*&---------------------------------------------------------------------*
*& Include ZXUSRU01
*&---------------------------------------------------------------------*

DATA w_text(50) TYPE c.

DATA w_date(10) TYPE c.
DATA: lv_gltgb TYPE xugltgb,
lv_datum TYPE sy-datum,
lv_num TYPE string.

SELECT SINGLE gltgb FROM usr02 INTO lv_gltgb WHERE bname = sy-uname.
IF sy-subrc EQ 0 AND lv_gltgb IS NOT INITIAL.

lv_datum = sy-datum + 10.
IF lv_datum GE lv_gltgb.
Advance notification for SAP userid (GUI) validity expiration
Generated by Jive on 2014-01-07+01:00
3
lv_num = lv_gltgb - sy-datum.
IF lv_num = 0.
w_text = 'ATTENTION! Your validity expires TODAY !!! .'.
ELSE.
CONCATENATE 'Your validity expires in ' lv_num 'days !!! .' INTO w_text SEPARATED BY space.
ENDIF.


CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Note: Validity is expiring!'
txt1 = w_text
txt2 = 'For extension of the validity, please contact <<ABC>> Support Team.'.

ENDIF.
1. ENDIF.


6) Now, save the include and activate it. Also, activate the project by going to the menu in CMOD transaction.
Our required user exit SUSR0001 has now been implemented and is ready to use.

5. Screen-prints of Solution I implementation
in SAP

Here we see below a userid TEST is having the Valid through date set as 02.11.2013 in SU01
transaction. Let assume todays date, the system date is 29.10.2013.

Advance notification for SAP userid (GUI) validity expiration
Generated by Jive on 2014-01-07+01:00
4
When the TEST user logs on to the SAP system, where this functionality is activated, it will get
the below pop-up window as required.

Advance notification for SAP userid (GUI) validity expiration
Generated by Jive on 2014-01-07+01:00
5
From the variable setting in the code; this pop-up notification would be displayed from 10 days before userid
expiration, till the last day. Below is the last day notification:



Thus the required advance notification is displayed to users on their expiring userids in SAP systems using
solution I.

6. Steps required to implement the Solution II

If STMP is configured in the SAP system, a daily background job would run an ABAP report and perform below
3 steps:
i. Fetch all user id(s) expiring in n number of days.

ii. Get user email-id details from USR21 and ADR6 tables for all the user(s) fetched in above step.
iii. If Email id is maintained in system, then send Email to all the user(s) as reminder for validity extension.

7. ABAP Report Code for Solution II

Here we can create an ABAP report ZUSER_VALIDITY_CHECK which would perform all the
above 3 steps for implementation of solution II.
Advance notification for SAP userid (GUI) validity expiration
Generated by Jive on 2014-01-07+01:00
6
Note that; in our case for the step (iii) we have e-mailed the notification reminder to users SAP
inbox (Business Workplace) rather than the mailbox exchange server configured in SMTP of that
SAP system.
If your SAP system has STMP configured, then in the attached code only below line should be replaced
and every SAP Userids has
correct email-id maintained in the SAP ABAP system under transaction code SU01 under :: tab
Address :: field E-Mail Address.

For SAP inbox :: wa_reclist-rec_type = 'B'.
For SMTP exchange server :: wa_reclist-rec_type = 'A'.


8. Solution II implementation in SAP

Here we see below 2 userids have separate Valid through dates set in SU01 transaction. Note;
todays date, the system date, is 31.10.2013.

1
st
Userid : TEST
User name : Test user
Valid through date set : 09.11.2013
User expiring in : 9 days!


Below is the ABAP report ZUSER_VALIDITY_CHECK initial screen. It can be scheduled in
background job via the menu Program :: Execute in background option.

The P_DAYS field is an input field where you can customize the report to execute for how many
days/duration the expired users expiration are checked.
Here in our case, we are checking for all the expiring users in next 10 days, so the value for
P_DAYS is 10.

Advance notification for SAP userid (GUI) validity expiration
Generated by Jive on 2014-01-07+01:00
7
Now, we check the SAP Inbox/Business Workplace for our 2 users for the email.

Output email for UserID TEST :



Advance notification for SAP userid (GUI) validity expiration
Generated by Jive on 2014-01-07+01:00
8
This completes our solutions to the requirement discussed in the introduction.

Hope this will help you in your projects.

Das könnte Ihnen auch gefallen