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

How to DEBUG a function module running in background mode? Please help!

gopalkrishna_baliga
Participant
0 Likes
3,091

Hi Experts,

I am calling a function module in my ABAP code in background module using the following syntax:

CALL FUNCTION 'YBBC2_CREATE_SNAPSHOT' IN BACKGROUND TASK

TABLES

itab_std_format_inv = itab_std_format_inv

itab_snapshot_inv = itab_snapshot_inv.

COMMIT WORK.

If I put the breakpoint in the CALL FUNCTION line and execute the program, the debugger does not take me to the valled function module. This may be because I am running the function module as background task.

I cannot comment this "IN BACKGROUND TASK" statement as well since i am debugging in Quality system where I don't have change access.

So how to DEBUG a function module running in background mode? Please help!

Thanks

Gopal

6 REPLIES 6
Read only

Former Member
0 Likes
1,008

Hi,

You could try to use the following trick:

(1) Put an endless loop into the coding of your function module where you want to start debugging, e.g.

DATA:

lx_exit_loop(1) TYPE c.

lx_exit_loop = ' '.

DO.

IF ( lx_exit_loop = 'X' ).

EXIT.

ENDIF.

ENDDO.

(2) Call your function module in background task

(3) Call transaction SM50 and search for the background process.

(3) Choose from menu Program/Mode -> Program -> Debugging

Now you the debugger should bring you right to your endless loop. Set lx_loop_exit = 'X' in the debugger and continue (F5 or F6).

<b>Reward points</b>

Regards

Read only

0 Likes
1,008

Hi SKK,

I cannot change any code since I am not debuging in development system.

For a particular case I have to use Quality system for debuging.

Read only

anversha_s
Active Contributor
0 Likes
1,008

hi,

BACKGROND PROGRAMS:you can debug the background jobs, use the command BDUG

One way of debuging programs which are already running in background is via transaction SM50. This displays a

list of process running in the server. In order to debug the program go to Menu option:

Program/Mode>Program>Debugging.

Rgds

Anversha

Read only

0 Likes
1,008

Hi Anversha s

I did not understood your answer.

I am not using a ABP program in background mode but the function module inside the ABAP program in called in background task.

I want to put a breakpoint inside this function module so that I can debug it. But it some does not work. The debugger does not go to the function module.

What shall I do? Kindly help me!

Thanks

Gopal

Read only

Former Member
0 Likes
1,008

Hi,

When you debug a program that calls function modules using the IN BACKGROUND TASK addition, they are processed in a background work process (additional internal session). If you set the In background task: Do not process option, the system collects the function calls, but does not start the background work process. The Debugger assigns a transaction ID, which identifies the background work process uniquely. You can now start the Debugger for the background work process using transaction SM58. You can select the function module concerned here, and then execute it via the Edit menu.

Regards

Sudheer

Read only

0 Likes
1,008

Hi Sudheer,

Where do we set "In background task: Do not process option"?

Can you kindly explain this? I am a novice in this.

Thanks for your aswer

Gopal