2006 Nov 14 12:37 PM
Hi,
I have problems when creating a job that is supposed to be run once in background. I use the common steps as described below. My problem is that the report is executed twice.
- First it is executed synchronously when the job is created
- Then it is executed in the normal job step as I want it to do
I don't want it to be executed the first time because it creates data!!!
Code:
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = w_jobid
IMPORTING
jobcount = w_jobnr
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit.
SUBMIT (p_prog)
WITH p_idocnr = p_idocno
USER p_user
VIA JOB w_jobid
NUMBER w_jobnr
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_jobnr
jobname = w_jobid
strtimmed = 'X'
IMPORTING
job_was_released = w_jobrel.
Does anyone have a clue of what I should do to prevent this?
// Regards Hans
2006 Nov 14 12:46 PM
Hi,
Check the JOB_SUBMIT parameters once .....
here are the parameters which normally we pass
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
AUTHCKNAM = SY-UNAME " Runtime authorizations user
JOBCOUNT = JOBNUMBER " Value from JOB_OPEN
JOBNAME = JOBNAME " Value from JOB_OPEN
REPORT = 'REPORT' " Report to be run
VARIANT = 'VARIANT' " Variant to use with report
PRIPARAMS = USER_PRINT_PARAMS " User printing options
ARCPARAMS = USER_ARC_PARAMS " User archiving options Both sets of options
" come from GET_PRINT_PARAMETERS
EXCEPTIONS
BAD_PRIPARAMS = 01
INVALID_JOBDATA = 02
JOBNAME_MISSING = 03
JOB_NOTEX = 04
JOB_SUBMIT_FAILED = 05
LOCK_FAILED = 06
PROGRAM_MISSING = 07
PROG_ABAP_AND_EXTPG_SET = 08
OTHERS = 99.
Regards
Sudheer
Hi,
Check the JOB_SUBMIT parameters once .....
here are the parameters which normally we pass
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
AUTHCKNAM = SY-UNAME " Runtime authorizations user
JOBCOUNT = JOBNUMBER " Value from JOB_OPEN
JOBNAME = JOBNAME " Value from JOB_OPEN
REPORT = 'REPORT' " Report to be run
VARIANT = 'VARIANT' " Variant to use with report
PRIPARAMS = USER_PRINT_PARAMS " User printing options
ARCPARAMS = USER_ARC_PARAMS " User archiving options Both sets of options
" come from GET_PRINT_PARAMETERS
EXCEPTIONS
BAD_PRIPARAMS = 01
INVALID_JOBDATA = 02
JOBNAME_MISSING = 03
JOB_NOTEX = 04
JOB_SUBMIT_FAILED = 05
LOCK_FAILED = 06
PROGRAM_MISSING = 07
PROG_ABAP_AND_EXTPG_SET = 08
OTHERS = 99.
Regards
Sudheer
2006 Nov 14 12:42 PM
Hi hans,
1. Instead of using SUBMIT
2. use the FM JOB_SUBMIT
and provide the appropriate parameters.
regards,
amit m.
2006 Nov 14 12:44 PM
Hi Hans,
You can check SY-BATCH = 'X' (background) .
Create entries. This way Entries will be craeted only when the program is being executed background.
Reward points if this helps.
Manish
2006 Nov 14 12:46 PM
Hi,
Check the JOB_SUBMIT parameters once .....
here are the parameters which normally we pass
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
AUTHCKNAM = SY-UNAME " Runtime authorizations user
JOBCOUNT = JOBNUMBER " Value from JOB_OPEN
JOBNAME = JOBNAME " Value from JOB_OPEN
REPORT = 'REPORT' " Report to be run
VARIANT = 'VARIANT' " Variant to use with report
PRIPARAMS = USER_PRINT_PARAMS " User printing options
ARCPARAMS = USER_ARC_PARAMS " User archiving options Both sets of options
" come from GET_PRINT_PARAMETERS
EXCEPTIONS
BAD_PRIPARAMS = 01
INVALID_JOBDATA = 02
JOBNAME_MISSING = 03
JOB_NOTEX = 04
JOB_SUBMIT_FAILED = 05
LOCK_FAILED = 06
PROGRAM_MISSING = 07
PROG_ABAP_AND_EXTPG_SET = 08
OTHERS = 99.
Regards
Sudheer
2006 Nov 14 12:55 PM
Hi again,
1. U are right.
2. It will happen if we use SUBMIT.
3. As per the help documentation,
it will run the program in separate session,
( as soon as submit statement comes)
4. and run the INITIALIZATION event.
The VIA JOB addition also loads the program accessed in a separate internal mode when the SUBMIT statement is executed and the system performs all the steps specified before START-OF-SELECTION. This means the events LOAD-OF-PROGRAM and INITIALIZATION are triggered and selection screen processing is performed. If the selection screen is not processed in the background when VIA SELECTION-SCREEN is specified, the user of the calling program can eidit it and schedule the program accessed in the background request using the function Place in Job. If the user cancels selection screen processing, the program is not scheduled in the background job. In both cases, execution of the program executed is completed after selection screen processing and the system returns to the calling program due to the AND RETURN statement.
regards,
amit m.
2006 Nov 14 1:33 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |