Currently Being Moderated
Andreas Vogel

How to read ST03N datasets from DB

Posted by Andreas Vogel in andreas.vogel on Mar 16, 2007 8:01:52 AM

Have you ever asked the question "Who uses all these Z* reports? Are they used at all?" Well, ST03N could give you the answer, but sometimes you might get the result in a more condensed format. So you implement your own report to utilize the aggregated statictical records of ST03N calculating your own metrics and reports.

With NetWeaver 2004s (SAP_BASIS 700) a new API is available. The function SWNC_COLLECTOR_GET_AGGREGATES provides all the tables used by ST03N. Implementing a small program you can read the data, and extract whatever you are interested in. The code snippet shows you the basic steps.

Let's have a short look at the interface of the function module. Before you can use this function you need to know the parameters. And you might read the documentation provided with the function in the ABAP workbench.

The parameter COMPONENT is used to specify the application server. Use the name TOTAL if you want to get the data of all application servers.

The Parameter ASSIGNDSYS is optional. Leave it empty, or specify the SYSID of your system.

PERIODTYPE specifies the type of the period you want to analyze. Valid values are D for days, W for weeks, and M for months.

PERIODSTRT is a date. Specify the day you are interested in.

The parameter SUMMARY_ONLY is optional. Specify an X if you just want to read the table TASKTYPE.

Parameter FACTOR is optional. The default value is 1000. This is used to scale all time metrics from microseconds to milliseconds. Leave it as it is.

Table USERTCODE
This table has four key fields: TASKTYPE, ACCOUNT, MANDT, and ENTRY_ID. TASKTYPE is a byte which can be decoded using CL_SWNC_COLLECTOR_INFO=>TRANSLATE_TASKTYPE, and ENTRY_ID contains the transaction code or a report name. The code snippet shows how this can be decoded. As data fields the table contains metrics like response time, cpu time and many others.
Authorization
The ST03N data contains user names. You will need the profile S_TOOLS_EX to see all the user names, otherwise the user names will be encrypted.
Related Weblogs

[1]Code snippet: Which Z* reports are used?

[2] Statistical Records Part 1: Inside STAD

[3] Statistical Records Part 2: RFC Statistics

[4] NW2004s Workload Statistics Collector: Implementing a BAdI as user exit

Comments