On this page:

Your Rating:
34 rates
The ABAP language does not support dynamic bytecode instrumentation (like Java, for example), so it is not possible (or officially supported by SAP) to intercept arbitrary ABAP commands during runtime.

This section describes the procedure for manual ABAP code adjustments, which are useful when automatic instrumentation is not supported.

Please note that this section only covers enhancement of already detected business transactions, i.e. the code must be executed in the context of existing business transaction, otherwise it won't be monitored. SAP GUI dialog transactions are reconstructed into business transactions from log data, so no business transaction context exists during runtime.

Custom Actions

To enable collection of performance data for a section of custom ABAP code, use the class /DVD/APPD_CL_RUNTIME to start and stop the runtime measurement:

* Start action runtime measurement
  /dvd/appd_cl_runtime=>action_start( iv_name = 'Custom action 1' ).

* Custom ABAP code to be monitored

* Stop action runtime measurement
  /dvd/appd_cl_runtime=>action_stop( ).

The code above collects the number of calls and total runtime of the specific action. These metrics are stored in the transaction snapshot (top five custom actions ordered by runtime).

Make sure the action_stop( ) is always called for the monitored action:

  • If an exception is raised during the action, call the action_stop( ) method in the CATCH section to stop the measurement
  • Make sure there are no EXIT, RETURN or other commands which interrupt the action and avoid the action_stop( ) call

If the runtime measurement is not stopped properly, the performance data might not be collected, or can be collected incorrectly.

Custom RFC Exit Calls

To enable correlation of custom RFC calls, adjust the ABAP code before and after the CALL FUNCTION ... DESTINATION as in the example:

* Start the exit call for function module and remote destination
  /dvd/appd_cl_agent_rfc=>client_before_rfc( iv_funcname    = 'Z_MY_RFC_FUNCTION'
                                             iv_destination = 'MY_RFCDEST' ).
* Custom RFC call

* Stop the exitcall
  /dvd/appd_cl_agent_rfc=>client_after_rfc( ).
  sy-subrc = /dvd/appd_cl_agent_rfc=>sv_subrc.   "restore SY-SUBRC after the call


The code above starts a new exit call to the RFC backend. If the target system is an instrumented ABAP system, then the correlation information is propagated and the business transaction continues on the target system.

  • No labels