Skip to Content
Technical Articles
Author's profile photo Former Member

Utility Tool – Program To Lock Inactive Users

Requirement: A program with functionality to identify and notify users who have not logged in the system for a certain time period. Program should send log-in reminder e-mail to users for two time stamps; for the third time stamp, it should lock user accounts and send e-mails notifying users of account expiration.

This program should generate a consolidated report having all the users notified by e-mail with their corresponding statuses.

This program should have a ‘Test Run’ Mode where user can execute and see the report with user account status without actually locking accounts or sending e-mails.

 

Solution Explanation: The program logic for this requirement is attached with this document. The current time stamps considered in the program for first e-mail reminder is 50 days and for second reminder it is 80 days. If the user has not logged in for 90 days or more (third time stamp) then user account will be locked and user will be notified via e-mail.

 

Steps of Execution

Execute the program ‘Z_REP_USER_LOCK’ (default date is current date)

Selection Screen.png

Note: With ‘Test Run’ marked, no users are locked and emails are not sent either; this is for report generation and review purpose only.

Status Report: The output report will have consolidated list of all the users falling under criteria of inactive users with their account status:

Report Ouput.png

 

 

E-mail Notification:

Below is the E-Mail structure for 50 and 80 days:

From: sysadminteam@company.com [mailto:sysadminteam@company.com]
Sent: Wednesday, July 17, 2013 2:09 PM
Subject: Important Information: User Account will be locked

Dear User,

This is to notify you that you have not logged into System XYZ Client 100 for last 80 Days.

Please use your Login Credentials to Log-in and avoid account locking.

Please write to us for further enquiry

Thanks & Regards,
System Admin Team.

This is a system generated mail. Please do not reply.

 

Below is the E-Mail structure for 90 days:

From: sysadminteam@company.com [mailto:sysadminteam@company.com]
Sent: Wednesday, July 17, 2013 2:09 PM
Subject: Important Information: User Account has expired

Dear User,

This is to notify you that you have not logged into System XYZ Client 100 for last 90 Days.

Hence your Account has expired.

Please write to us for further enquiry

Thanks & Regards,
System Admin Team.

This is a system generated mail. Please do not reply.

Below is the execution process of the program followed by status report and generated e-mail notification.

 

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Shakeeluddin Khaja
      Shakeeluddin Khaja

      Thanks for sharing Deepak.

      Regards.

      Author's profile photo Former Member
      Former Member

      Good one!

      Author's profile photo Former Member
      Former Member

      Hi,

      The report should be very useful, I'm just having abit of a problem.  I get this abap dump when executing...

      ________________________

      Error analysis

          An exception occurred that is explained in detail below.

          The exception, which is assigned to class 'CX_OS_OBJECT_NOT_FOUND', was not

           caught in

          procedure "ADD_RECIPIENT" "(METHOD)", nor was it propagated by a RAISING

           clause.

          Since the caller of the procedure could not have anticipated that the

          exception would occur, the current program is terminated.

          The reason for the exception is:

          Could not find the referenced object with the OID

          "52EA3EBB829F1560E1008000AC11420B" (instance GUID) and

          "37A7F90DEE3E049BE10000009B38F87A" (class GUID)

      __________________________

      Can you help me on this, as i'm new in ABAP...

      Thanks,

      Author's profile photo Former Member
      Former Member

      Thanks for sharing this.

      Regards,

      SR

      Author's profile photo Former Member
      Former Member

      Hi Deepak  ,

       

      Former Member There is no attachment in this blog for program ‘Z_REP_USER_LOCK . Can you please attach the document in this blog.

      Former Member  @khaja.shakeeluddin  Former Member - Hi , if you have the attachment  , please attach it in this blog.

       

      Thanks,

      Sweta

       

      Author's profile photo Former Member
      Former Member

      Hi Deepak,

       

      Can you provide us the program which will lock inactive users automatically.

      Regards,

      Jatin

      Author's profile photo Sam WONG
      Sam WONG

      Hi

       

      May we have the Z_REP_USER_LOCK ABAP code? Can you share it here?

       

      Rgds,

      Sam Wong

      Author's profile photo Charles Kaberia
      Charles Kaberia

      Hi

       

      May we have the Z_REP_USER_LOCK ABAP code? Can you share it here?