SlideShare a Scribd company logo
1 of 4
Download to read offline
Getting Started Newsletters Store
Search the CommunityWelcome, Guest Login Register
Added by Guest, last edited by Manish Kumar on Jul 17, 2013
Code Gallery
Automate SAP Security user audit
Introduction:
It is a good practice to keep the users in the SAP system landscapes up to date. In my experience, I find most of the SAP systems have user IDs that were created way back. This may cause issues with
one of the following:
SAP Licensing
Delays in user master records reconciliation.
Mirror IDs
May give option to others to perform activities with the user IDs who left the organization.
As mentioned, it is always recommended to keep the user master record up to date. This article helps you to create a strategy within the SAP Security and also helps the other departments such as HR to
understand the criticality of notifying the SAP Security team when a team/project member leaves the organization/project.
It is recommended to define the strategy, such as the period of inactivity of the user IDs, user groups that should be excluded etc., before you proceed with implementing the below recommended solution.
Also, this article helps you to automate the SAP User audit and provides a list of users that can either removed/locked in the SAP system.
For easy understanding, following are the reporting limitations that I've considered:
Will pick only the users IDs who haven't logged into the system from the last 180 days.
Will ignore the users who belong to SUPER, TERMINATE etc.,
Will only look for the Dialog users.
Create a Z Program
The RSUSR200 report that is supplied with your SAP system can also be used to generate a list of users with the mentioned limitations. However, there are a few limitations using it. To further narrow down
the list of users, I recommend using the program included in this article.
Create a Background job to schedule the Z Program to run periodically
To create a background job, perform the following steps:
1. Go to SM36 (Define Background job) transaction.
2. Enter a job name (for eg: Z-User_Audit_PRD)
3. Select the Job class (This can be a C class job as it require very less time.)
4. Click Start condition and click Date/Time. Mention a date/time to run the job and check the "Periodic job" check box.
5. Click the Period Values button and select Monthly.
6. Click Step button, and click ABAP Program. Mention the program name that was created.
7. Select No, when you are prompted to add additional steps.
8. Click "Spool list recipient" button, and provide a Recipient name (can be your sap user ID or an external mail ID.)
9. Click Copy button and Save to save the background job.
Note: You should have permission to create background jobs in the system. Also, it is recommended to run the background job with any super user/batch user, so that no further changes
are required.
The background job now will run the ABAP program and will send you the list of users who haven't logged in to the system from the last 180 days. Once the list is generated, you can discuss with the
corresponding managers and see which user IDs are required/not required and delete them from the system.
ABAP Code
REPORT z_list_users.
TYPE-POOLS: slis.
TABLES: usr02.
CONSTANTS:
c_typdia TYPE usr02-ustyp VALUE 'A'. "Dialog
SELECT-OPTIONS:
s_class FOR usr02-class NO-DISPLAY.
DATA: w_class LIKE LINE OF s_class.
DATA: w_date TYPE usr02-trdat.
TYPES: BEGIN OF w_usr02_ty,
bname TYPE usr02-bname,
class TYPE usr02-class,
ustyp TYPE usr02-ustyp,
aname TYPE usr02-aname,
erdat TYPE usr02-erdat,
Automate SAP Security user audit - Code Gallery - SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Automate+SAP+Securit...
1 of 4 3/21/2014 7:31 PM
gltgb TYPE usr02-gltgb,
trdat TYPE usr02-trdat,
ltime TYPE usr02-ltime,
bcda1 TYPE usr02-bcda1,
END OF w_usr02_ty.
DATA: t_usr02 TYPE TABLE OF w_usr02_ty.
DATA: t_fcat TYPE slis_t_fieldcat_alv,
w_fcat_ds TYPE slis_fieldcat_alv.
*-------------------------------------------------------------------*
START-OF-SELECTION.
* 3. User groups - SUPER, HR TERMINATE, INACTIVE, OBSOLETE, TERMINATED should be excluded.
PERFORM exclude_groups.
* 1. No. days since last logon: 90 (If a user logged in in the last 90 days, he should not be picked in the list)
w_date = sy-datum - 90.
* Select the users from USR02 for the conditions.
SELECT bname class ustyp aname erdat gltgb trdat ltime bcda1
FROM usr02
INTO TABLE t_usr02
WHERE ustyp = c_typdia " * 2. Only Dialog (User type A) should be considered.
AND class IN s_class
AND trdat LT w_date.
IF sy-subrc NE 0.
MESSAGE 'No users found' TYPE 'I'.
ENDIF.
PERFORM build_fieldcat.
* Display the selected users in pop-up window (in foreground)
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Users'
i_selection = ' '
i_zebra = 'X'
i_screen_start_column = 10
i_screen_start_line = 2
i_screen_end_column = 130
i_screen_end_line = 20
i_tabname = 'T_USR02'
it_fieldcat = t_fcat
TABLES
t_outtab = t_usr02
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*&amp;--------------------------------------------------------------------*
*&amp; Form exclude_groups
*&amp;--------------------------------------------------------------------*
FORM exclude_groups.
CLEAR w_class.
w_class-sign = 'E'.
w_class-option = 'EQ'.
w_class-low = 'SUPER'.
APPEND w_class TO s_class.
CLEAR w_class.
w_class-sign = 'E'.
w_class-option = 'EQ'.
w_class-low = 'HR TERMINATE'.
APPEND w_class TO s_class.
Automate SAP Security user audit - Code Gallery - SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Automate+SAP+Securit...
2 of 4 3/21/2014 7:31 PM
CLEAR w_class.
w_class-sign = 'E'.
w_class-option = 'EQ'.
w_class-low = 'INACTIVE'.
APPEND w_class TO s_class.
CLEAR w_class.
w_class-sign = 'E'.
w_class-option = 'EQ'.
w_class-low = 'OBSOLETE'.
APPEND w_class TO s_class.
CLEAR w_class.
w_class-sign = 'E'.
w_class-option = 'EQ'.
w_class-low = 'TERMINATED'.
APPEND w_class TO s_class.
ENDFORM. "exclude_groups
*&--------------------------------------------------------------------*
*& Form build_fieldcat
*&--------------------------------------------------------------------*
FORM build_fieldcat.
DATA: w_col_pos TYPE syst-cucol.
REFRESH t_fcat.
CLEAR w_fcat_ds.
w_fcat_ds-fieldname = 'BNAME'.
w_fcat_ds-tabname = 'T_USR02'.
ADD 1 TO w_col_pos.
w_fcat_ds-col_pos = w_col_pos.
w_fcat_ds-seltext_m = 'User'.
APPEND w_fcat_ds TO t_fcat.
CLEAR w_fcat_ds.
w_fcat_ds-fieldname = 'CLASS'.
w_fcat_ds-tabname = 'T_USR02'.
ADD 1 TO w_col_pos.
w_fcat_ds-col_pos = w_col_pos.
w_fcat_ds-seltext_m = 'Group'.
APPEND w_fcat_ds TO t_fcat.
CLEAR w_fcat_ds.
w_fcat_ds-fieldname = 'USTYP'.
w_fcat_ds-tabname = 'T_USR02'.
ADD 1 TO w_col_pos.
w_fcat_ds-col_pos = w_col_pos.
w_fcat_ds-seltext_m = 'Type'.
w_fcat_ds-outputlen = 1.
APPEND w_fcat_ds TO t_fcat.
CLEAR w_fcat_ds.
w_fcat_ds-fieldname = 'ANAME'.
w_fcat_ds-tabname = 'T_USR02'.
ADD 1 TO w_col_pos.
w_fcat_ds-col_pos = w_col_pos.
w_fcat_ds-seltext_m = 'Created By'.
APPEND w_fcat_ds TO t_fcat.
CLEAR w_fcat_ds.
w_fcat_ds-fieldname = 'ERDAT'.
w_fcat_ds-tabname = 'T_USR02'.
ADD 1 TO w_col_pos.
w_fcat_ds-col_pos = w_col_pos.
w_fcat_ds-seltext_m = 'Created On'.
APPEND w_fcat_ds TO t_fcat.
CLEAR w_fcat_ds.
w_fcat_ds-fieldname = 'GLTGB'.
w_fcat_ds-tabname = 'T_USR02'.
ADD 1 TO w_col_pos.
w_fcat_ds-col_pos = w_col_pos.
Automate SAP Security user audit - Code Gallery - SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Automate+SAP+Securit...
3 of 4 3/21/2014 7:31 PM
~End of the article.
This report is similar to transaction code "RSUSR200_UNUSED30" or using RSUSR200 with variants. The only exception I can see is the user groups. I hope there should be few recommendations further
to enhance the capability of this report.
w_fcat_ds-seltext_m = 'Valid'.
APPEND w_fcat_ds TO t_fcat.
CLEAR w_fcat_ds.
w_fcat_ds-fieldname = 'TRDAT'.
w_fcat_ds-tabname = 'T_USR02'.
ADD 1 TO w_col_pos.
w_fcat_ds-col_pos = w_col_pos.
w_fcat_ds-seltext_m = 'Last logon Date'.
APPEND w_fcat_ds TO t_fcat.
CLEAR w_fcat_ds.
w_fcat_ds-fieldname = 'LTIME'.
w_fcat_ds-tabname = 'T_USR02'.
ADD 1 TO w_col_pos.
w_fcat_ds-col_pos = w_col_pos.
w_fcat_ds-seltext_m = 'Last logon Time'.
APPEND w_fcat_ds TO t_fcat.
CLEAR w_fcat_ds.
w_fcat_ds-fieldname = 'BCDA1'.
w_fcat_ds-tabname = 'T_USR02'.
ADD 1 TO w_col_pos.
w_fcat_ds-col_pos = w_col_pos.
w_fcat_ds-seltext_m = 'User locked'.
APPEND w_fcat_ds TO t_fcat.
CLEAR w_fcat_ds.
ENDFORM. "build_fieldcat
security_faq
Follow SCN
Contact Us SAP Help Portal
Privacy Terms of Use Legal Disclosure Copyright
Automate SAP Security user audit - Code Gallery - SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Automate+SAP+Securit...
4 of 4 3/21/2014 7:31 PM

