Custom Code Management Usage Logging Supported by SAP Solution Manager 7.2 SAP Digital Business Services Version 1.0 October 2017 Custom Code Management: Usage Logging Disclaimer SAP assumes no responsibility for errors or omissions in this guideline. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained herein. This document is provided without warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or noninfringement. Where this document contains information about intended SAP strategies, developments and/or functionalities of SAP products, such information is not intended to be binding upon SAP to any particular course of business, product strategy and/or development. Any software coding or code lines / strings („Code“) provided are only examples and are not intended for use in a productive system environment. The code is only intended to better explain and visualize the syntax and phrasing rules for certain SAP coding. SAP does not warrant the correctness or completeness of the Code provided herein and SAP shall not be liable for errors or damages cause by use of the Code, except where such damages were caused by SAP with intent or with gross negligence. Please note that this document is subject to change and may be changed by SAP at any time without notice. 2 Custom Code Management: Usage Logging Table of content SAP Usage Logging...................................................................................................................... 4 What is UPL? .............................................................................................................................. 4 What is SCMON? ........................................................................................................................ 5 UPL/SCMON - How it works ....................................................................................................... 5 How to activate the UPL/SCMON tracking ................................................................................. 6 Activation from SAP Solution Manger 7.2 SP06 .................................................................................. 6 Activation of UPL directly in the system (not recommended)............................................................. 8 Activation of SCMON directly in the system (not recommended) ...................................................... 9 How to read the UPL/SCMON data ............................................................................................ 9 Read UPL/SCMON data in SAP Solution Manager 7.2 ......................................................................... 9 Read UPL data directly in the system ................................................................................................ 10 Read SCMON data directly in the system.......................................................................................... 11 Relation to other solutions/applications.................................................................................. 11 Workload Statistics (transaction ST03N) ........................................................................................... 11 SQL Monitor (SQLM) ......................................................................................................................... 11 Custom Code Lifecycle Management (CCLM) .................................................................................... 12 Overview on usage collection ........................................................................................................... 12 3 Custom Code Management: Usage Logging SAP Usage Logging It is always a challenge for every SAP system owner to know what is really going on in their installed systems. What kind of code procedures are executed and how often and if there is a relation between the time frame of execution and the overall number of executions. Besides existing technologies to track and log runtime executions there is always the issue of additional performance losses because the logging technology needs additional resources. And the level of details might be different and will never fit to the requirements. What we are looking for is a technology without system performance impact, with a high level of accuracy and the capability to track also at runtime dynamically generated and executed code language elements. SAP Usage & Procedure Logging (UPL) and its successor ABAP Call Monitor (SCMON) will give you these capabilities directly build in your existing SAP solution without installation of additional software packages or difficult activation processes. The usage logging for ABAP objects in a system provided by UPL and SCMON is client independent. What is UPL? Usage and Procedure Logging (UPL) is a functionality available in any ABAP based system based on the core functionality of SAP Coverage Analyzer. It will be used to log all called and executed ABAP units (procedures) like programs, function modules down to classes, methods and subroutines. This enhanced SAP Netweaver capability will have nearly no performance impact on your system and will catch usage information of ABAP routines directly when they happen. UPL will give you 100% coverage of usage without estimations or evaluation of ABAP call stacks. This includes also the detection of dynamically called ABAP elements. UPL/SCMON is the one and only technology to close the existing gaps in the SAP workload statistic. The reporting capabilities with enriched information in BW of the SAP Solution Manager will give you the flexibility to analyze ABAP usage on your demands. Benefits: No measurable performance impact neither CPU nor runtime Supports all ABAP based systems with the technical preconditions Catch also any dynamically called ABAP routines Supports all ABAP procedure types down to subroutines Limitations: 4 Custom Code Management: Usage Logging No user related information - performance and work council reasons No runtime information about spent processing time - performance reasons No call stack information No logging for used DDIC like tables, structures, etc. No logging of transaction codes No logging of ABAP development environment language elements for simplified coding e.g. includes What is SCMON? ABAP Call Monitor (SCMON) is the successor of UPL. It covers all features of UPL but is able to additionally record the root information from which the ABAP unit was originally called. Benefits: Nearly no performance impact neither CPU nor runtime Supports all ABAP based systems with the technical preconditions Catch also any dynamically called ABAP routines Supports all ABAP procedure types down to subroutines Records call stack information as well by recording the corresponding root Please be aware, that with capturing the root information the usage data can increase up to 20 times in comparison to the collected UPL data. Limitations: No user related information - Performance and work council reasons No runtime information about spent processing time - performance reasons No logging for used DDIC like tables, structures, etc. No logging of transaction codes No logging of ABAP development environment language elements for simplified coding e.g. includes UPL/SCMON - How it works UPL/SCMON recording is directly embedded in SAP basis functionality. Anytime an object is executed SAP Netweaver capabilities will record the execution of this object. This data will be aggregated in day slices every day and saved in an own data persistency layer on the respective system. When UPL gets activated the data will be kept for a customizable limit of days (per default for the past 14 days). UPL is running permanently until it gets switched off manually. SCMON is 5 Custom Code Management: Usage Logging implemented in a different way. If the data for SCMON reaches a defined limit for days (default seven days) or records (default 20.000.000 records) SCMON will be automatically deactivated. If SCMON is activated via SAP Solution Manager 7.2 then the SAP Solution Manager will take care that SCMON is running permanently and will not be deactivated because of the time limit. If UPL/SCMON is activated from a SAP Solution Manager system, the data will be extracted and collected in UPL/SCMON data storage objects (DSOs) and cubes in the BW of the SAP Solution Manager. The data will be kept for a customizable limit of days and aggregated in customizable numbers of weeks, months and years to support different queries. BW housekeeping jobs will take care of the limit of days, weeks, months and years. For further information on SCMON please read the application help of transaction SCMON in your system. UPL/SCMON is capturing usage information for SAP, partner and customer ABAP objects. For the technical prerequisite to activate UPL or SCMON please follow the details in note 1828848 Please check the load on your system where you would like to activate SCMON and after activation please carefully check the performance of the system. As we are constantly improving our usage logging tools: UPL and SCMON, please check from time to time if there are notes available for UPL/SCMON which should be implemented. How to activate the UPL/SCMON tracking UPL/SCMON is collecting data starting with the date and time of activation. Completed time slices will be saved in a local database and stay untouched. Stopping and restarting UPL/SCMON at any time will lead to a reset of the counters for the current day of collection. Activation from SAP Solution Manger 7.2 SP06 The UPL/SCMON activation is part of the SAP Solution Manger Set-up (transaction SOLMAN_SETUP). Once UPL/SCMON is activated it is running on the managed system and SAP Solution Manager 7.2 is triggering the collection with the activation of the extractor framework job for UPL/SCMON. All settings will be made automatically in the managed system, as long as the preconditions are met. 6 Custom Code Management: Usage Logging Please follow and read the embedded documentation and instruction provided on the top of the configuration UI. Configuration of Usage Logging The SAP Solution Manger will automatically check the prerequisites in the managed system to activate UPL or SCMON. As SCMON is the successor tool for UPL, SCMON will be used whenever it is possible. The following scenarios are possible: • If the prerequisites for UPL and for SCMON are not met in the managed system, then it is not possible to activate UPL or SCMON • If the prerequisites are met for SCMON in the managed system then SCMON will be activated (in this case UPL will not be activated although the prerequisites for UPL might be met as well) • If the prerequisites are met only for UPL in the managed system, then UPL will be activated Within the Usage Logging Configuration, the needed jobs in the SAP Solution Manager and the managed system will be scheduled and the respective extractor framework will be activated to collect the data from the managed system. In case SCMON will be activated, the root information will not be collected from the managed system per default. If root information is needed, this can be activated separately in the Usage Logging Configuration. If SAP Solution Manager is available, it is not recommended to activate UPL or SCMON directly in the managed system. Please activate UPL/SCMON from SAP Solution Manager. 7 Custom Code Management: Usage Logging If the managed system was upgraded to a new SAP Netweaver release which supports already SCMON then the SAP Solution Manager will automatically switch to SCMON and deactivates UPL. The information of the release for the managed system will be checked by the job SM:SCMON_CONTROL using the information of LMDB. Activation of UPL directly in the system (not recommended) To activate UPL in the managed system please check if report /SDF/UPL_CONTROL is available. If the report is not available please follow instructions and implement note 1683134. To execute /SDF/UPL_CONTROL use SE38 or custom code apps (transaction CC_APPS or CCAPPS). Starting custom code apps, you find on the top the button to start the report: Start UPL control from custom code apps The report allows to start and stop UPL directly in the system. The default setting of days to be collected is 14 days, but can be increased or decreased. Start UPL and check status UPL cannot be activated if SAP Coverage Analyzer (SCOV) is already active. Please do not change the settings if UPL is activated by the SAP Solution Manager. If SAP Solution Manager has activated SCMON already then, a message appears when executing /SDF/UPL_CONTROL showing that SCMON is already activated and UPL should not be activated (SAP note 2552271). 8 Custom Code Management: Usage Logging Activation of SCMON directly in the system (not recommended) To activate/deactivate SCMON in the managed system use transaction SCMON. Activate/deactivate SCMON It is not recommended to run UPL and SCMON in parallel. Please do not change the settings if SCMON is activated by the SAP Solution Manager. How to read the UPL/SCMON data If UPL/SCMON is activated from SAP Solution Manager and the data will be extracted to BW of SAP Solution Manager then the data can be directly analyzed in the BW of SAP Solution Manager. UPL/SCMON data is also available directly on the systems where the usage tracking is activated for the specified time periods (see chapter “UPL/SCMON – How it works” for more details on the available data). Read UPL/SCMON data in SAP Solution Manager 7.2 If the data is extracted into the SAP Solution Manager BW, you can create your own queries on the respective DSOs or cubes to show and analyze the usage data. There is no standard report or standard query to read the data. The following cubes are used for UPL and SCMON: • Daily data DSO: 0SM_UPLDD; filled by usage extractor “Custom Code: Usage Extractor: SCMON” (AGS_CC_SCMON_EXTRACTOR). This contains the daily data collected in the managed system. It will be kept for a certain amount of days which can be defined in the Usage Logging Configuration. 9 Custom Code Management: Usage Logging • Weekly data DSO: 0SM_UPLDW; filled by an aggregation extractor “Custom Code: SCMON for Data Aggregation” (AGS_CC_SCMON_DSO). This data is aggregated based on the daily usage data. • Monthly data DSO: 0SM_UPLDW; filled by an aggregation extractor “Custom Code: SCMON for Data Aggregation” (AGS_CC_SCMON_DSO). This data is aggregated based on the daily usage data. • Yearly data DSO: 0SM_UPLDW; filled by an aggregation extractor “Custom Code: SCMON for Data Aggregation” (AGS_CC_SCMON_DSO). This data is aggregated based on the daily usage data. • In addition, there is a cube for each aggregation DSO (week, month, year) 0SM_UPL_W, 0SM_UPL_M and 0SM_UPL_Y; filled by separate extractors “Custom Code: Usage Logging SCMON (<period> DSO to <period> cube)” AGS_CC_DSO_2_CUBE_W/M/Y). 3 extractors one for week, one for month and one for year. • For SCMON there are additional DSOs to store the call graph data from SCMON: o daily data DSO 0SM_UCGDD; filled by extractor “Custom Code: Usage Logging – SCMON Call Graph” (AGS_CC_SCMON_CG_EXTRACTOR) o aggregation DSOs 0SM_UCGDW/M/Y; filled by extractor “Custom Code: Usage Logging – SCMON Call Graph for Data Aggregation” (AGS_CC_SCMON_CG_DSO) To build your own analysis you can use the existing standard multiproviders, which combine DSO and cubes, to access the data. Read UPL data directly in the system Use the report /SDF/SHOW_UPL to read the UPL data directly in the system. To execute /SDF/SHOW_UPL use SE38 or custom code apps (transaction CC_APPS or CCAPPS). Starting custom code apps, you find on the left the button to select and show the UPL data. Show UPL data directly in the system Using report /SDF/SHOW_UPL reads the UPL data of the system where this report is executed. If the report is called in the SAP Solution Manager it does not show the usage data of the managed system it will show the UPL data of SAP Solution Manager. 10 Custom Code Management: Usage Logging If SAP Solution Manager has activated SCMON already then, a message appears when executing /SDF/SHOW_UPL showing that SCMON is activated and usage data can be seen using transaction SCMON (SAP note 2552271). Read SCMON data directly in the system Use the transaction SCMON to read the SCMON data directly in the system. On the top, you find the button to select and display the data. Show SCMON data directly in the system Relation to other solutions/applications Workload Statistics (transaction ST03N) UPL or SCMON is not a replacement of the workload statistics (ST03N) but can be seen as an additional data source. Includes additional information: e.g. runtime and DB time information Tracks dialog steps instead of real executions Supports only transaction codes, executable programs and RFC function modules Is not able to cover dynamically called routines or SUBMIT programs The UPL/SCMON result will be more accurate, because it is able to detect also submitted programs or dynamic calls, can detect the usage of any ABAP based unit down to subroutines and will give you the transparency about used modifications, user exits, classes and also single method executions. SQL Monitor (SQLM) New capability of SAP NetWeaver to track usage of executed SQL statements at runtime. No manual trace ST05 has to be started Runtime and record logging of SQL statement 11 Custom Code Management: Usage Logging Transparency about used database tables Dynamically called ABAP routines with SQL statement will be catch Call stack information of initial caller will be logged Focus on SQL usage only Release SAP_BASIS 7.02 SP14 and following releases Further information on SQLM. Custom Code Lifecycle Management (CCLM) CCLM is using UPL/SCMON data and workload statistics to calculate a last usage date for custom code objects. CCLM will not store any detailed usage information for the custom code objects. The detailed usage information will remain in the DSOs and cubes of the BW in SAP Solution Manager. It is not possible to collect usage information for all custom code objects types in CCLM. For more information on CCLM please read the respective “How-to-Guide”. Overview on usage collection The following table provides an overview on usage collection Overview on usage collection 12 Custom Code Management: Usage Logging www.sap.com/contactsap © 2017 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forwardlooking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, and they should not be relied upon in making purchasing decisions. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. All other product and service names mentioned are the trademarks of their respective companies. See http://www.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices. 13