Enhancement for the ABAP debugger to jump to the correct trigger location for exception classes that use static methods to raise exceptions like ZCX_ABAPGIT_EXCEPTION
used in abapGit.
Made by Marc Bernard Tools giving back to the SAP Community
NO WARRANTIES, MIT License
The ABAP debugger has a feature to "show the trigger location" of the last raised exception. The feature works well when RAISE EXCEPTION
is used directly. However, if you embed RAISE EXCEPTION
in a static method of your exception class, for example in ZCX_ABAPGIT_EXCEPTION=>RAISE(...)
, then the debugger will jump to the location inside your static method and not to the location of the method call.
You can implement a GET_SOURCE_POSITION
method in your exception class, but unfortunately, the debugger does not call it 🤷.
After installing this enhancement, the debugger will check if an exception class contains the SRC_INFO
(or MS_SRC_INFO
) attribute and use it to determine the trigger location of the exception.
-
SAP Basis 7.02 or higher
-
Add
SRC_INFO
attribute to your exception classDATA src_info TYPE tpda_sys_srcinfo.
-
Add
GET_SOURCE_POSITION
method in your exception class -
Add the following to the end of the
CONSTRUCTOR
method of your exception classMETHOD constructor. "... " Save for debugger get_source_position( IMPORTING program_name = src_info-program include_name = src_info-include source_line = src_info-line ). ENDMETHOD.
You can install the Debugger Extension for abapGit using abapGit either creating a new online repository for https://github.com/Marc-Bernard-Tools/Debugger-Ext-for-abapGit or downloading the repository ZIP file and creating a new offline repository.
Recommended SAP package: $ABAPGIT-EXT-DEBUGGER
.
All contributions are welcome! Read our Contribution Guidelines, fork this repo, and create a pull request.
Made with ❤️ in Canada
Copyright 2025 Marc Bernard https://marcbernardtools.com/
Follow @marcfbe on Twitter