More Related Content

Similar to Automate sap security user audit

Sap basis made_easy321761331053730
Sap basis made_easy321761331053730Sap basis made_easy321761331053730
Sap basis made_easy321761331053730K Hari Shankar
 
SAP SD QUERY REPORT_GANESH
SAP SD QUERY REPORT_GANESHSAP SD QUERY REPORT_GANESH
SAP SD QUERY REPORT_GANESHGanesh Tarlana
 
s3826943_Assignment3_BCO56471
s3826943_Assignment3_BCO56471s3826943_Assignment3_BCO56471
s3826943_Assignment3_BCO56471Oracle
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handlingSuite Solutions
 
General discussion-abap-tips-1222362261851517-8
General discussion-abap-tips-1222362261851517-8General discussion-abap-tips-1222362261851517-8
General discussion-abap-tips-1222362261851517-8wingsrai
 
General Discussion Abap Tips
General Discussion   Abap  TipsGeneral Discussion   Abap  Tips
General Discussion Abap TipsMichelle Crapo
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplicationolegmmiller
 
Stored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiStored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiMuhammed Thanveer M
 
[AIS 2018] Keynote tools and practices - scott davis
[AIS 2018] Keynote tools and practices  - scott davis[AIS 2018] Keynote tools and practices  - scott davis
[AIS 2018] Keynote tools and practices - scott davisAtlassian 대한민국
 
OTech magazine article - Principle of Least Privilege
OTech magazine article - Principle of Least PrivilegeOTech magazine article - Principle of Least Privilege
OTech magazine article - Principle of Least PrivilegeBiju Thomas
 
07 Php Mysql Update Delete
07 Php Mysql Update Delete07 Php Mysql Update Delete
07 Php Mysql Update DeleteGeshan Manandhar
 
W2 k3 ad_integration-how_to
W2 k3 ad_integration-how_toW2 k3 ad_integration-how_to
W2 k3 ad_integration-how_toMeka SriHari
 

Similar to Automate sap security user audit (20)

SAP BASIS Training in Chennai
SAP BASIS Training in ChennaiSAP BASIS Training in Chennai
SAP BASIS Training in Chennai
 
Sap basis made_easy321761331053730
Sap basis made_easy321761331053730Sap basis made_easy321761331053730
Sap basis made_easy321761331053730
 
SAP SD QUERY REPORT_GANESH
SAP SD QUERY REPORT_GANESHSAP SD QUERY REPORT_GANESH
SAP SD QUERY REPORT_GANESH
 
s3826943_Assignment3_BCO56471
s3826943_Assignment3_BCO56471s3826943_Assignment3_BCO56471
s3826943_Assignment3_BCO56471
 
Stored procedure
Stored procedureStored procedure
Stored procedure
 
Debugging and Error handling
Debugging and Error handlingDebugging and Error handling
Debugging and Error handling
 
Pluggin creation
Pluggin creationPluggin creation
Pluggin creation
 
General discussion-abap-tips-1222362261851517-8
General discussion-abap-tips-1222362261851517-8General discussion-abap-tips-1222362261851517-8
General discussion-abap-tips-1222362261851517-8
 
General Discussion Abap Tips
General Discussion   Abap  TipsGeneral Discussion   Abap  Tips
General Discussion Abap Tips
 
sap
sap sap
sap
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
Stored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiStored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayi
 
[AIS 2018] Keynote tools and practices - scott davis
[AIS 2018] Keynote tools and practices  - scott davis[AIS 2018] Keynote tools and practices  - scott davis
[AIS 2018] Keynote tools and practices - scott davis
 
OTech magazine article - Principle of Least Privilege
OTech magazine article - Principle of Least PrivilegeOTech magazine article - Principle of Least Privilege
OTech magazine article - Principle of Least Privilege
 
165373293 sap-security-q
165373293 sap-security-q165373293 sap-security-q
165373293 sap-security-q
 
07 Php Mysql Update Delete
07 Php Mysql Update Delete07 Php Mysql Update Delete
07 Php Mysql Update Delete
 
Data Base project
Data Base projectData Base project
Data Base project
 
W2 k3 ad_integration-how_to
W2 k3 ad_integration-how_toW2 k3 ad_integration-how_to
W2 k3 ad_integration-how_to
 
Stored procedures with cursors
Stored procedures with cursorsStored procedures with cursors
Stored procedures with cursors
 
Sap
SapSap
Sap
 

Recently uploaded

Prince Armahs(Tinky) Brochure, for Funeral service
Prince Armahs(Tinky) Brochure, for Funeral servicePrince Armahs(Tinky) Brochure, for Funeral service
Prince Armahs(Tinky) Brochure, for Funeral serviceednyonat
 
Call Girls In Lahore-->>03274100048<<--Independent Call Girls & Escorts In La...
Call Girls In Lahore-->>03274100048<<--Independent Call Girls & Escorts In La...Call Girls In Lahore-->>03274100048<<--Independent Call Girls & Escorts In La...
Call Girls In Lahore-->>03274100048<<--Independent Call Girls & Escorts In La...Ifra Zohaib
 
Agra 💋Call Girl 9748763073 Call Girls in Agra Escort service book now
Agra 💋Call Girl 9748763073 Call Girls in Agra Escort service book nowAgra 💋Call Girl 9748763073 Call Girls in Agra Escort service book now
Agra 💋Call Girl 9748763073 Call Girls in Agra Escort service book nowapshanarani255
 
❤️Zirakpur Escort Service☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirak...
❤️Zirakpur Escort Service☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirak...❤️Zirakpur Escort Service☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirak...
❤️Zirakpur Escort Service☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirak...Sheetaleventcompany
 
💚Amritsar Call Girls Service 💯Jiya 📲🔝8725944379🔝Call Girls In Amritsar No💰Adv...
💚Amritsar Call Girls Service 💯Jiya 📲🔝8725944379🔝Call Girls In Amritsar No💰Adv...💚Amritsar Call Girls Service 💯Jiya 📲🔝8725944379🔝Call Girls In Amritsar No💰Adv...
💚Amritsar Call Girls Service 💯Jiya 📲🔝8725944379🔝Call Girls In Amritsar No💰Adv...Sheetaleventcompany
 
KANNUR CALL GIRL 9661985112 LOW PRICE ESCORT SERVICE KANNUR
KANNUR CALL GIRL 9661985112 LOW PRICE ESCORT SERVICE KANNURKANNUR CALL GIRL 9661985112 LOW PRICE ESCORT SERVICE KANNUR
KANNUR CALL GIRL 9661985112 LOW PRICE ESCORT SERVICE KANNURSapna Call girl
 
MORADABAD CALL GIRL 9661985112 IN CALL GIRLS ESCORT SERVICE
MORADABAD CALL GIRL 9661985112 IN CALL GIRLS ESCORT SERVICEMORADABAD CALL GIRL 9661985112 IN CALL GIRLS ESCORT SERVICE
MORADABAD CALL GIRL 9661985112 IN CALL GIRLS ESCORT SERVICESapna Call girl
 
Satara call girl 8797040791♥️ call girls in satara escort service
Satara call girl 8797040791♥️ call girls in satara escort serviceSatara call girl 8797040791♥️ call girls in satara escort service
Satara call girl 8797040791♥️ call girls in satara escort serviceMumbai Call girl
 
Call Girls Siliguri Just Call 7870993772 Top Class Call Girl Service Availabl...
Call Girls Siliguri Just Call 7870993772 Top Class Call Girl Service Availabl...Call Girls Siliguri Just Call 7870993772 Top Class Call Girl Service Availabl...
Call Girls Siliguri Just Call 7870993772 Top Class Call Girl Service Availabl...Monika Rani
 
❤️Amritsar Call Girl☎️9815674956☎️ Call Girl service in Amritsar☎️ Amritsar C...
❤️Amritsar Call Girl☎️9815674956☎️ Call Girl service in Amritsar☎️ Amritsar C...❤️Amritsar Call Girl☎️9815674956☎️ Call Girl service in Amritsar☎️ Amritsar C...
❤️Amritsar Call Girl☎️9815674956☎️ Call Girl service in Amritsar☎️ Amritsar C...Sheetaleventcompany
 
Udaipur Call Girls ☎ 9602870969✅ Just Genuine Call Girl in Udaipur Escort Ser...
Udaipur Call Girls ☎ 9602870969✅ Just Genuine Call Girl in Udaipur Escort Ser...Udaipur Call Girls ☎ 9602870969✅ Just Genuine Call Girl in Udaipur Escort Ser...
Udaipur Call Girls ☎ 9602870969✅ Just Genuine Call Girl in Udaipur Escort Ser...Apsara Of India
 
chittorgarh 💋 Call Girl 9748763073 Call Girls in Chittorgarh Escort service ...
chittorgarh 💋  Call Girl 9748763073 Call Girls in Chittorgarh Escort service ...chittorgarh 💋  Call Girl 9748763073 Call Girls in Chittorgarh Escort service ...
chittorgarh 💋 Call Girl 9748763073 Call Girls in Chittorgarh Escort service ...apshanarani255
 
Call Girls In Karachi-->>03274048030<<--Meet Call Girls In Karachi for Unforg...
Call Girls In Karachi-->>03274048030<<--Meet Call Girls In Karachi for Unforg...Call Girls In Karachi-->>03274048030<<--Meet Call Girls In Karachi for Unforg...
Call Girls In Karachi-->>03274048030<<--Meet Call Girls In Karachi for Unforg...Sana Rajpoot
 
Unnao 💋 Call Girl 97487*63073 Call Girls in unnao Escort service book now
Unnao 💋  Call Girl 97487*63073 Call Girls in unnao Escort service book nowUnnao 💋  Call Girl 97487*63073 Call Girls in unnao Escort service book now
Unnao 💋 Call Girl 97487*63073 Call Girls in unnao Escort service book nowapshanarani255
 
Udaipur Call Girls ☎ 9602870969✅ Better Genuine Call Girl in Udaipur Escort S...
Udaipur Call Girls ☎ 9602870969✅ Better Genuine Call Girl in Udaipur Escort S...Udaipur Call Girls ☎ 9602870969✅ Better Genuine Call Girl in Udaipur Escort S...
Udaipur Call Girls ☎ 9602870969✅ Better Genuine Call Girl in Udaipur Escort S...Apsara Of India
 
Call Girls In Karachi-->>03224951619<<--100+ Hot Girls WhatsApp Numbers Book ...
Call Girls In Karachi-->>03224951619<<--100+ Hot Girls WhatsApp Numbers Book ...Call Girls In Karachi-->>03224951619<<--100+ Hot Girls WhatsApp Numbers Book ...
Call Girls In Karachi-->>03224951619<<--100+ Hot Girls WhatsApp Numbers Book ...Laiba Pari
 
Udaipur Call Girls ☎ 9602870969✅ Best Genuine Call Girl in Udaipur Escort Ser...
Udaipur Call Girls ☎ 9602870969✅ Best Genuine Call Girl in Udaipur Escort Ser...Udaipur Call Girls ☎ 9602870969✅ Best Genuine Call Girl in Udaipur Escort Ser...
Udaipur Call Girls ☎ 9602870969✅ Best Genuine Call Girl in Udaipur Escort Ser...Apsara Of India
 
BHOPAL CALL GIRL 9262871154 HIGH PROFILE BHOPAL ESCORT SERVICE
BHOPAL CALL GIRL 9262871154 HIGH PROFILE BHOPAL ESCORT SERVICEBHOPAL CALL GIRL 9262871154 HIGH PROFILE BHOPAL ESCORT SERVICE
BHOPAL CALL GIRL 9262871154 HIGH PROFILE BHOPAL ESCORT SERVICENiteshKumar82226
 
Motihari ❤CALL GIRL 7870993772 ❤CALL GIRLS ESCORT SERVICE In motihari ❤ Low ...
Motihari ❤CALL GIRL 7870993772 ❤CALL GIRLS  ESCORT SERVICE In motihari ❤ Low ...Motihari ❤CALL GIRL 7870993772 ❤CALL GIRLS  ESCORT SERVICE In motihari ❤ Low ...
Motihari ❤CALL GIRL 7870993772 ❤CALL GIRLS ESCORT SERVICE In motihari ❤ Low ...Monika Rani
 

Recently uploaded (20)

Prince Armahs(Tinky) Brochure, for Funeral service
Prince Armahs(Tinky) Brochure, for Funeral servicePrince Armahs(Tinky) Brochure, for Funeral service
Prince Armahs(Tinky) Brochure, for Funeral service
 
Call Girls In Lahore-->>03274100048<<--Independent Call Girls & Escorts In La...
Call Girls In Lahore-->>03274100048<<--Independent Call Girls & Escorts In La...Call Girls In Lahore-->>03274100048<<--Independent Call Girls & Escorts In La...
Call Girls In Lahore-->>03274100048<<--Independent Call Girls & Escorts In La...
 
Agra 💋Call Girl 9748763073 Call Girls in Agra Escort service book now
Agra 💋Call Girl 9748763073 Call Girls in Agra Escort service book nowAgra 💋Call Girl 9748763073 Call Girls in Agra Escort service book now
Agra 💋Call Girl 9748763073 Call Girls in Agra Escort service book now
 
❤️Zirakpur Escort Service☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirak...
❤️Zirakpur Escort Service☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirak...❤️Zirakpur Escort Service☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirak...
❤️Zirakpur Escort Service☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirak...
 
💚Amritsar Call Girls Service 💯Jiya 📲🔝8725944379🔝Call Girls In Amritsar No💰Adv...
💚Amritsar Call Girls Service 💯Jiya 📲🔝8725944379🔝Call Girls In Amritsar No💰Adv...💚Amritsar Call Girls Service 💯Jiya 📲🔝8725944379🔝Call Girls In Amritsar No💰Adv...
💚Amritsar Call Girls Service 💯Jiya 📲🔝8725944379🔝Call Girls In Amritsar No💰Adv...
 
KANNUR CALL GIRL 9661985112 LOW PRICE ESCORT SERVICE KANNUR
KANNUR CALL GIRL 9661985112 LOW PRICE ESCORT SERVICE KANNURKANNUR CALL GIRL 9661985112 LOW PRICE ESCORT SERVICE KANNUR
KANNUR CALL GIRL 9661985112 LOW PRICE ESCORT SERVICE KANNUR
 
MORADABAD CALL GIRL 9661985112 IN CALL GIRLS ESCORT SERVICE
MORADABAD CALL GIRL 9661985112 IN CALL GIRLS ESCORT SERVICEMORADABAD CALL GIRL 9661985112 IN CALL GIRLS ESCORT SERVICE
MORADABAD CALL GIRL 9661985112 IN CALL GIRLS ESCORT SERVICE
 
Satara call girl 8797040791♥️ call girls in satara escort service
Satara call girl 8797040791♥️ call girls in satara escort serviceSatara call girl 8797040791♥️ call girls in satara escort service
Satara call girl 8797040791♥️ call girls in satara escort service
 
Call Girls Siliguri Just Call 7870993772 Top Class Call Girl Service Availabl...
Call Girls Siliguri Just Call 7870993772 Top Class Call Girl Service Availabl...Call Girls Siliguri Just Call 7870993772 Top Class Call Girl Service Availabl...
Call Girls Siliguri Just Call 7870993772 Top Class Call Girl Service Availabl...
 
NO ADVANCE PAYMENT ONLY CASH PAYMENT DIRECT MEETING GENUINE
NO ADVANCE PAYMENT ONLY CASH PAYMENT DIRECT MEETING GENUINENO ADVANCE PAYMENT ONLY CASH PAYMENT DIRECT MEETING GENUINE
NO ADVANCE PAYMENT ONLY CASH PAYMENT DIRECT MEETING GENUINE
 
❤️Amritsar Call Girl☎️9815674956☎️ Call Girl service in Amritsar☎️ Amritsar C...
❤️Amritsar Call Girl☎️9815674956☎️ Call Girl service in Amritsar☎️ Amritsar C...❤️Amritsar Call Girl☎️9815674956☎️ Call Girl service in Amritsar☎️ Amritsar C...
❤️Amritsar Call Girl☎️9815674956☎️ Call Girl service in Amritsar☎️ Amritsar C...
 
Udaipur Call Girls ☎ 9602870969✅ Just Genuine Call Girl in Udaipur Escort Ser...
Udaipur Call Girls ☎ 9602870969✅ Just Genuine Call Girl in Udaipur Escort Ser...Udaipur Call Girls ☎ 9602870969✅ Just Genuine Call Girl in Udaipur Escort Ser...
Udaipur Call Girls ☎ 9602870969✅ Just Genuine Call Girl in Udaipur Escort Ser...
 
chittorgarh 💋 Call Girl 9748763073 Call Girls in Chittorgarh Escort service ...
chittorgarh 💋  Call Girl 9748763073 Call Girls in Chittorgarh Escort service ...chittorgarh 💋  Call Girl 9748763073 Call Girls in Chittorgarh Escort service ...
chittorgarh 💋 Call Girl 9748763073 Call Girls in Chittorgarh Escort service ...
 
Call Girls In Karachi-->>03274048030<<--Meet Call Girls In Karachi for Unforg...
Call Girls In Karachi-->>03274048030<<--Meet Call Girls In Karachi for Unforg...Call Girls In Karachi-->>03274048030<<--Meet Call Girls In Karachi for Unforg...
Call Girls In Karachi-->>03274048030<<--Meet Call Girls In Karachi for Unforg...
 
Unnao 💋 Call Girl 97487*63073 Call Girls in unnao Escort service book now
Unnao 💋  Call Girl 97487*63073 Call Girls in unnao Escort service book nowUnnao 💋  Call Girl 97487*63073 Call Girls in unnao Escort service book now
Unnao 💋 Call Girl 97487*63073 Call Girls in unnao Escort service book now
 
Udaipur Call Girls ☎ 9602870969✅ Better Genuine Call Girl in Udaipur Escort S...
Udaipur Call Girls ☎ 9602870969✅ Better Genuine Call Girl in Udaipur Escort S...Udaipur Call Girls ☎ 9602870969✅ Better Genuine Call Girl in Udaipur Escort S...
Udaipur Call Girls ☎ 9602870969✅ Better Genuine Call Girl in Udaipur Escort S...
 
Call Girls In Karachi-->>03224951619<<--100+ Hot Girls WhatsApp Numbers Book ...
Call Girls In Karachi-->>03224951619<<--100+ Hot Girls WhatsApp Numbers Book ...Call Girls In Karachi-->>03224951619<<--100+ Hot Girls WhatsApp Numbers Book ...
Call Girls In Karachi-->>03224951619<<--100+ Hot Girls WhatsApp Numbers Book ...
 
Udaipur Call Girls ☎ 9602870969✅ Best Genuine Call Girl in Udaipur Escort Ser...
Udaipur Call Girls ☎ 9602870969✅ Best Genuine Call Girl in Udaipur Escort Ser...Udaipur Call Girls ☎ 9602870969✅ Best Genuine Call Girl in Udaipur Escort Ser...
Udaipur Call Girls ☎ 9602870969✅ Best Genuine Call Girl in Udaipur Escort Ser...
 
BHOPAL CALL GIRL 9262871154 HIGH PROFILE BHOPAL ESCORT SERVICE
BHOPAL CALL GIRL 9262871154 HIGH PROFILE BHOPAL ESCORT SERVICEBHOPAL CALL GIRL 9262871154 HIGH PROFILE BHOPAL ESCORT SERVICE
BHOPAL CALL GIRL 9262871154 HIGH PROFILE BHOPAL ESCORT SERVICE
 
