Skip to Content
Author's profile photo Andreas Vogel

Statistical Records Part 1: Inside STAD

What are statistical records?

The ABAP statistical records are very useful if you want to know what’s going on in your system. It’s a technical logging feature implemented in the SAP kernel, and completely independent of the applications. Each dialog step is recorded, an information like user and program name, response time, CPU time and more is logged. This information is very useful when you want to analyze the performance (or a performance bottleneck) of your SAP system. From the statistical records you can get a hint where you should continue with a detailed analysis: CPU or database performance, memory issues, analysis of a particular application, and more.

How are statistical records created?

Statistical records are created by the work processes (WP) of an ABAP application server. At the end of a dialog step the WP collects the necessary information like user ID, program name, start time and end time of the dialog step, calculates metrics like response and DB time, and stores all this together in a so-called statistical record. This record is then stored in a shared buffer. All WP of an ABAP application server share the same buffer, and the statistical records are stored in the buffer chronologically.

When the buffer is full it is flushed to a file in the file system. Each SAP application server has it’s own statistics files.

The following screenshot illustrates the architecture.

image

Where are they stored?

The SAP kernel uses not only one single file for the statistical records. Each hour a new file is created where the statistical records are stored. This keeps the file size small and allows a flexible reorganization of the files (see below).

The files are stored in a directory like /usr/sap/<SysID>/<Instance Directory>/DATA. Try transaction AL11 to display the DIR_DATA directory. You’ll find one file named stat and many files named statnnn (where nnn is a number). These are the statistics files. Don’t try to display these files, they contain binary data only.</p>

How are the stat files reorganized?

The kernel itself maintains the number of statistics files. The profile parameter stat/max_files is used to control the maximum number of statistic files. Each hour a new file is created and the oldest file is deleted automatically. Make sure you have enough disk space available for all the statistic files. Otherwise the syslog (transaction SM21) shows the following message:

> File: /usr/sap/BCE/D26/data/stat

Failed to write to file, error 0028</p>

How can I access statistical records?

Using transaction STAD you can access the statistics files and display the statistical records. Here is a screenshot of the start screen of STAD.

image

Just specify date, time, and length of the interesting interval and hit the enter key. If necessary you can narrow your search by specifying values for the filter parameters:

image

If you select the button Server selection you can select the application servers you want to analyze. By default the statistical records of all servers are collected by STAD. Be sure that the checkbox Include statistics from memory is checked. This will force a buffer flush (see above) before reading statistical records from the file system.

Now hit the Enter key. STAD presents the result as a simple list.

image

Each line represents one dialog step. You can see the starting time of that dialog step, the application server name, and the program or transaction name, respectively.

For each dialog step the several metrics are shown, e. g. response time, CPU time, and DB time (scroll to the right to see these columns).

image

Please note: you need the authorization profile S_TOOLS_EX to see all user names. Without this profile you will see only your own user name. All other user names will be deleted and STAD only displays “-?-“ instead.

There is one thing I would like to point out here. We have specified an interval starting from 10:04:00, but the list shows a statistical record from 09:59:47. Is this an error? No, because 09:59:47 is the start time of the dialog step. The response time of this dialog step is 621 seconds, so the step ended at 10:10:08. At that time the statistical record was created and written to the shared buffer. And 10:10:08 is definitely inside the interval we have specified for STAD. So, if you are looking for the statistical record of a long running batch job then you need to know when this job ended (e. g. from the job log). In STAD specifiy an appropriate interval around this point of time. STAD will display the records sorted by their start time.

If you double-click one line you will see the details of this statistical record. All metrics are shown. You will have to scroll down a few pages to see all of them. The following example just shows a small part of it.

image

The section is titled Analysis of time in work process. The executed program was SAPWL_ST03N. The dialog step was started at 15:24:24 and ended at 15:24:30. The response time was 6087 ms, while CPU time was 210 ms.

This information helps if you want to analyze the performance of a single dialog step. You can see why the response time is larger than 6 seconds. CPU consumption is not an issue here in this example, but DB time is very high. So this could be the point where an optimization could start.</p>

Summary

You can see that STAD shows many technical details. All metrics are measured during the execution of the dialog step, and they describe what really happened. This makes the statistical record a valuable source of information about the performance of an application server. The statistical records are used to calculate aggregations (shown in ST03N), and they are used for SAP services like Going Live and Earlywatch Alert.</p>

