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: 

No output in Background job from report program

muzammo
Explorer
0 Kudos

Hello experts,

I have created a simple program based on radio buttons to do foreground or background. For the background there is no output yet the job is successfully finished .

Please find below my code

REPORT ztest_bg_fg.

DATA: job_count TYPE btcjobcnt,
  job_name  TYPE btcjob VALUE 'TEST'.

PARAMETERS: px_fg RADIOBUTTON GROUP fb DEFAULT 'X',
  px_bg RADIOBUTTON GROUP fb.

START-OF-SELECTION.

  IF px_bg EQ abap_true.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname  = job_name
      IMPORTING
        jobcount = job_count.

    SUBMIT (sy-cprog) VIA JOB job_name NUMBER job_count AND RETURN.

    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        jobcount  = job_count
        jobname  = job_name
        SDLSTRTDT = sy-datum
        SDLSTRTTM = sy-uzeit.

      write: / 'Job scheduled'.

      STOP.
    ENDIF.
  IF sy-batch EQ abap_true.
    WRITE: / 'Background'.
  ELSE.
    WRITE: / 'Foreground'.
  ENDIF.

  WRITE: / 'Not really doing anything'.
9 REPLIES 9

DoanManhQuynh
Active Contributor
0 Kudos

Maybe because your write statement is outside of job block

muzammo
Explorer
0 Kudos

I don't think so . As submit button will trigger this program with sy-batch being true . The message is not getting displayed and neither it is there in job logs . But yet the job status is finished .

horst_keller
Product and Topic Expert
Product and Topic Expert

Read the documentation ...

0 Kudos

Can you please help me with documentation link

horst_keller
Product and Topic Expert
Product and Topic Expert

Don't you know that you can use F1 on keywords in the Editor?

Domi
Contributor
0 Kudos

Hi

Report looks good - please check Tx SP01 if the list was created.

Depending on system performance the link of spool list and job will take some time (Batch and Spool Services)

regards

Domi

horst_keller
Product and Topic Expert
Product and Topic Expert

I am afraid, OP doesn't know about spool and that he expected an online list display, but I hoped that he'll find out himself ...

0 Kudos

Please check whether you assigned any program to the job 'TEST' in Tcode SM36

If not do it and execute the program

sathyags
Active Participant
0 Kudos

The code works fine scheduling a job 'TEST' with the output as