2006 Oct 09 10:24 AM
Hi!
I am working in SCM and I am going to set up som batch jobs that should be scheduled to run after a particular event.
My questions are:
1. How do you define an event if you dont want to use the standard ones?
2. How do you trigger the event, do you have to write new ABAP code to raise the event or is there a standard function that can be used to raise events?
regards
Baran
2006 Oct 09 10:47 AM
Hi,
1. You define event in SAP using transaction SM62.
2. For triggering the event use Function module
<b>BP_EVENT_RAISE</b> from ABAP.
You need to define the event periodic job from SM36 , and this job is called when event is triggered from abap program or from shell script in UNIX.
Hope this helps.
Hi!
I am working in SCM and I am going to set up som batch jobs that should be scheduled to run after a particular event.
My questions are:
1. How do you define an event if you dont want to use the standard ones?
2. How do you trigger the event, do you have to write new ABAP code to raise the event or is there a standard function that can be used to raise events?
regards
Baran
2006 Oct 09 10:27 AM
hi,
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 usefful pls mark points
2006 Oct 09 10:47 AM
Hi,
1. You define event in SAP using transaction SM62.
2. For triggering the event use Function module
<b>BP_EVENT_RAISE</b> from ABAP.
You need to define the event periodic job from SM36 , and this job is called when event is triggered from abap program or from shell script in UNIX.
Hope this helps.
2006 Oct 09 11:51 AM
2009 Sep 02 11:19 AM
Hi
The solution herein requires ABAP programming which we do not want to do as the maintenance of the same may be difficult should things fall apart. The other one that requires a trigger of the event using UNIX level or ABAP script is limited in our case i.e., for UNIX level scripting you need to go through a bureaucracy with the managed service provider and if anything goes wrong the red tape kicks in. The ABAP script seems feasible however if this fails at some point the whole scheduling falls apart
We thought a straight forward solution was to use after job condition only to find that you can use this with two different jobs whereas in our case we want the same job to start every hour only if it ran successfully the previous time. This is because when it fails or runs for along time it chews up all background processes. Now for a BI system this is detrimental as all extraction jobs grind to a halt and then the reports start falling apart
I guess the solution here for us is to go to Redwood Scheduling and get all out batch processing on Redwood only. This should provide easy means to do the above and many more
joseph
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |