Skip to Content

Statistical Records Part 4: How to read ST03N datasets from DB in NW2004

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 want get the result in a more condensed format. So you implement your own report to utilize the aggregated statistical records of ST03N calculating your own metrics and reports.

Probably you have noticed my last How to read ST03N datasets from DB where the API for NW2004s was presented. This blog is about NW2004 and previous releases.

The function SAPWL_WORKLOAD_GET_STATISTIC provides almost all the tables used by ST03N. This API is available for SAP_BASIS 640 (NW2004) and previous releases (with small changes). Implementing a small program you can read the data, and extract whatever you are interested in. The code snippet [1] 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.

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

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

Parameter HOSTID is not used any more. You can ignore this parameter.

INSTANCE is the name of an application server. Use the name TOTAL if you want to get the data of all application servers.

ONLY_APPLICATION_STATISTIC is a flag. Specify an X if you just want to read the table APPLICATION_STATISTIC.

The function returns many different tables. You can view all these data using ST03N. The lower left tree of ST03N titled Analysis Views shows the available datasets (see the following screenshot).

image

The first entry Workload Overview of the tree unfortunately needs a special treatment. To retrieve this data from the database you need to call another function SAPWL_WORKLOAD_GET_SUMMARY. The interface is shown here:

The importing parameter are the same as for SAPWL_WORKLOAD_GET_STATISTIC.

Now you are able to implement a program reading the ST03N datasets. But one question remains: Before you can read ST03N datasets you need to know which datasets are available. How can you read the contents of the workload database? The answer is easy: SAPWL_WORKLOAD_GET_DIRECTORY is the name of the function which gives you the table of contents. ST03N uses this function to build the directory tree of ST03N. An example is shown by the following screenshot.

image

Related Weblogs and Articles

[1] Code Snippet: Which Z/* reports are used in NW2004

[2] Statistical Records Part 1: Inside STAD

[3] Statistical Records Part 2: RFC Statistics

[4] How to read ST03N datasets from DB

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

12 Comments
You must be Logged on to comment or reply to a post.
  • Hi Andreas,

    This question might be a bit off topic bit is stat trace related.

    I was wondering if from within an ABAP function any trace related data can be accessed. Is there any API available for querying any in memory stat trace data related to the current function?
    Example: From within an ABAP function test1 can I find out what is the transaction id the test1 execution is running under?

    Thanks.

    -Adi

    • Hi,
      if you want to know the current tcode you can use sy-tcode. This is not an API, but a system variable. As far as I know there are a few functions which could give you information about internals, like the transaction ID (TH_GET_TRANSACTION_ID).
      Regards,
      Andreas
  • Hi Andreas,

    I’m wondering which data is used to populate the Reponse Time Distribution table of ST03. I don’t see a table of that data returned from SAPWL_WORKLOAD_GET_STATISTIC. Is there another RFM to get the data?

    Also, the table TIME_STATISTIC looks very useful, showing hourly summaries for each transaction/report. I don’t see this hourly data in ST03; I only see the hourly data by task type (TASKTYPE_STATISTIC.)

    Thanks.

    Tim

    • Hi Tim,
      it’s all in SAPWL_WORKLOAD_GET_STATISTIC.
      TASKTYPE_STATISTIC (structure SAPWLTSKTI) contains the response time distribution data.

      And TIME_STATISTIC is displayed as “Time Profile” in ST03N.
      Regards,
      Andreas

    • Hi Tim,
      this aggregation is not in the data returned by SAPWL_WORKLOAD_GET_STATISTIC. Instead it is calculated by ST03N on-the-fly, using the SAP component hierarchy (see program SAPWL_LCL_WLP_TCODE).
      Regards,
      Andreas
  • Hi
    this fm SAPWL_WORKLOAD_GET_STATISTIC for ST03N doesn’t select all custom programs . At present we are using one customer developed report , In that we are using the Fm SAPWL_WORKLOAD_GET_STATISTIC . Now we are getting few custom programs only instead of all custom programs.Is there any way to display all active custom programs by using this FM. Can you suggest what is the criteria for selecting all custom developments by using this FM SAPWL_WORKLOAD_GET_STATISTIC . Pls suggest is there any alternative way to display list of actively used custom reports in an SAP system.

    Thanks in advance

    • Hi,
      no, there isn’t any selection for customm programs in SAPWL_WORKLOAD_GET_STATISTIC. Whatever program has been executed will show up here.
      Regards
      Andreas
  • Hi andreas
    while using the
    call function ‘SAPWL_WORKLOAD_GET_STATISTIC’ destination l_dest1 .
    the account values are converting in t_usertcode table please tell me procedure to get accout values without converting
  • Andreas,

    For SAPWL_GET_WORKLOAD_SUMMARY, what are the units for the time fields (CPU, response, etc.)?

    I thought they were microseconds (like in the raw statistics records), but comparing results to ST03 GUI it looks like they’re milliseconds.

    Thanks.

    Tim