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: 

Submit via Job

Former Member
0 Kudos

Hello all

I m creating a program to delete old entries from tables.This can be done

1. Foreground

2. Background

I have created 2 reports

Report A - MAin report

Report B -has the following stmts

REPORT b.

DATA: i_JOBCOUNT LIKE TBTCJOB-JOBCOUNT,

i _JOBNAME LIKE TBTCJOB-JOBNAME .

SUBMIT A AND RETURN

USER SY-UNAME

VIA JOB I_JOBNAME NUMBER I_JOBCOUNT

.

In the background option of report A I have used

job_open with jobname as Report A.

Submit B

user sy-uname

via jobname jobnumber

and return.

Job_close

with jobname, jobnumbr and start immediately = 'x'.

Now when I execute this pgm with foreground option,

I get the records deleted from the table

but the same does not happen in background option.

kindly guide me.

Thanks

Tharani

5 REPLIES 5

Former Member
0 Kudos

Hi

Why don't you run the report A directly in background mode?

Anyway your report should be:

va_jobname = <REPORT B>
  
  CALL FUNCTION 'JOB_OPEN'
       EXPORTING
            JOBNAME          = VA_JOBNAME
       IMPORTING
            JOBCOUNT         = VN_JOBCOUNT
       EXCEPTIONS
            CANT_CREATE_JOB  = 1
            INVALID_JOB_DATA = 2
            JOBNAME_MISSING  = 3
            OTHERS           = 4.
  IF SY-SUBRC = 0.
    SUBMIT <REPORT A> USER SY-UNAME
                      VIA JOB VA_JOBNAME NUMBER VN_JOBCOUNT
                      AND RETURN.
   CALL FUNCTION 'JOB_CLOSE'
       EXPORTING
            JOBCOUNT             = VN_JOBCOUNT
            JOBNAME              = VA_JOBNAME
            STRTIMMED            = 'X'  
       EXCEPTIONS
            CANT_START_IMMEDIATE = 1
            INVALID_STARTDATE    = 2
            JOBNAME_MISSING      = 3
            JOB_CLOSE_FAILED     = 4
            JOB_NOSTEPS          = 5
            JOB_NOTEX            = 6
            LOCK_FAILED          = 7
            OTHERS               = 8.

  IF SY-SUBRC NE 0.
    MESSAGE E999 WITH TEXT-E05.
  ENDIF.   
 ENDIF.

Max

0 Kudos

Hi max

I believe that would call report A recursively.

Thanks Tharani

0 Kudos

Hi

Excuse me I meant Report B not A.

Max

Former Member
0 Kudos

Hi,

Why do you need 2 programs ? Same program can run both in Foreground & Background. Please explain your question in detail.

Regards,

Mukul

0 Kudos

Hi Mukul,

I m learning 'submit via job' thro' this forum.

from this thread

I guess we have use 2 reports for this.

Thanks

Tharani