Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

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 5th 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 user’s 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

Every SAP Userid’s should have the ‘Valid through’ date maintained in SU01 à under tab ‘Logon Data’ à field ‘Valid through’.

Every SAP Userid’s correct email-id need to be maintained in the SAP ABAP system under transaction code SU01 à under tab ‘Address’ à field ‘E-Mail Address’.

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.

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.

    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 today’s date, the system date is 29.10.2013.

When the ‘TEST’ user log’s on to the SAP system, where this functionality is activated, it will get the below pop-up window as required.

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.

Note that; in our case for the step (iii) we have e-mailed the notification reminder to user’s 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 Userid’s 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; today’s date, the system date, is 31.10.2013.

1st 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.

Now, we check the SAP Inbox/Business Workplace for our 2 users for the email.

     Output email for UserID TEST :

This completes our solutions to the requirement discussed in the introduction.

Hope this will help you in your projects.

8 Comments