Motihari ❤CALL GIRL 7870993772 ❤CALL GIRLS ESCORT SERVICE In motihari ❤ Low ...
Motihari ❤CALL GIRL 7870993772 ❤CALL GIRLS  ESCORT SERVICE In motihari ❤ Low ...Motihari ❤CALL GIRL 7870993772 ❤CALL GIRLS  ESCORT SERVICE In motihari ❤ Low ...
Motihari ❤CALL GIRL 7870993772 ❤CALL GIRLS ESCORT SERVICE In motihari ❤ Low ...
 

Automate sap security user audit

  • 1. Getting Started Newsletters Store Search the CommunityWelcome, Guest Login Register Added by Guest, last edited by Manish Kumar on Jul 17, 2013 Code Gallery Automate SAP Security user audit Introduction: It is a good practice to keep the users in the SAP system landscapes up to date. In my experience, I find most of the SAP systems have user IDs that were created way back. This may cause issues with one of the following: SAP Licensing Delays in user master records reconciliation. Mirror IDs May give option to others to perform activities with the user IDs who left the organization. As mentioned, it is always recommended to keep the user master record up to date. This article helps you to create a strategy within the SAP Security and also helps the other departments such as HR to understand the criticality of notifying the SAP Security team when a team/project member leaves the organization/project. It is recommended to define the strategy, such as the period of inactivity of the user IDs, user groups that should be excluded etc., before you proceed with implementing the below recommended solution. Also, this article helps you to automate the SAP User audit and provides a list of users that can either removed/locked in the SAP system. For easy understanding, following are the reporting limitations that I've considered: Will pick only the users IDs who haven't logged into the system from the last 180 days. Will ignore the users who belong to SUPER, TERMINATE etc., Will only look for the Dialog users. Create a Z Program The RSUSR200 report that is supplied with your SAP system can also be used to generate a list of users with the mentioned limitations. However, there are a few limitations using it. To further narrow down the list of users, I recommend using the program included in this article. Create a Background job to schedule the Z Program to run periodically To create a background job, perform the following steps: 1. Go to SM36 (Define Background job) transaction. 2. Enter a job name (for eg: Z-User_Audit_PRD) 3. Select the Job class (This can be a C class job as it require very less time.) 4. Click Start condition and click Date/Time. Mention a date/time to run the job and check the "Periodic job" check box. 5. Click the Period Values button and select Monthly. 6. Click Step button, and click ABAP Program. Mention the program name that was created. 7. Select No, when you are prompted to add additional steps. 8. Click "Spool list recipient" button, and provide a Recipient name (can be your sap user ID or an external mail ID.) 9. Click Copy button and Save to save the background job. Note: You should have permission to create background jobs in the system. Also, it is recommended to run the background job with any super user/batch user, so that no further changes are required. The background job now will run the ABAP program and will send you the list of users who haven't logged in to the system from the last 180 days. Once the list is generated, you can discuss with the corresponding managers and see which user IDs are required/not required and delete them from the system. ABAP Code REPORT z_list_users. TYPE-POOLS: slis. TABLES: usr02. CONSTANTS: c_typdia TYPE usr02-ustyp VALUE 'A'. "Dialog SELECT-OPTIONS: s_class FOR usr02-class NO-DISPLAY. DATA: w_class LIKE LINE OF s_class. DATA: w_date TYPE usr02-trdat. TYPES: BEGIN OF w_usr02_ty, bname TYPE usr02-bname, class TYPE usr02-class, ustyp TYPE usr02-ustyp, aname TYPE usr02-aname, erdat TYPE usr02-erdat, Automate SAP Security user audit - Code Gallery - SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Automate+SAP+Securit... 1 of 4 3/21/2014 7:31 PM
  • 2. gltgb TYPE usr02-gltgb, trdat TYPE usr02-trdat, ltime TYPE usr02-ltime, bcda1 TYPE usr02-bcda1, END OF w_usr02_ty. DATA: t_usr02 TYPE TABLE OF w_usr02_ty. DATA: t_fcat TYPE slis_t_fieldcat_alv, w_fcat_ds TYPE slis_fieldcat_alv. *-------------------------------------------------------------------* START-OF-SELECTION. * 3. User groups - SUPER, HR TERMINATE, INACTIVE, OBSOLETE, TERMINATED should be excluded. PERFORM exclude_groups. * 1. No. days since last logon: 90 (If a user logged in in the last 90 days, he should not be picked in the list) w_date = sy-datum - 90. * Select the users from USR02 for the conditions. SELECT bname class ustyp aname erdat gltgb trdat ltime bcda1 FROM usr02 INTO TABLE t_usr02 WHERE ustyp = c_typdia " * 2. Only Dialog (User type A) should be considered. AND class IN s_class AND trdat LT w_date. IF sy-subrc NE 0. MESSAGE 'No users found' TYPE 'I'. ENDIF. PERFORM build_fieldcat. * Display the selected users in pop-up window (in foreground) CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT' EXPORTING i_title = 'Users' i_selection = ' ' i_zebra = 'X' i_screen_start_column = 10 i_screen_start_line = 2 i_screen_end_column = 130 i_screen_end_line = 20 i_tabname = 'T_USR02' it_fieldcat = t_fcat TABLES t_outtab = t_usr02 EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. *&amp;--------------------------------------------------------------------* *&amp; Form exclude_groups *&amp;--------------------------------------------------------------------* FORM exclude_groups. CLEAR w_class. w_class-sign = 'E'. w_class-option = 'EQ'. w_class-low = 'SUPER'. APPEND w_class TO s_class. CLEAR w_class. w_class-sign = 'E'. w_class-option = 'EQ'. w_class-low = 'HR TERMINATE'. APPEND w_class TO s_class. Automate SAP Security user audit - Code Gallery - SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Automate+SAP+Securit... 2 of 4 3/21/2014 7:31 PM
  • 3. CLEAR w_class. w_class-sign = 'E'. w_class-option = 'EQ'. w_class-low = 'INACTIVE'. APPEND w_class TO s_class. CLEAR w_class. w_class-sign = 'E'. w_class-option = 'EQ'. w_class-low = 'OBSOLETE'. APPEND w_class TO s_class. CLEAR w_class. w_class-sign = 'E'. w_class-option = 'EQ'. w_class-low = 'TERMINATED'. APPEND w_class TO s_class. ENDFORM. "exclude_groups *&--------------------------------------------------------------------* *& Form build_fieldcat *&--------------------------------------------------------------------* FORM build_fieldcat. DATA: w_col_pos TYPE syst-cucol. REFRESH t_fcat. CLEAR w_fcat_ds. w_fcat_ds-fieldname = 'BNAME'. w_fcat_ds-tabname = 'T_USR02'. ADD 1 TO w_col_pos. w_fcat_ds-col_pos = w_col_pos. w_fcat_ds-seltext_m = 'User'. APPEND w_fcat_ds TO t_fcat. CLEAR w_fcat_ds. w_fcat_ds-fieldname = 'CLASS'. w_fcat_ds-tabname = 'T_USR02'. ADD 1 TO w_col_pos. w_fcat_ds-col_pos = w_col_pos. w_fcat_ds-seltext_m = 'Group'. APPEND w_fcat_ds TO t_fcat. CLEAR w_fcat_ds. w_fcat_ds-fieldname = 'USTYP'. w_fcat_ds-tabname = 'T_USR02'. ADD 1 TO w_col_pos. w_fcat_ds-col_pos = w_col_pos. w_fcat_ds-seltext_m = 'Type'. w_fcat_ds-outputlen = 1. APPEND w_fcat_ds TO t_fcat. CLEAR w_fcat_ds. w_fcat_ds-fieldname = 'ANAME'. w_fcat_ds-tabname = 'T_USR02'. ADD 1 TO w_col_pos. w_fcat_ds-col_pos = w_col_pos. w_fcat_ds-seltext_m = 'Created By'. APPEND w_fcat_ds TO t_fcat. CLEAR w_fcat_ds. w_fcat_ds-fieldname = 'ERDAT'. w_fcat_ds-tabname = 'T_USR02'. ADD 1 TO w_col_pos. w_fcat_ds-col_pos = w_col_pos. w_fcat_ds-seltext_m = 'Created On'. APPEND w_fcat_ds TO t_fcat. CLEAR w_fcat_ds. w_fcat_ds-fieldname = 'GLTGB'. w_fcat_ds-tabname = 'T_USR02'. ADD 1 TO w_col_pos. w_fcat_ds-col_pos = w_col_pos. Automate SAP Security user audit - Code Gallery - SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Automate+SAP+Securit... 3 of 4 3/21/2014 7:31 PM
  • 4. ~End of the article. This report is similar to transaction code "RSUSR200_UNUSED30" or using RSUSR200 with variants. The only exception I can see is the user groups. I hope there should be few recommendations further to enhance the capability of this report. w_fcat_ds-seltext_m = 'Valid'. APPEND w_fcat_ds TO t_fcat. CLEAR w_fcat_ds. w_fcat_ds-fieldname = 'TRDAT'. w_fcat_ds-tabname = 'T_USR02'. ADD 1 TO w_col_pos. w_fcat_ds-col_pos = w_col_pos. w_fcat_ds-seltext_m = 'Last logon Date'. APPEND w_fcat_ds TO t_fcat. CLEAR w_fcat_ds. w_fcat_ds-fieldname = 'LTIME'. w_fcat_ds-tabname = 'T_USR02'. ADD 1 TO w_col_pos. w_fcat_ds-col_pos = w_col_pos. w_fcat_ds-seltext_m = 'Last logon Time'. APPEND w_fcat_ds TO t_fcat. CLEAR w_fcat_ds. w_fcat_ds-fieldname = 'BCDA1'. w_fcat_ds-tabname = 'T_USR02'. ADD 1 TO w_col_pos. w_fcat_ds-col_pos = w_col_pos. w_fcat_ds-seltext_m = 'User locked'. APPEND w_fcat_ds TO t_fcat. CLEAR w_fcat_ds. ENDFORM. "build_fieldcat security_faq Follow SCN Contact Us SAP Help Portal Privacy Terms of Use Legal Disclosure Copyright Automate SAP Security user audit - Code Gallery - SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Automate+SAP+Securit... 4 of 4 3/21/2014 7:31 PM