|
| 1 | +"Name: \TY:CL_TPDA_CONTROL\IN:IF_TPDA_CONTROL\ME:GET_EXCOBJ_SRCINFO\SE:END\EI |
| 2 | +ENHANCEMENT 0 ZABAPGIT_EXT_DEBUGGER. |
| 3 | + |
| 4 | + " The kernel method above always returns the position of the RAISE EXCEPTION statement. |
| 5 | + " Unfortunately, method GET_SOURCE_POSITION of the exception is not used here *sigh* |
| 6 | + " |
| 7 | + " For custom exceptions that use static methods to raise the exception this points to the |
| 8 | + " wrong position. Instead, we get the "source position" attribute of the exception |
| 9 | + " (MS_SRC_INFO or SRC_INFO). |
| 10 | + " |
| 11 | + " PS: Decoding attributes of type table (like MT_CALLSTACK) is quite complex so we |
| 12 | + " rely on a structure (which still requires some hex conversion). |
| 13 | + |
| 14 | + CONSTANTS version TYPE string VALUE '1.0.0'. |
| 15 | + |
| 16 | + DATA: |
| 17 | + attrtab TYPE tpda_sys_symbattrtyp_d, |
| 18 | + attr LIKE LINE OF attrtab, |
| 19 | + refstruct TYPE REF TO tpda_sys_symbstruct. |
| 20 | + |
| 21 | + FIELD-SYMBOLS <x> TYPE x. |
| 22 | + |
| 23 | + TRY. |
| 24 | + get_symb_objattr( |
| 25 | + EXPORTING |
| 26 | + toolid = 0 |
| 27 | + instancename = excobjname |
| 28 | + filter = '' |
| 29 | + IMPORTING |
| 30 | + attrtab = attrtab ). |
| 31 | + |
| 32 | + READ TABLE attrtab INTO attr WITH KEY attr_name COMPONENTS name = 'MS_SRC_INFO'. |
| 33 | + IF sy-subrc <> 0. |
| 34 | + READ TABLE attrtab INTO attr WITH KEY attr_name COMPONENTS name = 'SRC_INFO'. |
| 35 | + ENDIF. |
| 36 | + IF sy-subrc = 0. |
| 37 | + refstruct ?= attr-symbquick-quickdata. |
| 38 | + ASSIGN src_info-program TO <x> CASTING. |
| 39 | + <x> = refstruct->xvalstring+0(80). "char40 |
| 40 | + ASSIGN src_info-include TO <x> CASTING. |
| 41 | + <x> = refstruct->xvalstring+80(80). "char40 |
| 42 | + ASSIGN src_info-line TO <x> CASTING. |
| 43 | + <x> = refstruct->xvalstring+160(*). "int4 |
| 44 | + ENDIF. |
| 45 | + |
| 46 | + CATCH cx_root ##NO_HANDLER. |
| 47 | + ENDTRY. |
| 48 | + |
| 49 | +ENDENHANCEMENT. |
0 commit comments