Assigned Tags

      157 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Peter Inotai
      Peter Inotai
      Hi Andreas,

      Thanks for this blog.

      I was surprised to see a blog directly from the author of ST03N/SAPWL_ST03N (at least based on the header of the program SAPWL_ST03N).

      Probable you already have some other parts ready with more details, however a few things I'd like to see some:
      - info about purpose of the "astat" file.
      - it would be useful to have an overview of the ABAP function modules /eg SAPWL_WORKLOAD_GET_* /, which can be used in customer programs to read statistic data.

      I'm looking forward to read your next weblog.

      Best regards,
      Peter

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Peter,
      thanks for you feedback. I take the topics "astat" and the function modules on my list.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas Vogel:

      I am trying to find user-tocdes usage statistics using ST03.
      I am able to get for 3 months only.
      And also, I am able to get tocdes only.

      Can you please help to get user-tocdes statistics for a ECC60 system ?

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Saayi Baba,
      first you can control the reorganization of the workload collector database. Go to ST03N -> Collector and Performance DB -> Workload Collector DB -> Reorganization -> Control Data. Here you can change the reorganization period.
      The User and Tcode statistic provided by ST03N is the "Transaction Profile" (Tcodes; double-click to see user names) and the "User Profile" (User Names; double-click to see Tcodes). I hope this answers your question.
      Regards, Andreas
      Author's profile photo Former Member
      Former Member
      Hello Andreas, so nice to be able to talk to you directly...
      Recently I was given a task to write a program that has 4 columns for output.. there parameters were startdate and enddate .... output was tcode, user, last date used and #oftimes tcode used..... What i did is i got the list of active instances..... then got the workload directory for MONI.. using "SAPWL_WORKLOAD_GET_DIRECTORY" then used function "SAPWL_WORKLOAD_GET_STATISTIC" to get the the required info.... i was able to get this info from DB stats structure....when someone enters the current date than first I execute RSSTAT83 and then pick up the directory again.
      Q1. Is this the right approach ?
      Q2. Where do we define the maximum number of entries of days, weeks and months in directory before they get written over?

      thanks in Advance

      Author's profile photo Former Member
      Former Member
      Also is there a field in structure SAPWLHITL for DBstats that groups the dialogue steps in a business transaction.... something similar to TRANSID?
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      No, sorry. The transaction ID is not included in the hitlists of ST03N (SAPWLHITL).
      Regards, Andreas
      Author's profile photo Former Member
      Former Member
      Could it be possible to use a set of fields that if put together define a business transaction.
      From my observation i think if i put
      date, tcode,terminal, usrname, client, rollkey.

      Are these fields sufficient to define a business transaction? Please let me know if i need to add more or delete some.
      Then i can simple sort by these fields and then delete adjacent duplicate comparing them.

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      These six fields are a good selection. It does not define a business transaction, but it's the best guess. Especially the ROLLKEY (8 digits hexadecimal number) is of help: ROLLKEY(4) (the first four characters) identify the session (main mode), ROLLKEY+4(4) (the last four characters) identify the sub mode. Identifying the session may help you in identifying a business transaction.
      Regards, Andreas
      Author's profile photo Former Member
      Former Member
      You have been extremly nice Adreas.
      I have also added another field "report" in it also and am using rollkey(4) for sort and deletion.
      Do you have any plans on adding something for the security side in SAP?

      best regards,
      Abdullah

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Abdullah,
      what do you mean exactely? I'm not sure if I understand you question, sorry.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Well I had to make that program for a security consultant. Is there a standard transaction in SAP that looks at user from security point of view.....ie. user only running transactions which they are allowed to run.....
      People do bypass authorization checks and run tcodes they are not suppose to.
      St03 deals with SAP performance issues its not designed for security related issues. Am I right?

      regards,
      Abdullah

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Yes, you're right. ST03 is only about performance statistics, sorry.
      Regards,
      Andreas
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo Abdullah,
      your approach seems to be OK. Maybe you can skip the first step (get the list of active instances), because the SAPWL_WORKLOAD_GET_DIRECTORY will tell you what's available in the DB. Executing RSSTAT83 might be a risk, because RSSTAT83 runs once per hour anyway.
      The reorganization of the DB is controlled by ST03N (Workload Collector - Reorganization). There you can specify how many days/weeks/months you want to keep in the DB.
      Regards, Andreas
      Author's profile photo Former Member
      Former Member
      But Andreas the function I am using to get statistics "SAPWL_WORKLOAD_GET_STATISTIC" gets its input from SAPWL_WORKLOAD_GET_DIRECTORY.
      and i run rsstat83 on a condition that if work directory doesnt have a record with current date. As far as the reorganization is concerned, i just dont understand what those parameters means.... what does it mean by period for standard stats and time comparison data... and what does the value it takes means..

      thanks for your reply and best regards, 
      Abdullah

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      The ST03 data is in the "standard stats". You can specify for the daily datasets of ST03N how many days you will keep them in the DB. For the weekly datasets you specify how many weeks you want to keep them. And for the monthly datasets you specify how many months you want to keep them in the DB.
      See also the documentation at http://help.sap.com/saphelp_erp2005vp/helpdata/en/4c/0f0e422efcdf2ce10000000a1550b0/frameset.htm
      Regards,
      Andreas
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo Abdullah,
      your approach seems to be OK. Maybe you can skip the first step (get the list of active instances), because the SAPWL_WORKLOAD_GET_DIRECTORY will tell you what's available in the DB. Executing RSSTAT83 might be a risk, because RSSTAT83 runs once per hour anyway.
      The reorganization of the DB is controlled by ST03N (Workload Collector - Reorganization). There you can specify how many days/weeks/months you want to keep in the DB.
      Regards, Andreas
      Author's profile photo Sergio Ferrari
      Sergio Ferrari
      Thanks for this blog.
      I'm very interesting to learn more about HTTP events (that is Task Type H).
      For example:
      - how is it possible to distinguish between BSPs, Web Dynpro for ABAP and Web Services...(the program field seems not enough long to contain SICF nodes)
      - what does the screen number means in HTTP transactions
      - for a WDA is it possible to know the involved Web Dynpro Components/Window/Views and the selected event (LinkToAction, Button)
      - tips & tricks..

      Sergio

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Sergio,
      the http protocol in STAD is definetly something I should write about. However the next part will be about the RFC statistics. And then .... we'll see. Thanks for your feedback.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Dear Andreas

      I need to run STAD to bring user information from 10 days to today. Reading your blog, I try to set parameter stat/max_files ... for 10 days, the parameter should be 240, but the allow values for this parameter are 6-99 ...

      do you have any suggestion ?, for example, to change the write frequency for stat file from 1 hour to 3 hours ?

      thanks

      Carlo

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Carlo,
      indeed there is a limit. The SAP kernel will not handle more than 99 stat files, I'm sorry. However you might find the information you're looking for in ST03N - User profile.
      Kind Regards, Andreas
      Author's profile photo Former Member
      Former Member
      Is there a way I can extract the STAD data connect to an SAP system and using an RFC?
      --
      Tim
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      have use seen the RFC SAPWL_GET_STATRECS_FRAME? This will read the statistical records, even from remote systems.
      A simpler RFM would be SAPWL_STATREC_DIRECT_READ, but this will read statistical records from the local application server only.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas,

      I have written a small ABAP program that uses SAPWL_STATREC_DIRECT_READ to get and print the stat records.

      I see SAPWL_STATREC_DIRECT_READ is 'remoted enabled.' Can I call it from a perl program using an RFC? [I have used RFC to get other information from SAP, but not statistics records.]

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Tim,
      sure you can call this function by RFC. It's like any other remote enabled function module.
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas,

      I have successfully called SAPWL_STATREC_READ_REMOTE via RFC from another program! This works nicely for our R/3 4.7 system; I get main and subrecords and it looks like the same information as I would get in a user-exit.

      But for Basis 700, the main records are returned in NORMAL_RECORDS_KB table instead of the NORMAL_RECORDS table. What is the difference between the tables?

      Also, for Basis 700, there doesn't seem to be any subrecords returned. Do I need to use a different RFC to get the subrecords on a Basis 700 system, e.g. SWNC_GET_STATRECS_FRAME or SWNC_GET_WORKLOAD_STATRECS?

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      yes, we have changed the API with SAP_BASIS 700. Please use the SWNC* functions. The SAPWL_STATREC_READ_REMOTE is still available for some compatibility reasons (sigh!), but it doesn't work for the subrecords any more, because the data structures have changed, and new subrecords have been introduced.
      Best Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      I am doing an RFC to SWNC_GET_STATRECS_FRAME using SAP JCo and am getting a parse error on the returned XML for ALL_RECORDS.

      I posted messages to a couple of SDN forums (no response) and have opened an SAP tech support request.

      This is probably not your domain, but I just wanted to make you aware of it.

      Thanks for all you help.
      --
      Tim

      Author's profile photo Former Member
      Former Member
      Andreas,

      I have used SAPWL_STATREC_READ_REMOTE to read the stat records from an SAP system, Basis 620. It gives me main and subrecords.

      However, if I use SAPWL_GET_STATRECS_FRAME to get the records from the same time frame, I see only main records, no subrecords. Is this correct?

      Should both functions be returning the same set of records?

      Thanks.
      --
      Tim

      Author's profile photo Former Member
      Former Member
      Whoops, I figured it out. I was using the default for READ_ONLY_MAINRECORDS, which is to not read them.
      Author's profile photo Former Member
      Former Member
      Is there a way I can extract the STAD data connect to an SAP system and using an RFC?
      --
      Tim
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      you may use the function modules SWNC_STATREC_READ or SWNC_STATREC_READ_INSTANCE in SAP_BASIS 700 to read the statistic records of an application server.
      A more stable interface however would be SWNC_GET_STATRECS_FRAME.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Also, what fields are used to group the dialog steps of a business transaction?

      Thanks again!
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      there is a field called TRANSID. This is is GUID which is used to identify all statistic records of one business transaction.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Thanks, Andreas.

      Can the GUID (Global UID?) span multple instances? Meaning, if a business transaction does many steps, some of which are executed on different SAP instances (same system but different application servers), will the GUID be the same for all step?

      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      yes, of course. The transaction ID (a GUID) is tranmitted when calling remote instances (of the same system) or even instances of different systems. And we use the transaction ID to identify all statistical records of a particular business transaction. Transaction STATTRACE can collect statistical records even from remote systems.
      Regards, Andreas
      Author's profile photo Former Member
      Former Member
      Hi, Andreas.

      What is the difference between a Transaction ID and the Passport used in Distributed Statistics Records?

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      the transaction ID is a GUID, and it is transported as part of the passport when perfroming RFC to remote systems.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi there - Is there any documentation on how to set up and activate the statistic traces...?

      Thanks

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi David,
      the statistical records of an ABAP application server are activated by default. There is a profile parameter stat/level = 1 (default value). Besides this there isn't any statistic trace.
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas,

      Is there a way to tell the first or last stat records of a business transaction? Or is there a way to tell whether I have all the stat records of a busines transaction?

      I'm thinking that business transactions near the beginning of the collection period may be partion; only the last part of the transaction will be seen because the first part happened before the beginnning of the collection period. Similarly at the end of the collection period I may see the beginning of a transaction but not all
      of it.

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim, the statistical record contains a field LUW_INFO (1 byte). If bit 0 is set then this step is the first one of a business transaction. If bit 2 is set then this step is the last one. However it might not be possible in all cases to determine the end of a business transaction (e. g. user interrupt).
      Regards, Andreas
      Author's profile photo Carl Schmidt
      Carl Schmidt

      Hi Andreas,

      thank you for your input on the LUW_INFO field.

      Could you please help me to fully unravel the meaning of this field?

      Am I guessing correctly that each of the eight bits in this field has a special meaning?

       

      Best regards,

      Carl

      Author's profile photo Former Member
      Former Member
      Andreas,

      In STAD, is there a way to increase the 255 char line limit? Ideally, I would like to export all of the fields.

      Also, when you export from STAD, you get only the main records, correct? You don't get the subrecords.

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Tim,
      there are two notes (802714 and 876868) which provide a correction for this issue.
      Andreas
      Author's profile photo Former Member
      Former Member
      Hello Andreas,

      This blog was very helpful, Thank you for prepararing.

      I have a question,
      Recently I am trying to download response time hitlists using SAPWL_WORKLOAD_GET_STATISTIC.
      I read data into internal table with structure SAPWLHITL (for table hitlist_respti of function). Upto here everything seems fine, however, when function returns data, the internal table data looks strange from fields CPUTI and rest. it is more like functions's data structure or data types in structure is not same with SAPWLHITL. could you help me to find what the problem is? I tried ECC5 and 4.6c servers and trying to download from monthly statistics.

      best regards,
      Okay

      Author's profile photo Former Member
      Former Member
      Hi Andreas,
      I realized that i was using RFC for different versions of SAP. And normally structure is different in those systems. My mistake.
      Thanks for your time anyways.

      best regards.
      Okay

      Author's profile photo Former Member
      Former Member
      Hi Andreas,
      I have read all the three parts regarding the statistical records.
      All are really nice.
      We have implemented mySAP ERP 2004.
      The first part was of more interest to me.
      The ST03/ST03N presents a lot of information.
      Can I get additional information on ST03/ST03N.

      -Nandu More

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Nandu,
      for more information about ST03N start transaction ST03N and then choose the menu HELP -> Application Help. A browser window will come up. Another source would be http://help.sap.com . Search for ST03N in "SAP Netweaver" for NW2004.
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member

      Hi Andreas,

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi,
      the parameter stat/max_files can be checked with RZ11. Default value is 48 (AFAIK). In previous releases (NW2004 and before) the workload collector also controls the number of stat files. Check out the expert mode of ST03N -> Collector and Performance DB -> Workload Collector -> Control.
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi....This article on statistical records was great. But i need to know, where the data of avg. response time is stored.....in some table or a FM is used to get this data.

      Thanks & Regards,
      Ajay Deshmukh.

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Ajay,
      I guess you want to know where the ST03N data is stored? Have you seen this blog: Statistical Records Part 4: How to read ST03N datasets from DB in NW2004 ? It shows how you can read the ST03N data from the database. And there is a code snippet available which shows an example for an implementation. I hope this helps. From function sapwl_workload_get_summary you can retrieve the avg. response time per task type (e. g. DIALOG).
      Regards, Andreas
      Author's profile photo Former Member
      Former Member
      Hello Andreas,

      is it possible to see how often a z-prog is used? I only found the field DCOUNT.

      Thank you in advance!

      Jessica

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Jessica,
      you can check the "Transaction Profile" of ST03 which shows you how many dialog steps for a particular report or transaction have been performed. See my How to read ST03N datasets from DB which explains how you can read ST03 data from the database. Implement your own program - there is a code snippet available which can be the starting point for your own program.
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hallo Andreas,

      die Dialogschritte sind mir bekannt. Ich habe aber keinerlei Ahnung wie ich diese so ummünzen kann, dass ich auf die Anzahl der Transaktionsaufrufe an sich komme zum Beispiel MD04 50 Mal im Mai aufgerufen. Gibt es diese Möglichkeit überhaupt. Hab mir jetzt alle Tabellen im Funktionsbaustein angesehen und stehe noch immer gleich ratlos da...

      Danke für deine Hilfe!
      Jessica

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo Jessica,
      die Tabelle APPLICATION_STATISTICS im der Funktion SAPWL_WORKLOAD_GET_STATISTICS enthält ein Feld LUW_COUNT. Dieses Feld zählt die Anzahl der Transaktionsaufrufe. Dagegen stehen im Feld DCOUNT die Anzahl der Dialogschritte für den entsprechenden T-Code.
      Grüße,
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas,

      Is there a 'directory' function for stat records, like there is for the aggregates (ST03) info? Something that tells you the hours available on each instance of a system.

      What I'd like to do is to get the hours for which stat records are available, then show a timeline of the hourly aggregate information. User would pick an hour or two, then I get got the stat records.

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      no, sorry, there isn't any directory for the stat files. But you can use the value of stat/max_files to determine the available hours of statistical records. This would work for SAP_BASIS 700 and later.
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas,

      I see that the RFMs I'm calling to get stat records and aggregate data are not 'released' and, hence, technically not certificable.

      Is there an certifiable interface (BAPIs or released RFMS) to STAD and ST03 data?

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      sorry, but there isn't any certifiable interface for statistical records.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas,

      I want to use SAPWL_GET_STATRECS_FRAME to get the statistic records for all server instances in an SAP system.

      Do I have to call SAPWL_GET_STATRECS_FRAME, once for each instance? Or do I make one call and it will return a list of records for each instance?

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      this function will read the statistical records from all instances of a SAP system. Just call it once, you'll get them all.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas,
      I talked to you a while ago while implementing this function module. On moving it to our production environment, it will work when the stats are few, but when we ran for an entire day (using a program where we have coded the function module), it fails to return any stats (sometimes giving a short dump below... How can we resolve this?

                                                                                    
      Short text                                                                   
           " " (I/O error)                                                          
                                                                                    
                                                                                    
                                                                                    
      What happened?                                                               
           "CPIC-CALL: 'ThCMSEND'#Statistics not active "                           
                                                                                    
           An error occurred when executing a Remote Function Call.                 
                                                                                    
                                                                                    
                                                                                    
      What can you do?                                                             
           Note which actions and input led to the error.                           
                                                                                    
      Error analysis                                                               
           An error occurred when executing a Remote Function Call.                 
                                                                                    
           "CPIC-CALL: 'ThCMSEND'#Statistics not active "                           
                                                                                    
           Status of connection.... "CODE=CM_DEALLOCATED_NORMAL CM_SEND_RECEIVED    
            CM_COMPLETE_DATA_RECEIVED SAPCODE=0 CONV=79947373"                      
           Internal error code.... "RFC_IO5"                                        
                                                                                    
           There is an error in the communication system. To clarify                
           and resolve the error, contact your system administrator.                
                                                                                    

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Jimmy,
      try to split up your interval. Reading data for a whole day in one chunk will not work in typical productive environments. There are simply too many statistical records. Try to read the records of one hour only, and repeat the loop until you reach the end of your interval.
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Thanks Andreas!
      Author's profile photo Former Member
      Former Member
      Hi

      My name is Rhonda and I found your posting for SAP reports to be very helpful.  I am currently using STAD Report to give me a daily login of firefighter ID usage on a 24 hrs basis.

      Is there any way that this report can be automated so that I don't have to manually sign on and run this report everyday?

      Your response will be greatly appreciated.  Feel free to email me at _twinsis@excite.com

      Thanks,
      Rhonda

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Rhonda,
      I'm not sure if I really got the point, but you might check ST03N - "User and Accounting Profile". This gives you an overview about the active users in your SAP system. I hope this helps.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas,

      Three questions: I am doing an RFC call to SAPWL_STATREC_FROM_REMOTE_SYS to a Basis 700 system:

      1) The main records are returned in NORMAL_RECORDS_KB table instead of the NORMAL_RECORDS table. What is the difference between these two tables?

      2) When I compare the records I'm getting to what STAD displays for the same time period, the times are different. Response times are different and all of the database times  Why is this?

      3) Also, in the records I'm getting, if I data the database times (READDIRTI, READSEQTI, INSTI, UPDTI, DELTI, and COMMITTI), they are greater than the response time. I would expect the response time to include the database time. This holds true when I look at my R/3 system.

      Thanks.
      --
      Tim

      Author's profile photo Former Member
      Former Member
      Re 2) Let me clarify. I'm seeing similar response times, but for several steps the DB times are way off.

      Re 3) I see in STAT that Commit Time is not included in the database time in Basis 700. It is in Basis 620. But I still see the database time > response time.

      --
      Tim

      Author's profile photo Former Member
      Former Member
      Re 1) Looks like NORMAL_RECORDS_KB have all the 'byte' fields scaled to Kilobytes whereas NORMAL_RECORDS are in bytes.

      Re 2&3) I see differences in the DB request fields for background work. E.g. task types like AutoABAP, regular light-weight batch jobs, etc.

      I analyzed several Dialog tasks that did signficant DB work (e.g. SE37 steps) and found the db request data from the RFM agreed exactly with what STAD was reporting.

      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      actually you are testing a scenario we do not really support. SAPWL_STATREC_FROM_REMOTE_SYS is not supported in Basis 700. There you should use function SWNC_GET_STATRECS_FRAME instead. In 700 SAPWL_STATREC_FROM_REMOTE_SYS has limited functionality, and will return NORMAL_RECORDS_KB only (if data in NORMAL_RECORDS_KB is available you should always use this. The memory values in NORMAL_RECORDS might be incorrect).

      About NORMAL_RECORDS_KB: you are right, the memory values are given in KBytes, not bytes. There has been an extension in the kernel (more than 4GB memory), and therefore we had to switch to KB instead of bytes.
      Regards,
      Andreas

      Author's profile photo Former Member
      Former Member
      Andreas,

      I am calling the RFMs from a stand-alone program that uses SAP JCo.

      There is a bug in the SAP Jco interface: In order to call SWNC_GET_STATRECS_FRAME, customers need to have a SAP patch installed.

      I am looking for a function to get statistics records when the patch is *not* installed (and that works via JCo.) Is there another function I can call that will give me db times that match STAD?

      Thanks. I owe you a bier or two 😉
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      I see possible alternatives: SWNC_STATREC_READ (for one app.server only), or SWNC_STAD_READ_STATRECS (used by STAD, returns records from all app.servers ).
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      The STAD FM is ideal because it computes all the additional values from the base values and from the subrecords (e.g. processing time, db response time, time in WP, total bytes, etc.). This relieves that callers from having to do that and from having to know the version-specific calculations.

      But the STAD FM is not remote-enabled; I cannot call it from JCo.

      I will look at the other FM.

      Thanks.
      --
      Tim

      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      Using SAP JCo, I'm doing RFCs get statistics records. I am using a special logon that has minimal role authorizations, just enough to execute the FMs I am calling.

      I notice that I am getting '-- ? --' for the User (ACCOUNT) field of the main records. I suspect I need an additional authorization to get SAP to return the user name. Do you know what authorization I need?

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      yes, there is a profile S_TOOLS_EX. You'll need this to see user names in STAD and ST03N. And that's true for the RFMs also.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      Which RFM to you recommend to get statistcs records for all instances in an SAP R/3 4.6C system?

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      with release 4.6C the RFM SAPWL_STATREC_FROM_REMOTE_SYS is available. This give you the data from all application servers.
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hmmm. I didn't see SAPWL_STATREC_FROM_REMOTE_SYS in our 4.6c test system.

      The FMs I saw being used by STAD were:

      - FM  STUD.SAPWL_READ_STATISTIC_FILES – get workload and application stats for all instances
      - RFM STUD.SAPWL_READ_STAT_A_ASTAT_FILES – get workload and application stats for current instance
      - RFM STUW.SAPWL_STATREC_READ_FILE – get workload stats for current instance
      - RFM STUW.SAPWL_AS_STATREC_READ_FILE – get application stats for current instance

      My solution was to iterate over all instances and call SAPWL_STATREC_READ_FILE.

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      please check SAP note 486105. For 4.6C the RFM is available with SAPKB46C30.
      Otherwise the RFM you mentioned are the right ones. SAPWL_STATREC_FROM_REMOTE_SYS does the same (using SAPWL_STATREC_READ_FILE for all instances), but returns the data in different structures.
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      I am getting statistics records and summing up the CPU time in the main records. My results do not agree with STAD for the same time period. I believe the difference is because there lots of batch steps in the period.

      For a main record that has batch step subrecords, does the CPU time in the main records include the CPU time of all the batch subrecords? Or do I need to include the batch subrecords in my total? Does it depend on the RFM I use to get the stat records?

      Thanks.
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      yes, you have to add the CPU time from all batch subrecords to the total CPU time. The CPU time of the main record is the CPU time of the batch starter only.
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi, Andreas.

      Is there any documentation on the fields in the statistics records?

      I've found the struct definitions for the records but documentation is minimal. The best I've found is the struct definition used by STAD in NetWeaver 7.0. I'm looking for a white paper or SAP Note.

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      sorry, I regret, but there isn't much documentation available yet. But SAP note 1063061
      might be interesting. Check out the attachement of this note.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Interesting note. Thanks.

      I was assuming RESPTIME in the stat records was the response time, but STAD is computing the response time by adding RESPTIME and the rolled out time.

      Does ST03 report response time the same way?
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      yes. STAD and ST03N are calculating the response time in the same way.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi, Andreas.

      I am seeing records where the response time is much smaller than difference between the stop and start times.

      What does it mean when the response time is not equal to the difference between the stop and start times?

      --
      Tim

      Author's profile photo Former Member
      Former Member
      From the Note, I see that I need to include 'rolled out' time in reponse time. Doing this makes the response time agree with the start/stop difference, for some of the records.

      But some records still have long start/stop times and small reponse times.

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      yes. You have to add the 'rolled out' time to the response time and then subtract the queue time. Then you should get the time between start and stop.
      There is one important detail for Release 6.20 and before: for an RFC server process (tasktype RFC) the STAD/ST03N response time is calculated without the roll wait time.
      With release 7.00 this behaviour of STAD/ST03N has been changed. The roll wait time is always part of the response time, even for an RFC server process.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      Thanks for going to the trouble of putting together all of this great information.  (I wish I had the mental capacity to understand it a little better, though.)

      We're using this function module in an ABAP program to extract information on tcode activity by userid.  The program runs early in the morning for the previous day's activity, putting the extracted data into a unix file.

      The job always completes successfully, but sometimes there is no data extracted, even for a normal business day when we know there was activity.

      Should we be using a different function module, or is there possibly some Basis parameter that may need to be changed?  If you could point us in the right direction, that would be greatly appreciated.    

      We're at release 4.7 (Basis 6.2)

      Regards,
      Len Laurence
      len_laurence@bd.com

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Len,
      all statistical records of an application server are stored into a single file. This file is purged when its size exceeds a limit of 100MB. This is the reason why you don't get any data for the previous day.
      This behaviour changes with SAP_BASIS 700. Then the kernel creates a new file every hour, and the reogranization process can delete the oldest files only.
      Kind Regards,
      Andreas
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      I'm awfully sorry for the confusion. Please ignore my last comment (2007-11-07). The SAP kernel uses one single file for statistical records in SAP_BASIS 4.6C. With 4.6D and later releases the kernel creates a new stat file each hour.
      Mea culpa,
      Andreas
      Author's profile photo Former Member
      Former Member
      Thanks for the clarification, Andreas.
      Just to make sure I fully understand your responses to some other readers:
      1. SAPWL_STATREC_DIRECT_READ will return statistical records only for the local application server, but SAPWL_GET_STATRECS_FRAME will return records for all application serviers.
      2. One call of SAPWL_GET_STATRECS_FRAME will extract statistical records from all app. servers combined.
      Is this correct?  (Maybe part of our problem is that we're using SAPWL_STATREC_DIRECT_READ instead of SAPWL_GET_STATRECS_FRAME.)
      Best regards,
      Len
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Yes, SAPWL_STATREC_DIRECT_READ returns data for the local application server only. This function is not RFC enabled.
      A single call to SAPWL_GET_STATRECS_FRAME returns data from all application servers combined. Internally this function calls SAPWL_STATREC_FROM_REMOTE_SYS remotely on all application servers to retrieve statistical records. Howeve, if an application server has been shut down you will not be able to retrieve data from this server.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member

      Hi Andreas,len_laurence@bd.com 

      Author's profile photo Henry Curtis
      Henry Curtis
      Hi Andreas

      Thanks for your very useful blog.
      I need to report the number of times each user executes each transaction. Function module SAPWL_WORKLOAD_GET_STATISTIC shows me if a user executes a transaction, but not how many times (as far as I can see). Is there a way?

      Thanks, Henry

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo Henry,
      the table APPLICATION_STATISTICS of function SAPWL_WORKLOAD_GET_STATISTICS contains a field  LUW_COUNT. This field is used to count the number of transaction calls (/nTCODE). The field DCOUNT counts the number of dialog steps for a particular T-code. I hope this helps.
      Best Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hello Andreas,

      The LUW_COUNT field is showing as 0 and the DCOUNT is showing 2 for a custom transaction I executed directly - '/nZTCODE'. I used the FM SAPWL_WORKLOAD_GET_STATISTIC to retrieve this information.

      Could you please explain why LUW_COUNT shows 0 even when the transaction is run directly in foreground?

      Thanks
      Prab

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Prab,
      counting the number of transaction steps is easy, while counting the number of LUW is difficult and not 100% accurate, especially when you execute only a few steps of a transaction. The problem is detecting the end of the transaction. If a user aborts a transaction we can't detect this, therefore the counting of LUW will be just an approximation. Please remember: this is statistics, not tracing.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi, Andreas.

      In a Basis 700+ system, is there a SAPWL_* RFM I can call to get statistics records that will return subrecords, too?

      I'm working with a system that does not yet have the SAP JCo patch (SAP Note 1054000) and cannot use the SWNC_* RFMs.

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Sorry, but the SAPWL* functions have not been adopted to the new structures of the statistical records and will not work in SAP_BASIS 700+ .
      Kind Regards,
      Andreas
      Author's profile photo Rohini Kumar Tatambhatla
      Rohini Kumar Tatambhatla
      hi,

      its interesting topic and explanation given, its verymuch clear after reading this blog, but i have a question in STAD, i can not see more than a day i.e 24 hrs details, what is the reason, and what is the possible way to get the statistics of previous days also?

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Have you checked parameter stat/max_files? Please note: for SAP_BASIS 6.40 and previous releases there is only one single stat file which is deleted periodically. This might be the reason why you can display statistical records for approx. 24 hours only.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi, Andreas.

      At a high level, what is the difference between the data shown by STAD and the data shown by STATTRACE?

      It looks like STAD shows statrecs from only the current SAP system, while STATTRACE can show statrecs from multiple systems.

      Thanks.
      --
      Tim

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Tim,
      yes. STATTRACE can show statistical records from remote system also. And it can display statistical records from a J2EE server or an SAP ITS.
      If you have a scenario where system A calls system B, then STATTRACE can show the statistical records of A and B in a hierarchy where you can see which system is the caller and which one is the server.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      I would appreciate your advice on getting performance information about BSP applications. I would like to, if possible, see the sequence of calls (starting from the URL). I think that answering the following 2 questions will probably cover what I am trying to find out:

      1) Is there any way I can get the above information using STAD?

      2) Does the Internet Comm. Manager (ICM) talk to the ABAP Engine using RFC calls over JCO? (I assume that ICM is written in Java but I am not sure how the recipient side (on the ABAP Engine) is implemented).

      Thank you,
      Constantinos

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Constantinos,
      ICM is an integrated part of the SAP ABAP kernel. ICM communicates via http with the taskhandler of the ABAP engine.
      STAD will show you the statistical records for BSP, if an ABAP work process was involved.
      Sorry, I'm not an expert here.
      Regards, Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas,
      This is a very useful blog and for the first time i have seen lot of replies on a blog.(Indicates the popularity of your blog 🙂 )
      My query : I wanted to know the transactions/reports accessed by a User for a period of 1 month or more.stad doesn't provide this as it can have 2 days information (as per the parameter stat/max_files).
      Couls you please tell me if there is anyway..

      Thanks a ton
      Regards
      Sree

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Sree,
      please use transaction ST03N, which provides an aggregated view for statistical records. Select a server, a period, and check the user profile. If you double-click on a users name you will see all reports/T-codes executed by this user. I hope this helps.
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi,
      This is very much helpful to me. Thanks alot

      Cheers!!

      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      In ST03N we get 1 month statistical records but we can't find the Terminal ID by this , When we use STAD we get 2 last 2 days information with Terminal ID also.

      So can it possible above requirement by STAD.

      Thanks and Advance.

      Tapovardhan Singh

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Sorry for the late reply. ST03N shows the terminal ID in "Frontend Statistics" (see lower left tree).
      Regards, Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas, I find this blog very useful.
      I have a question about the location of stat files, I've recently moved the location of stat files (changing stat/file parameter during a planned system stop) of the two instances of an EEC system due to storage problems, by the time of starting the system the path wasn't visible to the dialog instance so it didn't generate any statistic for this instance (in central instance it worked ok), I made the path visible to the dialog instance then but all I've got is that the "stat" file is continuosly written during an hour (as it should do as I've read in your blog) and deleted after the hour, but it is not copied in any 'stat###' file (nor deleting the old 'stat###' files that we're moved at the time of the stat/file change). Do you know what could be happening?

      Thanks very much and great job

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Lucas,
      the stat files are managed by the kernel only. I've never tried to move the files to a different branch in the filesystem. Have you tried to restart the affected instances? Maybe ii will work fine if the path is visible when the instance is starting. Otherweise BC-CST-ST may answer your questions (OSS message).
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      It worked fine restarting the affected instance. Thank you
      Author's profile photo Former Member
      Former Member
      Hello Andreas,

        On a NW 7.00 SP15 system, I've been asked to produce a report of users and the transactions they have run over the last month or two.

        In ST03N, I can get the list of users on the system in the last month (or 2 or 3) and then drill down to see the transactions for each user.

        Is it possible to get a report of all users and the transactions they've run?  The linkage is there for individual users, but you have to drill down to see it.  I have to believe the data is there for all users/transactions, it's just a matter of finding the right report.

        Thank you so much - this blog is a wealth of information.

        Best regards...  Steve

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo Steve,
      this is an interesting question. ST03 doesn't provide such a report, sorry. But we have the data available in BI, where you can easily get this information.
      SAP offers the possibility to store the aggregated statistical records in BI. Check out this: Performance Reporting in BW
      Best Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      I’m wondering about the Report/Program name displayed in STAD.
      My system(v700) process a lot of requests from RFC and HTTP sources that activates a lot of reports.
      In STAD all I see in the program name is RFC or SAPMHTTP.  (transaction filed is empty)
      I also used function SWNC_STATREC_READ to get this data but got the same result as STAD.
      In SWNC_STATREC_READ I checked HTTP and RFC exports, they contain a lot of useful data but none has the report name.
      What I expect to see is the names of the reports as I can see it live on SM50.

      Is there a way/source where I can get this information for each step?

      Thanks,

      Eldad

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo Eldad,
      I'm sorry, but the report name is available only for dialog processing, where actally an ABAP report is processed. In case of RFC you should check the name of the executed funtion module (in RFC subrecords).
      Kind Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas,

      Thanks for the response.
      If I can't get the report name in the stat file,
      Is there a way to see function module execution live like I see the reports name in sm50?

      Thanks,
      Eldad

      Author's profile photo Former Member
      Former Member
      Hi Andreas,
         This is a great blog. Can you tell me whether it's possible to access this shared buffer and get some information out through a ABAP/C++ program? I want to access some information from these records and store it in a R/3 DB table. Is that possible?

      Regards,
      Satyajit

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Sorry, there isn't any official way to access the shared buffer. And I don't know any undocumented way how neither. You could read directly from the file, however the data is stored in a simple compressed format.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas, thanks for the explanation. Can you give me some more details about this compression technique that's used? If I access the directory how can I decompress the files to read them?

      Regards,
      Satyajit

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo Satyajit,
      sorry, I don't have any information about that. And the format changes from release to release, so I strongly recommend to use the ABAP functions to read the data. There isn't any C API for reading directly from the file.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Yes, It is very useful!
      You let me know the details.
      Thank you.
      Author's profile photo Former Member
      Former Member
      Hello Andreas,
      I found a lot of useful things in your article, but I can't find an answer for one question:
      how we can get "transaction id" of current transaction? I need it to get an stad statistic of current user, which can use "sm59 remote logon" from other system.
      Author's profile photo Former Member
      Former Member
      I solved problem myself.
      We can find current transaction id in "ThUsrInfo" function include name "TSKHINCL".
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Nick,
      you can use the function module TH_GET_TRANSACTION_ID to get the transaction ID.
      Kind Regards,
      Andreas
      Author's profile photo Somasundaram Chockalingam Peethambaram
      Somasundaram Chockalingam Peethambaram
      Hi Andreas, I am working on this STAD, which uses RSSTAT26 program in ECC6. I would like to understand the selection and filter criteria. I can understand the Start Time, Read Time, Display Mode. I am interested in knowing RENDTI, TaskType, Wait Factor,Seq. Stat. Dataset Name,Seq. Appl. Stat. Dataset Name.  And what is the different between Transaction and T Code filter, Program and Program filter.  Your earliest response is greatly appreciated.

      Thanks,
      Soma

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Soma,
      parameter RENDTI is obsolete. With "Tasktype" you can select records of a particular tasktype, eg. g. "Dialog" or "Batch". "Wait factor" is obsolete. With "dataset name" you can specify a file name which is then used to read the statistical records from. "Tcode Flter" is used in display mode 'C' to select transaction codes.
      Kidn Regards,
      Andreas
      Author's profile photo Somasundaram Chockalingam Peethambaram
      Somasundaram Chockalingam Peethambaram
      Hi Andreas,
                 Thanks much for immediate response. Could you please give me inputs for Task Type, since it is one character length? for eg. I want to see only T Codes..not jobs.
      Thanks & Regards,
      Soma
      Author's profile photo Somasundaram Chockalingam Peethambaram
      Somasundaram Chockalingam Peethambaram
      Hi Andreas,
                I understand that we need to use Task Type = 'D' to get the dialogs. It works fine for display mode 'A'& 'B'. But when it comes to display mode 'C', which is Business Transaction Totals, the report is showing all.  Is this a bug or this is how it will work.  Please advise.
      Thanks,
      Soma
      Author's profile photo Former Member
      Former Member
      Hi Andreas

      Thanks for all the useful info here and on your blog about SWNC_COLLECTOR_GET_AGGREGATES. I've been experimenting with that function module and I've managed to extract some values from the statistics but I've been struggling to match up the values with those in ST03. In one particular example, I've extracted time profile information for the following reports:

      EntryID: RTM_COLLECT_ALL RTM_PERIODIC_JOB R
      RespTi: 87
      CPUTi: 40

      EntryID: SDTS_SCHEDULE_CCMS_PAUSES SAP_CCMS_DT_SCHEDULER R
      RespTi: 293
      CPUTi: 190

      The times for RTM_COLLECT_ALL are correct - exactly what I have in ST03.

      The times for SDTS_SCHEDULE_CCMS_PAUSES are NOT correct.

      HOWEVER! I noticed that if I divide these times by 6 - then they are correct???!!!

      So how do I know which values are correct, and which ones to divide by 6?

      Another problem I'm having, and which bought me to this particular forum, is how to extract the average workload response times. The tables/structures that SWNC_COLLECTOR_GET_AGGREGATES utilises don't appear to contain these values. Looking at ST03N I can see the technical object name is SAPWLTIME2 - and looking at this structure I can see this does contain the average times I require.

      However, SAPWLTIME2 is not a table / structure included in FM SWNC_COLLECTOR_GET_AGGREGATES so I cannot use it.

      Is there another function module I should be using to access SAPWLTIME2? For example, SWNC_GET_STATRECS_FRAME is mentioned here... but had a quick look at that and there are no tables for the FM... so not sure how to use.

      Your help would be much appreciated... we need to automate our statistic reports, getting tired of digging through ST03 every day to manually edit spreadsheets and charts!

      Many thanks

      Ross

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo Ross,
      the function SWNC_COLLECTOR_GET_AGGREGATES provides aggregated data, including summary times (e.g. CPU, repsone time etc.) and the number of dialog steps. The average CPU time per dialog step (as shown by ST03N) has to be calculated: T_cpu / N = T_avg. This might explain also th efactor 6 you have observed for SDTS_SCHEDULE_CCMS_PAUSES.
        What about "average workload response times"? Where in ST03N can you see this data? Sure its provided by SWNC_COLLECTOR_GET_AGGREGATES  - this function returns many tables, it's definetly one of this.
      SWNC_GET_STATRECS_FRAME is not an option is this case. This function returns statistical records for single dialog steps, not aggregated data like ST03N.
      Best Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hi Andreas

      Many thanks for your reply, it is much appreciated. You are right about having to divide by the number of steps ('count'); it was just a coincident that I had a number of transactions that happened to have 6 steps each.

      I have now been able to use SWNC_COLLECTOR_GET_AGGREGATES to get the average response times for a transaction from USERTCODE and the average workload response times (i.e. for DIALOG, HTTP etc) from the TASKTYPE structures.

      Cheers
      Ross

      Author's profile photo Former Member
      Former Member

      Recently, after a SAN failover & restart of the SAP system, review of STAD records isn't showing earlier than the current hours activity.  If tried to go back 1 hour, data wasn’t there.  Review of the \usr\sap\Thank you for your time - we've read blogs, wiki's, notes, etc. etc. and cannot find details about our questions

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Sorry for the late reply - somehow I didn't received a notification.

      The stat files and theirs names are controlled by the SAP kernel, and it just offers an API to read data from the files. It will not work to rename these files, sorry, and I don't know any way to recover orphan files. You may delete them manually, there is no maintenance for this.
      A simple restart of a system will not discard or invalidate the stat files - the kernel will continue to write the records to the files. If the system is down for a longer time then in fact the existing files are invalidated, and new files are created.

      Best regards,
      Andreas

      Author's profile photo David Sanchez
      David Sanchez
      Andreas,

      We would like to add the Terminal Id column in the definition of a STAD variant (rsstat26).
      We are able to do it throught Sel. Fields (F9) but the configuration is not save
      in the next executions.

      Thank you very much.
      Regards David Sánchez.

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo David,
      you're right, the configuration can't be stored. You have to select the columns again each time you start the transaction. Sorry for that.
      Best regards,
      Andreas
      Author's profile photo David Sanchez
      David Sanchez
      Hi, Andreas.

      It is possible.

      SE11 edit table SAPWLWAMAI select field of terminalid and change de field of table AUSGABE.

      SAPWLWAMAI-AUSGABE = X.

      Next executions of STAD shows this field.

      Thank you
      David Sánchez.

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo David,
      yes, this works - it's a kind of customizing 🙂
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      I am trying to get the count by user of each tcode the user uses. I can get to it using STAD but only by downloading it to excel. I tried using the function module SWNC_COLLECTOR_GET_AGGREGATES but it does not contain as much data as the execution of STAD. It has fewer records when looking at 'HITLIST_RESPTIME'. Do you know why? Is there a better way to get to the number of times a user executes a transaction for a given period of time?
      Thanks.
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Jim,
      the function SWNC_COLLECTOR_GET_AGGREGATES offers the table USERTCODE (structure SWNCAGGUSERTCODE) where you can find the user (field ACCOUNT) and th etcode (field ENTRY_ID). This should give you the tcodes per user.
      You can check this if you start Tx ST03N, and from the profiles (lower left tree) you select  the "User profile". Double-click on a row for a particular user, and you'll get a popup-window with all transactions and reports for that user.
      Kind regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Andreas,
        Thank you for your fast reply. This would give me the counts by day, week or month. What I am really trying to get is the number of times a user executes a transaction or program per hour. So if a user executes VA01 I need to be able to see how many times they execute it by hour. One of the uses for this count is watching external consumption of a custom web service. It appears in the STAD data with a program name of SIW=======Z... When I look at the STAD data I see 109 entries. When I use the Function Module (Structure HITLIST_RESPTIME, I see only 11 entries. Is there a different structure where I could get this information? Or maybe a different function module?
      Regards,
        Jim Lamb
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hi Jim,
      HITLIST_RESPTIME is the list of the TOP 40 dialog steps (TOP 40 largest response time by task type), used to identify the most expensive dialog steps.
      In your case it would be necessary to read the single statrecs once per hour (using FM SWNC_STATREC_READ) or implement a BADI. See this blog NW2004s Workload Statistics Collector: Implementing a BAdI as user exit for details.
      Best regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hello Andreas,

      I am from Brazil and my english is not fluent. I am sorry.

      I have a problem when using FM "SWNC_COLLECTOR_GET_AGGREGATES". When I run out data unformatted.
      I am using the FM in a Z program, it can be any note ?
      Can you help me please?

      Here's an example with the same parameters in different companies.

      FM Parameters

      COMPONENT   =    TOTAL
      PERIODTYPE  =    M
      PERIODSTRT  =    01052010   (Brazil)

      See Column account of Company 2.

      Company 1   (Data Correct)

      TA ACCOUNT      ENTRY_ID

      01 ABAP01       EWK1
      01 ABAP01       RSABAPPROGRAM
      01 ABAP01       RSVRSRS1
      01 ABAP01       SAPMSEU0
      01 ABAP01       SAPMSYST
      01 ABAP01       SE01
      01 ABAP01       SE09
      01 ABAP01       SE11_OLD
      01 ABAP01       SE13
      01 ABAP01       SE16
      01 ABAP01       SE18
      01 ABAP01       SE19
      01 ABAP01       SE37
      01 ABAP01       SE54
      01 ABAP01       SE55
      01 ABAP01       SE56
      01 ABAP01       SE91
      01 ABAP01       SE93
      01 ABAP01       SESSION_MANAGER

      Company 2 (Data incorrect)

      TA ACCOUNT      ENTRY_ID

      01 5SqSph0XYO+  RSABAPPROGRAM
      01 5SqSph0XYO+  RSPARAM
      01 5SqSph0XYO+  RSPFPAR
      01 5SqSph0XYO+  RZ11
      01 5SqSph0XYO+  SAPMS380
      01 5SqSph0XYO+  SAPMSYST
      01 5SqSph0XYO+  SE10
      01 5SqSph0XYO+  SE16
      01 5SqSph0XYO+  SE93
      01 5SqSph0XYO+  SESSION_MANAGER
      01 5SqSph0XYO+  SM35P
      01 5SqSph0XYO+  STMS
      01 5SqSph0XYO+  SU01D
      01 5SqSph0XYO+  SU3
      01 5SqSph0XYO+  YBC_DTT001
      01 -A1eXh9GF06  /1BCDWB/DBPA0105

      Thanks a Lot.
      _____________________
      Luiz Carlos
      ABAP Consultant
      carlosluiz86@gmail.com
      Brasil - São Paulo/SP

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo Luiz,
      I assume you are calling the function SWNC_COLLECTOR_GET_AGGREGATES by RFC. The user names are scrambled (hash function) if you don't have to appropriate authorization.
      To get the user names an authorization is required. SAP note 20128 descrives the details: authorization object S_TOOLS_EX, field AUTH, value S_TOOLS_EX_A. You can assign the profile S_TOOLS_EX to the user which is used to read the data.
      Best regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      HI I using Bex 3.1x and Net weaver 7.0. I am running query views(web template, title, report) against one  multiprovider with up to 18 info cubes attached.

      Some queries are taking up to 8 minutes to run.

      I have identified these and trying to build  more aggregrates on the info cube it suggests in the stats. Unfortunately on some cubes there are 15 to 16 aggregrates already. So no effect on performance.
      These problem queries  views have long wait time durations event (1 or 9999) and database (9000) makes up 96% of total duration.
      I am tyring to use  STAD to analyze my steps.in another client for my userd ID only(no one else in there)I ran one querys.
      Unfortunately when I open one of the steps for a function like RFC. I am not sure what to key on. I chose one RFC step  with
      Response time of 74,767ms Data base time is 74,669ms. CPU times is 60 ms.
      Also have some larger run RFC response times and WRITEQUERY_NEU response times
      I think you have a part 2 for understanding STAD

      THanks

      Chuck Hando
      Manitoba Hydro
      Manitoba Canada
      chando@hydro.mb.ca

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo,
      analyzing RFC statistic records is a bit tricky, because usually you will get many stat records. This blog Statistical Records Part 2: RFC Statistics might help a little bit.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      Hello Andreas,

      When I use SWNC_COLLECTOR_GET_AGGREGATES, I only can get the Tcode CPU/DB time data by user from the table USERTCODE.
      Because there are some users use the same logon ID, we would like to know the Tcode CPU/DB time data by Terminal ID.
      I found that there are aggregate data about terminal ID from table FRONTEND, but it's not detail enough.
      Since there are aggregate data, it should be have detail data.
      Do you know how to get these or how to mapping the relation between users and Terminal ID?
      Thanks a lot~

      Regards.

      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Hallo,
      well, this case has not been on our list, sorry. From my point view each user shall get a personal user account anyway, "some users use the same logon ID" looks weird for me. The table FRONTEND contains a few KPI only, related to frontend issues (data volumen in/out, performance). Backend performance ist not included here.
      Regards,
      Andreas
      Author's profile photo Former Member
      Former Member
      I'm working on an app in C using RFC to call the function module SWNC_STATREC_READ. When I receive back the normal records in XML format, the task type values don't seem to be correct. For example, for an obvious RFC record, the task type field is "/g==". I've looked at the constants for task type in CL_SWNC_CONSTANTS and things don't seem to match up. How am I supposed to get a raw 254 value from this string? I'm assuming the encoding is UTF8, so I've tried to break the values down to hex and binary and figure out some kind of pattern that would tell me something is off (byte or nibble swapped, etc) but haven't had any luck. With the example, /g== would be 2F 67 3D 3D in hex, this doesn't seem to get me near the FE value I'm looking for. I've looked at several other task types from this data and am still at a loss in figuring it out. I have several other 'raw' fields to extract that seem to have the same formatting.

      Given that many of the raw values for tasktype don't correlate to a printable character, how do they get formatted in XML?

      Thanks for any help.

      Author's profile photo Former Member
      Former Member
      Author's profile photo Andreas Vogel
      Andreas Vogel
      Blog Post Author
      Congratulation. I just started to get help from our RFC experts...
      Regards, Andreas
      Author's profile photo Former Member
      Former Member

      Good info. . .

      Author's profile photo Former Member
      Former Member

      Hi Andreas,

      is there something comparable on HANA?

      Best Regards,
      Dennis