Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Detecting Debugging Mode Active programatically

Former Member
0 Likes
882

Hello all,

does anybody know how to detect if debugging mode is active programatically? I've tried to use SY-DEBUG but does not seem that its value change if you enter in debugging mode.

I guess that I could find if debugging mode is active or not by using the System function IS_ABAP_DEBUGGER_ACTIVE but I have no idea about how to call it or how to collect its results. Moreover I think there isn't any function module that could use this system function in order to avoid to use directly the System function.

I've searched some threads of this page but only have a long list of all the functions and nothing else.

Any ideas? Has anybody have a manual about how to use this functions? Many thanks in advance,

Enrique.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
426

Hi,

I wrote a small program for you, maybe it can help you.

For example, in the code you put a breakpoint by pressing the breakpoint button on the menu, by this way you set the debug mode active, and then when you run the program the program stops in the line where you set the breakpoint.

In the code below, the function will give you the line of breakpoint where you set it, if you don't set any breakpoint it returns you anything, so by this way you can understand the program debug mode is active or not.

*********************************************************************

DATA: lv_bcomplete TYPE BREAKPOINTS_COMPLETE,

lv_fsdebug TYPE c,

lv_feobject TYPE c.

DATA: lt_break TYPE TABLE OF breakpoint.

CALL FUNCTION 'SYSTEM_DEBUG_BREAKPOINTS'

EXPORTING

main_program = sy-repid

IMPORTING

breakpoints_complete = lv_bcomplete

flag_system_debugging = lv_fsdebug

flag_exception_object = lv_feobject

TABLES

breakpoints = lt_break

EXCEPTIONS

c_call_error = 1

wrong_parameters = 2

OTHERS = 3.

*********************************************************************

Regards,

Points for useful answers!!!

2 REPLIES 2
Read only

Former Member
0 Likes
427

Hi,

I wrote a small program for you, maybe it can help you.

For example, in the code you put a breakpoint by pressing the breakpoint button on the menu, by this way you set the debug mode active, and then when you run the program the program stops in the line where you set the breakpoint.

In the code below, the function will give you the line of breakpoint where you set it, if you don't set any breakpoint it returns you anything, so by this way you can understand the program debug mode is active or not.

*********************************************************************

DATA: lv_bcomplete TYPE BREAKPOINTS_COMPLETE,

lv_fsdebug TYPE c,

lv_feobject TYPE c.

DATA: lt_break TYPE TABLE OF breakpoint.

CALL FUNCTION 'SYSTEM_DEBUG_BREAKPOINTS'

EXPORTING

main_program = sy-repid

IMPORTING

breakpoints_complete = lv_bcomplete

flag_system_debugging = lv_fsdebug

flag_exception_object = lv_feobject

TABLES

breakpoints = lt_break

EXCEPTIONS

c_call_error = 1

wrong_parameters = 2

OTHERS = 3.

*********************************************************************

Regards,

Points for useful answers!!!

Read only

0 Likes
426

Hi Kenan,

I knew the existence of that function (actually I've used it) but the thing is that I cannot put breakpoints because the program in which I'm trying to detect if debugging mode is active or not is an RFC function which is called from a web page. I need to know if I'm debugging the code or not in order to do some extra things. The solution you gave could be useful if a breakpoint has been set, but remember you can start debugging mode too if you execute the transaction /h. That's why I'm looking for other solution.

Do you have any other ideas??

Many thanks for your answer Kenan.

Enrique.