‎2006 Oct 29 8:57 AM
Hi all
I have report it's take 15 mints to run,becouse i want to run the backround thta report,please help me .
Thanks
kanishka
‎2006 Oct 29 9:00 AM
hi,
<b>here i am running this pgm in evry 15 minutes.
so this is sample code for that.</b>
There are two ways for you to handle,
one manually setting up the job through SM36 which is better and convinient,
secondly through program using FM's JOB_OPEN, SUBMIT, JOB_CLOSE.
Find below steps in doing both:
Procedure 1:
1. Goto Trans -> SM36
2. Define a job with the program and variant if any
3. Click on start condition in application tool bar
4. In the pop-up window, click on Date/Time
5. Below you can see a check box "Periodic Job"
6. Next click on Period Values
7. Select "Other Period"
8. Now give '15' for Minutes
9. Save the job
Procedure 2 via Program:
Below is a sample code for the same. Note the ZTEMP2 is the program i am scheduling with 15mins frequency.
DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
L_RELEASE(1) TYPE c.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = 'ZTEMP2'
IMPORTING
JOBCOUNT = P_JOBCNT
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 ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
WITH DESTINATION = 'HPMISPRT'
WITH IMMEDIATELY = SPACE
WITH KEEP_IN_SPOOL = 'X' AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = P_JOBCNT
JOBNAME = 'ZTEMP2'
STRTIMMED = 'X'
PRDMINS = 15
IMPORTING
JOB_WAS_RELEASED = L_RELEASE
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hope the above helps you.
Kind Regards
anver
if helped pls mark points
<i>
kindly close the thread if ur issue solved</i>
‎2006 Oct 30 5:55 AM
Hi Kanishka,
Refer this link: <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/c4/3a7ed1505211d189550000e829fbbd/frameset.htm">Background processing</a>
also have a look at the following example
data: job_no LIKE TBTCJOB-JOBCOUNT.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
* DELANFREP = ' '
* JOBGROUP = ' '
JOBNAME = 'TEST'
* SDLSTRTDT = NO_DATE
* SDLSTRTTM = NO_TIME
IMPORTING
JOBCOUNT = job_no
* 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 test via job job_name number job_no
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
* AT_OPMODE = ' '
* AT_OPMODE_PERIODIC = ' '
* CALENDAR_ID = ' '
* EVENT_ID = ' '
* EVENT_PARAM = ' '
* EVENT_PERIODIC = ' '
JOBCOUNT = job_no
JOBNAME = 'TEST'
* LASTSTRTDT = NO_DATE
* LASTSTRTTM = NO_TIME
* PRDDAYS = 0
* PRDHOURS = 0
* PRDMINS = 0
* PRDMONTHS = 0
* PRDWEEKS = 0
* PREDJOB_CHECKSTAT = ' '
* PRED_JOBCOUNT = ' '
* PRED_JOBNAME = ' '
* SDLSTRTDT = NO_DATE
* SDLSTRTTM = NO_TIME
* STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
* STRTIMMED = ' '
* TARGETSYSTEM = ' '
* START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
* START_ON_WORKDAY_NR = 0
* WORKDAY_COUNT_DIRECTION = 0
* RECIPIENT_OBJ =
* TARGETSERVER = ' '
* DONT_RELEASE = ' '
* TARGETGROUP = ' '
* IMPORTING
* JOB_WAS_RELEASED =
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Hope this helps.
Regards,
Kinshuk
‎2006 Oct 30 6:40 AM
Hi Kanishka
If i understand your query: as the program is
executing for long, you want to execute the same in
background.
We can do that in both ways:
1. <b>Executing in background manually.</b>
2. <b>Executing in background automatically.</b>
To execute in background manually, follow these steps:
1. Transction: SE38
2. Program Name
3. Use Menupath: Program -> Execute -> Background.
If we have variant we can specify here, orelse we
can create one by using <b>Variants</b> button in Application
toolbar.
4. Now click on <b>Execute Immediately</b> button to execute
immediately or <b>Schedule</b> to execute at a later time.
For automatic executions:
1. We can schedule a job via transaction <b>SM36</b>.
2. We can force to execute a program in background
through another.
Hope the above info helps you for better understanding.Kind Regards
Eswar
‎2006 Oct 30 7:05 PM
hi
go to sm36 and create a background job for the same.
Cheers,
Abdul Hakim