Application Development 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: 

sy-batch value when debuggin a background process

Former Member
0 Kudos

Hello All,

I have a quick question. I am working with a background job and I have a doubt about the sy-batch value. I know it set to 1 when the process in run in background but if I turn the debuggin on [ via the infinite loop ] then will the sy-batch value change to SPACE ?

In debugging I see its changed to space but I am wondering is it cause I am debuggin in background or is it because Its an update task ?

can you please advise ?

thanks,

1 ACCEPTED SOLUTION

former_member212653
Active Contributor
0 Kudos

The SY-BATCH should come as "X" when you debug a background job via infinite loop. Have you called any code update task? If yes then it will be processed via dialog processing so here SY-BATCH will be initial.

I just set this program in background and found that the SY-BATCH as "X" and it goes to infinite loop.


REPORT ztest1.

DATA: l_flag TYPE c LENGTH 1.
DO.
  IF l_flag = sy-batch.
    EXIT.
  ENDIF.
ENDDO.


DATA: l_string TYPE string,
      l_final TYPE string.

l_string =  'UPS Surface Collect #954365'.

DATA: l_dummy1 TYPE string,
      l_dummy2 TYPE string.


SPLIT l_string AT ' #' INTO l_dummy1 l_dummy2.

CONCATENATE l_dummy1 l_dummy2 INTO l_final.

WRITE:/1 l_final.

Edited by: Sourav Bhaduri on Sep 29, 2008 2:47 PM

10 REPLIES 10

Former Member
0 Kudos

Hi,

It's a system field not program specific so if you are debugging in the foreground then it will be set to space.

Darren

Former Member
0 Kudos

Hi Reena Sharma,

May i know how you can debug a background execution?

Whether it's get into DEBUGGER screen?

No, Youcan't debug.

Regards,

R.Nagarajan.

0 Kudos

yes it does get into the debuggin screen, since I have put an infinite loop.

Also its not a SM37 job but its in sm50

0 Kudos

Hi Renna Sharma,

SM50 is the 'PROCESS OVERVIEW'.

How you found SY-BATCH as INITIAL there.

Background execution can't be debug.

Regards,

R.Nagarajan.

0 Kudos

I have put an infinite loop

0 Kudos

You can debug it from SM50 as I assume you are or if you are on NetWeaver 2004 or 2004s you can use checkpoints.

See transaction SAAB.

Darren

0 Kudos

Yes I can, thats not my question. My question is will value of sy-batch change, I am really confused over it...

former_member212653
Active Contributor
0 Kudos

The SY-BATCH should come as "X" when you debug a background job via infinite loop. Have you called any code update task? If yes then it will be processed via dialog processing so here SY-BATCH will be initial.

I just set this program in background and found that the SY-BATCH as "X" and it goes to infinite loop.


REPORT ztest1.

DATA: l_flag TYPE c LENGTH 1.
DO.
  IF l_flag = sy-batch.
    EXIT.
  ENDIF.
ENDDO.


DATA: l_string TYPE string,
      l_final TYPE string.

l_string =  'UPS Surface Collect #954365'.

DATA: l_dummy1 TYPE string,
      l_dummy2 TYPE string.


SPLIT l_string AT ' #' INTO l_dummy1 l_dummy2.

CONCATENATE l_dummy1 l_dummy2 INTO l_final.

WRITE:/1 l_final.

Edited by: Sourav Bhaduri on Sep 29, 2008 2:47 PM

0 Kudos

Thanks a lot for your help Sourav. Indeed I have an update task [ I am doing a VF04 and submitting the print job to a 3rd party printer ] .

So can i conclude that if there is an update task involved the sy-batch will be set to null ?

thanks,

Edited by: Reena Sharma on Sep 29, 2008 10:26 AM

0 Kudos

yes...SY-BATCH will be "X" only when in background work process. when in update task it will be processed in UPDATE wok process. So in your case SY-BATCH will be initial.