Ansicht
Dokumentation

CL_DEBUG - Help Class for Debugging purposes

CL_DEBUG - Help Class for Debugging purposes

TXBHW - Original Tax Base Amount in Local Currency   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

This class is only relevant for development and service.

You can use this class in the following cases in particular:

  • Calls are often in a remote environment, and breakpoints cannot be set directly in the source code.

  • If development has to stop at certain points very frequently, but does not want to set breakpoints each time.

The advantages (apart from other SAP Basis functions) are:

  • You can transfer the name of the user for whom the breakpoints should work. This means that even in an RFC call, you use your own name instead of the commonly used RFC-USER (if you transfer it from the calling system, and it is available in the called system).

  • You have the option of using a countdown functionality (stop after X hits).

  • You can stop at one point and change your settings dynamically.

There a three methods:

  • BREAK
This method is the one used most often.
  • ACTIVATE_BREAK
This method is for special cases in long-running reports.
  • DUMP
This method is only relevant during the development phase, and must be removed from coding before delivery to the customer.

  • BREAK

IV_APPL - Application for Break-Point
IV_UNAME - User Name
IV_PARID - Set/Get parameter ID
IV_RETURN_IF_NOT_INITIALISED - No evaluation if not initialized before
This method evaluates the SET/GET parameter SAP_BS_FND_DEBUG, or your own parameter specified in IV_PARID from the user provided by input IV_UNAME (if not provided or not set in this user profile, then from sy-uname).
The applications transferred to the method by IV_APPL must be defined in constant classes for each AREA separately, such as CL_XXXX_APPL_C or /SAPAPO/CL_XXXX_APPL_C (XXXX denotes the AREA).
Applications consist of two parts: Applicationgroup and the specific Applicationpart. These two parts are separated by '#'. Examples of this are 'FUNC1#BEG' and 'FUNC1#END'. This means that you can later enter either only the application group, such as 'FUNC1', or a specific application part, such as 'FUNC1#BEG' in your system, under User Profile → Own Data for the parameter 'SAP_BS_FND_DEBUG'. In the first case, the system will stop at each point of the Applicationgroup; in the latter case, the system will stop only at the single point mentioned as Applicationpart.
The whole application, consisting of 'Applicationgroup#Applicationpart', must not be longer than 10 characters.
If you want the application to stop at multiple points, you have to separate their names by spaces.
If you use the SET/GET parameter, you can choose one of the following ways to tell the application at what point to stop:

  • Application only (Example: 'FUNC1#BEG')

It will stop every time the application is hit.
  • Application followed by a '+' and a number (Example: 'FUNC1#BEG+3')

It will count down and stop the first time 0 is reached.
  • Application followed by a '-' and a number (Example: 'FUNC1#BEG-3')

Inactive by default. You can activate it with the method ACTIVATE_BREAK (will multiply value by -1).

If you are in the debugger already, you can influence the next break by changing the method's PT_BREAK table (you have to switch on the system debugging to do this; see also the note below).
  • Delete or insert new lines to delete or insert new breakpoints.

  • Set value of Count to n, to break after n hits.

There are different ways to call the method:
  • First call specifying the application parameter and the userparameter:

CALL METHOD CL_DEBUG=>BREAK
EXPORTING
IV_APPL = YOUR_APPLICATION_IDENTIFIER
IV_UNAME = TO_BE_PASSED_USER_NAME.

  • Set your own parameter ID

CALL METHOD CL_DEBUG=>BREAK
EXPORTING
IV_APPL = YOUR_APPLICATION_IDENTIFIER
IV_UNAME = TO_BE_PASSED_USER_NAME
IV_PARID = YOUR_OWN_PARAMETER_ID.

  • Each additional call can be shorter, such as the following:

CALL METHOD CL_DEBUG=>BREAK( YOUR_APPLICATION_IDENTIFIER ).

  • A very special case can be a call in a progam that is called the first time at the event 'load of program'. At this event, you cannot initialize the method correctly, and you want to initialize it later on, so you can call it the following way:

CALL METHOD cl_debug=>break(
IV_APPL= YOUR_APPLICATION_IDENTIFIER
IV_RETURN_IF_NOT_INITIALISED = ABAP_TRUE ).
************************************************************* *
Note:
The class is marked as SYSTEM PROGRAM and the breakpoint has the addition AT NEXT APPLICATION STATEMENT. The break will be done after the return out of this method, where you really wanted to stop.
Drawback:
If you have to change PT_BREAK in the debugger, you have to switch on system debugging. This means that it will stop at this point in the method again. If you really have to change PT_BREAK at your first stop, you have to reposition the cursor to the line where this method is called, and you have to switch on system debugging.
************************************************************* *
  • ACTIVATE_BREAK
You use this method in a few places in long-running programs to activate an inactive breakpoint, for example, if a particular event occurs, or if support or development want to debug a special case. In this case you can call this method either through specifying the application parameter, thus activating only a single inactive breakpoint, or without the application parameter, thus activating all inactive breakpoints.
  • DUMP
You use this method during the development phase. The call to it must be removed before the program is delivered to the customer.
Sometimes it is difficult to find the cause of the problem, even though you can tell the progam is in a corrupt state. Normally, you would raise an A or X message, but if you do so, you cannot go into the debugger to examine the call stack or variables. By creating a dump instead of an A or X message, you can go into the debugger.

Relationships

Example

Notes

Further information






TXBHW - Original Tax Base Amount in Local Currency   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 9267 Date: 20240502 Time: 010600     sap01-206 ( 144 ms )