‎2007 Nov 14 10:00 PM
Hi experts,
I am working on an interface and I have developed my object completely and now I have been asked by my team lead to make sure that this program runs in background, so can you please guide me through how can I take care of this.
Thanks
Rajeev
‎2007 Nov 14 10:05 PM
You can make a small program which can submit this program via jobname and jobcount to run it in background...
You have use like:
FM JOB_OPEN
SUBMIT Z_REP
FM JOB_CLOSE.
This code can help you:
DATA: w_job_name TYPE btcjob,
w_job_nr TYPE btcjobcnt.
start-of-selection.
w_job_name = 'ZTEST_NP'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
* DELANFREP = ' '
* JOBGROUP = ' '
JOBNAME = w_job_name
* SDLSTRTDT = NO_DATE
* SDLSTRTTM = NO_TIME
* JOBCLASS =
IMPORTING
JOBCOUNT = w_job_nr
* CHANGING
* RET =
* EXCEPTIONS
* CANT_CREATE_JOB = 1
* INVALID_JOB_DATA = 2
* JOBNAME_MISSING = 3
* OTHERS = 4
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
submit ztest_np1 and return
USER sy-uname
VIA JOB w_job_name NUMBER w_job_nr.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_job_nr
jobname = w_job_name
* strtimmed = co_marked
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
invalid_target = 8
OTHERS = 9.
IF sy-subrc <> 0.
* Internal error
write: 'error'.
ENDIF.
*Regards,
Naimesh Patel
‎2007 Nov 14 10:06 PM
To Schedule a background job:
Run SM36
Enter a background job name and job class
Click on the step button
Click on ABAP Program
Enter the program name and variant.
Click Start Condition and enter the time and date you would like the program to run
Alternatively to run immediately in the background:
Run SE38
Enter the interface program name and execute
Enter any selection criteria
Press F9 or select Program-> Execute in Background
‎2007 Nov 15 3:43 AM
Do you mean the progam or the batch input session that it creates?
Rob