Imagine you change an order in VA02 and after clicking a specific button (e.g. the ATP (available to promise) check) it takes a while. Now you wonder what happens when you click this button and how you could trace exactly this click. In this blog we will explain how to trace a single dialog step with the "Particular Units" option in ST12.
Before you start:
Please read the "Before you start" section in this blog first:
https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/15702
We'll use the "Current Mode" scenario and the same tracing options as described in the above mentioned blog.
ST12 - Tracing a single step
After filling in the transaction and a comment for the trace (nr. 1 in figure 1) we select the "Particular units" option. Note: this option is only available in the "Current Mode" Scenario. All other options are set like described in the above mentioned blog.
Figure 1 - Trace with particular units
Executing the trace for particular units
We are ready to start our trace (nr. 3 in figure 1).
All we have to do is to mark the part we want to trace while we step through VA02. The prerequisite is that you switch on the "Particular Units" option in ST12 as shown above.
If you look at figure 2 which shows the steps we execute in VA02 to do an ATP check you can see that there are some steps that we don't want to trace:
We don't want to trace the whole execution (dashed black arrow) between T1 and T2 but only the ATP check (solid red arrow) between T1a and T1b. Note: As you can see in figure 2 the ST05 trace (dashed green arrow) records the whole execution of the transaction but not only particular units of it.
Figure 2: Executing VA02 with current mode particular units
While executing VA02 we have to mark which parts of the execution should be traced with the ABAP trace:
Figure 3: VA02
After you start the trace (nr. 3 in figure 1) VA02 (or the transaction /program you entered in the corresponding transaction / program field in ST12 in the main screen) will show up. Since we switched on the "Particular Units" nothing is traced so far. Now we enter the order and select it. During selection and when we do our changes, nothing will be recorded in the ABAP trace yet. Right before we click on the ATP check button (nr. 2 in figure 3) we type "/ron" in the ok-code field (this is the field where you type in the transactions e.g. ST12 as well) and press ENTER (nr. 1 in figure 3). This marks that the ABAP trace should be recorded from now on. This is confirmed with the message "Runtime analysis enabled" at the bottom of the screen (nr. 1 in figure 3).
After that we execute the ATP check by clicking on the button (nr. 2 in figure 3). The next screen shows the result of the ATP check. We have to set the second marker now that indicates we want to stop trace recording so that nothing else is traced from this point on. We enter "/roff" in the transaction code field (nr. 3 in figure 3). We get the message "Runtime analysis disabled" at the bottom of the screen (nr. 3 in figure 3). After this, nothing else (e.g. clicking on save) will be recorded in the ABAP trace any more. If you return to ST12 and open the ABAP trace, it will only contain these parts of the execution that were running between the markers "/ron" and "/roff". Note that the performance trace (ST05) captures the whole execution of the transaction as shown with the dashed green line in figure 2.
Alternatives for the "/ron" and "/roff"
In dialog transactions you can either work with the ok codes "/ron" and "/roff" like we have seen above. Alternatively you can use the menu path:
System - Utilities(H) - Runtime Analysis - Switch on
System - Utilities(H) - Runtime Analysis - Switch off
In your own developments (e.g. for programs running in background) you can even do it in the ABAP code with these 2 commands:
SET RUN TIME ANALYZER ON.
SET RUN TIME ANALYZER OFF.
This blog demonstrated the "Particular Units" option which is very useful if you want to trace a specific part of a program e.g. a single transaction step in dialog transactions.
And with special thanks to Sandra Rossi:
See how the above mentioned ok codes can be used in modal popup windows:
http://wiki.sdn.sap.com/wiki/display/ABAP/SAPGUI+shortcuts
More information on ST12 can be found here:
ST12 WIKI and Blogs:
http://wiki.sdn.sap.com/wiki/display/ABAP/Single+Transaction+Analysis
Books: