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.
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.
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:
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.
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).
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.
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>
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
thanks for you feedback. I take the topics "astat" and the function modules on my list.
Regards,
Andreas
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 ?
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
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
Regards, Andreas
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.
Regards, Andreas
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
what do you mean exactely? I'm not sure if I understand you question, sorry.
Regards,
Andreas
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
Regards,
Andreas
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
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
See also the documentation at http://help.sap.com/saphelp_erp2005vp/helpdata/en/4c/0f0e422efcdf2ce10000000a1550b0/frameset.htm
Regards,
Andreas
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
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
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
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
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
--
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
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
sure you can call this function by RFC. It's like any other remote enabled function module.
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
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
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
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
--
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
Thanks again!
--
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
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
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
What is the difference between a Transaction ID and the Passport used in Distributed Statistics Records?
Thanks.
--
Tim
the transaction ID is a GUID, and it is transported as part of the passport when perfroming RFC to remote systems.
Regards,
Andreas
Thanks
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
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
Regards, Andreas
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
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
there are two notes (802714 and 876868) which provide a correction for this issue.
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
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
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
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
Hi Andreas,
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
Thanks & Regards,
Ajay Deshmukh.
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
is it possible to see how often a z-prog is used? I only found the field DCOUNT.
Thank you in advance!
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
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
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
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
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
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
sorry, but there isn't any certifiable interface for statistical records.
Regards,
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
Which RFM to you recommend to get statistcs records for all instances in an SAP R/3 4.6C system?
Thanks.
--
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
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
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
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
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
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
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
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
yes. STAD and ST03N are calculating the response time in the same way.
Regards,
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
But some records still have long start/stop times and small reponse times.
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
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
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
Mea culpa,
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
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
Hi Andreas,len_laurence@bd.com
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
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
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
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
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
Kind Regards,
Andreas
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?
Regards,
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
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
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
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
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
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
This is very much helpful to me. Thanks alot
Cheers!!
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
Regards, Andreas
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
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
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
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
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
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
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
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
Regards,
Andreas
Regards,
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
You let me know the details.
Thank you.
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.
We can find current transaction id in "ThUsrInfo" function include name "TSKHINCL".
you can use the function module TH_GET_TRANSACTION_ID to get the transaction ID.
Kind Regards,
Andreas
Thanks,
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
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
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
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
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
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
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
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
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.
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
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.
yes, this works - it's a kind of customizing 🙂
Regards,
Andreas
Thanks.
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
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
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
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
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
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
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
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.
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
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.
Regards, Andreas
Good info. . .
Hi Andreas,
is there something comparable on HANA?
Best Regards,
Dennis