Scheduling BG jobs
Hi ,
Ihave done code to do run BG job and in case of failure,I need to put the values into table &<b>I need to schedule jobs every 10 minutes taking the records from a database table ZTABLE</b>.
and ever time the job runs successfully, the record must be deleted from the table.
My problem is in bold
Anyone please help me with the code.
Thanks you
Create a Zee program which will extract/delete (as per requirement) the data from your Zee table. and schedule it in BG.
Regards,
Amey
Similar Messages
-
How to schedule a job in another system.
Hi,
Now i have an ABAP program, which run in system ABC, client 001. i want to schedule a job in the program, with the function modules JOB_OPEN, JOB_SUBMIT, and JOB_CLOSE. But this job should run in ABC/002.
How to write code?
Who can help me on the requirement, or provide me another new solution except event trigger?
Thanks & Best Regards,
JohnneyHere is the code. It works fine..
FUNCTION Z_F_TRIGGER_REPORT.
""Local Interface:
*" IMPORTING
*" VALUE(I_PROG) TYPE D010SINF-PROG
*" VALUE(I_VARIANT) TYPE VARIS-VARIANT
*" VALUE(I_MODE) TYPE CHAR01
*" EXPORTING
*" VALUE(E_SUBRC) TYPE SYST-SUBRC
*" VALUE(E_MSG) TYPE CHAR80
Functio ID : Z_F_TRIGGER_REPORT
TITLE : Report Trigger Tool
Create Date: 15.03.2004
Author : Denis Vieira
Ownership : For the exclusive use of the Procter & Gamble Company
Description:
The purpose of this function module is to trigger programs
requested remotely.
AUTHORIZATION CHECKS
OBJECT AUTHORITY FIELDS ABAP FIELDS
| |
CHANGE HISTORY *
DATE | Name | Description | Reference *
29.Jun.2006 | BA4513 | Unicode conversion and upgrade | SPK290606
| | to My SAP ERP |
**eject.
Check if selected program exists in the destination file
SELECT SINGLE SUBC
FROM D010SINF
INTO D010SINF-SUBC
WHERE PROG EQ I_PROG
AND R3STATE EQ C_A.
IF SY-SUBRC NE C_0.
MOVE C_2 TO E_SUBRC.
MOVE 'Report does not exist in destination system'(M01) TO E_MSG.
EXIT.
ENDIF.
Check if program request is an executable program
IF D010SINF-SUBC NE C_1.
MOVE C_2 TO E_SUBRC.
MOVE 'Report is not an executable program'(M02) TO E_MSG.
EXIT.
ENDIF.
Check if selected variant exists in the destination file
SELECT COUNT( * )
FROM VARIS
INTO W_COUNT
WHERE REPORT EQ I_PROG
AND VARIANT EQ I_VARIANT
AND DYNNR EQ C_1000.
IF W_COUNT EQ C_0.
MOVE C_2 TO E_SUBRC.
MOVE 'Variant does not exist in destination system'(M03) TO E_MSG.
EXIT.
ENDIF.
IF I_MODE EQ C_B.
PERFORM 0100_BACKGROUND USING I_PROG I_VARIANT
CHANGING E_MSG E_SUBRC.
ELSE.
PERFORM 0200_FOREGROUND USING I_PROG I_VARIANT
CHANGING E_MSG E_SUBRC.
ENDIF.
ENDFUNCTION.
*eject
*& Form 0100_background
Executes Selected program in BackGround Mode VIA JOB
*Block commented from here SPK290606
*FORM 0100_BACKGROUND USING L_PROG L_VARIANT
CHANGING L_MSG L_SUBRC.
*Block commented till here SPK290606
*Block added from here SPK290606
FORM 0100_BACKGROUND USING L_PROG LIKE D010SINF-PROG
L_VARIANT LIKE VARIS-VARIANT
CHANGING L_MSG TYPE CHAR80
L_SUBRC TYPE SYST-SUBRC.
*Block added till here SPK290606
CONCATENATE C_AREA
C_UND
L_PROG
C_UND
SY-DATUM
C_UND
SY-UZEIT
INTO W_JOBNAME.
Create a JOB and Get the Number for further execution
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = W_JOBNAME
IMPORTING
JOBCOUNT = W_JOBCOUNT.
IF SY-SUBRC NE C_0.
MOVE C_2 TO L_SUBRC.
MOVE 'Error opening job'(M07) TO L_MSG.
EXIT.
ENDIF.
Submit program
SUBMIT (L_PROG)
USING SELECTION-SET L_VARIANT
VIA JOB W_JOBNAME NUMBER W_JOBCOUNT
AND RETURN.
IF SY-SUBRC NE C_0.
MOVE C_2 TO L_SUBRC.
MOVE 'Error Submitting Job'(M06) TO L_MSG.
EXIT.
ENDIF.
Closes job to start its processing
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = W_JOBCOUNT
JOBNAME = W_JOBNAME
STRTIMMED = 'X'.
IF SY-SUBRC NE C_0.
MOVE C_2 TO L_SUBRC.
MOVE 'Error closing job'(M08) TO L_MSG.
EXIT.
ENDIF.
MOVE C_0 TO L_SUBRC.
MOVE 'Program Submitted in Background Mode'(M09) TO L_MSG.
ENDFORM.
*eject
*& Form 0200_foreground
Executes Selected program in ForeGround Mode VIA Submit
*Block commented from here SPK290606
*FORM 0200_FOREGROUND USING L_PROG L_VARIANT
CHANGING L_MSG L_SUBRC.
*Block commented till here SPK290606
*Block added from here SPK290606
FORM 0200_FOREGROUND USING L_PROG LIKE D010SINF-PROG
L_VARIANT LIKE VARIS-VARIANT
CHANGING L_MSG TYPE CHAR80
L_SUBRC TYPE SYST-SUBRC.
*Block added till here SPK290606
SUBMIT (L_PROG) USING SELECTION-SET L_VARIANT
EXPORTING LIST TO MEMORY AND RETURN.
IF SY-SUBRC EQ C_0.
MOVE C_0 TO L_SUBRC.
MOVE 'Report submitted successfully'(M04) TO L_MSG.
ELSE.
MOVE C_2 TO L_SUBRC.
MOVE 'Error submitting report'(M05) TO L_MSG.
ENDIF.
ENDFORM. -
Schedule Background Job : Remove delivery Block in Sales order
Hi Gurus,
I have a requirement to select all sales orders as per a condition and remove delivery block at
VA02-> Go to -> Header -> Status
For that I have to write a program which will be run only in background and i have to schedule background job for the same.
I have a parameter at selection - No of records
If no of records = 500 , I have to submit 500 jobs ie one job each for each sales order for removing delivery block.
I need to know
1) Which function module/bapi I can use to remove delivery block at sales order header level.
For blocked delivery the status is 'BSTK" . to remove block i need to change status to "RSTK".
2) How to schedule a background job for my program and how to submit one job each for each sales order.
Regards
Avi.Hi Avi,
Would like to seek for your advice. I am facing the same scenario too which is to delete the delivery block but is deletion of the delivery block is done in the user exit MV45AFZZ. The subroutine which needs to have the extra logic of deleting the delivery block is USEREXIT_SAVE_DOCUMENT_PREPARE.
Need your advice on how do you solve this scenario? Thanks in advance. -
Error in Schedule Background Job for Deadline Monitoring of swu3
While Auto Customization swu3 i am getting error message 'Output device "" not known' in 'Schedule Background Job for Deadline Monitoring'
Please advice what could be cause of itthe earlier problem of background job was solved by changing the output device assigned to user wf-batch .
regarding the transport request :
when i was trying to execute the step : "Schedule bakgrd for missed deadlines " MANUEL it was giving me an option of SAVE AND SCHEDULE . which was creating the transport request . but when i executed it automatically it worked fine without asking a request to me ... i don't know why )-: ... probablly we can specify a different interval then the standard of three minutes and which will be transported (it's just a guess) . i have executed it automatically ...
well thanks all for u r help -
How to schedule the job to run evry Sunday at 12 P.M IST.
Hi Experts,
I want to schedule a job which will run evry Sunday at 12 P.M IST.
I have written the below script.
[code]BEGIN
SYS.DBMS_SCHEDULER.CREATE_JOB
job_name => 'SERVICE_SAL_FS.SAL_MESSAGE_BUFFER_PURGE_JOB'
,start_date => SYSTIMESTAMP
,repeat_interval => 'FREQ=WEEKLY; BYDAY=SUN; BYHOUR=12;BYMINUTE=0; BYSECOND=0;'
,end_date => NULL
,job_class => 'DEFAULT_JOB_CLASS'
,job_type => 'STORED_PROCEDURE'
,job_action => 'SERVICE_SAL_FS.SAL_MESSAGE_BUFFER_PURGE_PROC'
,comments => 'Run at 12 P.M.IST every Sunday'
,enabled => TRUE
END;[/code]
But the server in US.
[code]SELECT sysdate from Dual;
6/11/2013 3:58:58 AM
--But the time in India is 02:28 PM [/code]
How to convert the timezone to IST.
Please help me how to schedule the job to run evry Sunday at 12 P.M IST.
Thanks.Did you read DBMS_SCHEDULER docs:
The calendaring syntax does not allow you to specify a time zone. Instead the Scheduler retrieves the time zone from the start_date argument. If jobs must follow daylight savings adjustments you must make sure that you specify a region name for the time zone of the start_date. For example specifying the start_date time zone as 'US/Eastern' in New York will make sure that daylight saving adjustments are automatically applied. If instead the time zone of the start_date is set to an absolute offset, such as '-5:00', daylight savings adjustments are not followed and your job execution will be off by an hour half of the year.
When start_date is NULL, the Scheduler will determine the time zone for the repeat interval as follows:
It will check whether the session time zone is a region name. The session time zone can be set by either:
Issuing an ALTER SESSION statement, for example:
SQL> ALTER SESSION SET time_zone = 'Asia/Shanghai';
Setting the ORA_SDTZ environment variable.
If the session time zone is an absolute offset instead of a region name, the Scheduler will use the value of the DEFAULT_TIMEZONE Scheduler attribute. For more information, see the SET_SCHEDULER_ATTRIBUTE Procedure.
If the DEFAULT_TIMEZONE attribute is NULL, the Scheduler will use the time zone of systimestamp when the job or window is enabled.
SY. -
Creating a job and scheduling a job error in OEM
Hi, Everyone,
I am trying to create and schedule a job thru OEM. In the the pl/sql block provide i have given my code like this
begin
SET SERVEROUTPUT ON;
SPOOL C:\RFV_PROFILE_REPORT.LOG APPEND;
SELECT TO_CHAR(SYSDATE, 'DD/MM/YY HH24:MI:SS') FROM DUAL;
EXEC PAC_RFV_PROFILE_REPORT.CALL_ALL (200910);
SELECT TO_CHAR(SYSDATE, 'DD/MM/YY HH24:MI:SS') FROM DUAL;
SPOOL OFF;
end;
i have created the job and scheduled it but i am getting this error:
Error # 6550
Details ORA-06550: line 2, column 5: PL/SQL: ORA-00922: missing or invalid option ORA-06550: line 2, column 1: PL/SQL: SQL Statement ignored ORA-06550: line 3, column 7: PLS-00103: Encountered the symbol "C" when expecting one of the following: := . ( @ % ;
could anyone pls help as this is very urgent.
Thanks in advanceAh, the problem is you are confusing SQLPlus commands with PL/SQL.
SET SERVEROUTPUT ON; -- This is a SQLPlus command, not necessary here.
SPOOL C:\RFV_PROFILE_REPORT.LOG APPEND; -- This is a SQLPlus command, in PL/SQL to write out to a file you will need to call the UTL_FILE package to open a file for writing to. Except that the file you write to will appear on the database server, not your workstation, when the scheduled job runs.
SELECT TO_CHAR(SYSDATE, 'DD/MM/YY HH24:MI:SS') FROM DUAL; -- In PL/SQL you need to SELECT columns INTO variables FROM tables. But in fact I guess you want to write the time to file using UTL_FILE again. However, you don't really need to do this, since scheduler will log the start time and run duration itself.
EXEC PAC_RFV_PROFILE_REPORT.CALL_ALL (200910); -- This is the SQLPlus equivalent of the PL/SQL command:
BEGIN
PAC_RFV_PROFILE_REPORT.CALL_ALL (200910);
END;
SPOOL OFF; -- This is a SQLPlus command, not necessary here.
So to summarise, all you really need is:
BEGIN
PAC_RFV_PROFILE_REPORT.CALL_ALL (200910);
END;
And the scheduled job will log the start time and duration in the database, which you can find here:
SELECT * FROM USER_SCHEDULER_JOB_RUN_DETAILS -
Scheduling background job on Logon group
Hi All,
We have 4 logon groups configured in SMLG, while scheduling the job in SM36 ->Target server field i am able to see only one group and other indivdual servers not all the Groups configured in SMLG.
Is there any option i have to check to let all the groups configured in SLMG to diaply in SM36 for scheduling so that i can select the Logon group. I tried giving the logon group names manually which are not listed in Target server field it's giving the error group not exist..
Please suggest..how to make all the Groups configured in SMLG to get displayed in SM36 for scheduling jobs...
Thanks,
Subhash.GTarget server field is Name of an SAP instance at which a background job should be run. The name has the following format: <host name>_<SAP System name>_<SAP System number>, where host name is the name of the server computer on which the instance is running, as specified in the system profile parameter SAPLOCALHOST.
The name of each instance is specified in the system profile parameter rdisp/myname.
Example: hs0123_C11_55
In programming: As the table field EXECSERVER, shows the target instance selected by the user for running a job. As the table field REAXSERVER, shows the SAP instance at which a job was actually run.
Hope this is clear.
Thank you,
Shyam -
Schedule background jobs which run only on Thursdays.
Dear Friends,
We are using ECC6.00. I have a requirement whereby a specific job (background) should be executed only on Thursdays. I searched in this forum but couldn't get anything related to my question. I tried the options present in the SM36 transactions (scheduling options).
Is there any way of achieving my requirement.? Experts help required.
Regards,
M.MHi Magesh,
I am not sure if this would be the right approach. But if you are really sure that there is no way to do this using SM36 settings,
you can schedule a job to execute daily, which would be a custom abap program.
This program would check the day and if it is a thursday ,will schedule another job for the day(programatically).
This can be a way around to solve this problem.
Regards,
Sagar -
Schedule background job using system variant
Dear gurus,
We're planning to schedule background job using system variant, for example, current fiscal year and current posting period (transaction AFAB). Is it possible? So for example, for this month, "Posting Period" value will be 6, and then next month will be 7.
Can you tell me how to do this, if I want to set up the schedule only once?
Thanks for your help.
Best Regards,done using abap
-
Schedule background job programatically
Hi,
I want to schedule background job programatically .
Also, I want to specify the scheduled start time & start date .
Please suggest .
Moderator message - This question has been asked and answered many times before. Please search before posting.
Edited by: Rob Burbank on Apr 16, 2009 12:27 PMHi
Please check this link
[http://help.sap.com/saphelp_46c/helpdata/en/fa/096ee5543b11d1898e0000e8322d00/frameset.htm]
Thanks,
Hari -
Schedule background jobs at OS level.....
Hi All,
Scheduling Background Jobs at SAP Level is a very simple task. Is there any way to schedule background jobs at OS level? Please lemme ASAP....
Thanks
RhishabhHi Rhishabh,
Actually we can not completely schedule background at OSLevel but we can trigger a background job which has alreadyscheduled by using sapevt tool syntax as follows.
sapevt <event name> nr=<instance name> name=<host name>
or we have tool like
In unix you use crontab.
We can use different job scheduling softwares like IBM TIVOLI software MAESTRO JOB SCHEDULING CONSOLE, Control M
Regards,
Kiran M -
Hi
Gurus
What is Schedule Background Jobs and whatu2019s the use of Schedule Background Jobs
How it will worku2019s
Please give me detail Information about Schedule Background Jobs
Many Thanks
MahiHello Mahi,
The BackGround job - "Program" thats runs in SAP Server and not depend any user interface.
like Antivirus program on your local station that runs (scaning your computer all the time) without any user interface (becide tray Icon) and unless you going to Running Proccess on your computer you don't know that it working.
Schedule BackGround Job its any backGround Job that you schedule to run any time you want and you can make it run recursivly.
you can go to Transaction SM36 to schedule your Programs.
Good Luck
Eli Steklov
Please Reward Points if it Helped -
Schedule background Job Programatically at specified date and time
Hi Everybody,
how can i schedule a job in background programatically for a spefic date and time ?
Thanks and Regards
srikantaHi Chandrasekhar,
my requirement is :
in selection screen there will be two run mode :
1) Run in Foreground
2) Run in Background
If user selects ' Run in Background ' option , a block will open where user can give
job schedule date and
job schedule time.
Based on this date and time program will be scheduled in background.
I have used like this :
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = v_jname
SDLSTRTDT = p_date
SDLSTRTTM = p_time
IMPORTING
JOBCOUNT = v_jcnt
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
where v_jname is jobname
v_jcnt is jobcount
p_date is schedule date ( taken screen value)
p_time is schedule time ( taken screen value)
but the job is sxcheduling immediately
Give suggestion.
Thanks in advance.
Srikanta -
Schedule Background jobs automatically -
Hello Guys,
I have the following requirement.
I have a copy program in BPS-SEM(ABAP program).
Users have to run the copy program for different combinations like
variant:1
costcenetr 100-200
valuetype - 10
user 1
variant:2
costcenetr 400-500
valuetype - 10 to 20
user 1
variant:3
costcenetr 1000 to 2000
valuetype - 50 to 70
user 2
...etc.maybe there will be 10 to 15 variants will be created by 4-5 different users .
I have to schedule the above jobs in sequence. The user wants to determine
variant 1 - seq 1
variant 4 - seq 2 after completing variant 1
variant3 - seq3 after completing variant 4
so I have to schedule all the variants in sequence the user wants to schedule the job.
After all the above jobs are done, I have to schedule a job with variant called - calculate all functions. This has to be last after running all the above variants.
My question is
4 users have created 10 variants.
I want to schedule the above variants in sequence in which the user wants to do execute it.(Is there anyway user can choose the sequence )
2.After running all the above variants I have one variant which I have to run after completing the above variants.
Thanks for your help guys.Hi,
While Scheduling jobs through SM36 you have to specifiy the start condition for a Job.
You can specify the START CONDITION as 'AFTER JOB'. So the first JOB will be scheduled normally. For all the Other JOBS, we will specify the start condition as the Previous JOB.In this case the Job will run After the completion of the previous Job.
So you can schedule all the JOBS in sequence for all the Variants. So every JOB will run one after other in sequence
Go through the link below
http://help.sap.com/saphelp_bw21c/helpdata/en/c4/3a7fae505211d189550000e829fbbd/content.htm
Reward points if useful
Regards,
Abhishek -
Schedule Background Job whenever new message WVINVE
Hi All,
I have following requirment:-
Schedule Background Job with a ABAP program,
whenever new message type WVINVE posted in SAP inbound.
I am confused in "Event" which i select in SM36.
Or, is there any other method to trigger a background report, whenever WVINVE03 IDOC posted in SAP system & create physical Inventory document.
regards
UmeshFor triggereing a background job, when ever a message type WVINVE is posted. You need to create a
Background Job with the the program and mark the Job Event periodic. Secondly you need to trigger that event from the Inbound processing program or Function module which processes the message type using the Function module <b>BP_EVENT_RAISE</b>. so when ever a message type is processed it will trigger the event which inturns trigger the Job.
Hope this will Help. -
How to schedule a job in SAP CPS
Hi,
I am new to SAP CPS.
So please tell how to schedule a job in SAP CPS. And which kind of job cam be schedule means BAP report.
Thanks
AnurodhHi,
In the installation and administration guide you'll probably find some examples.
The Job Definition you need is SAP_AbapRun to run any ABAP.
You submit this, specify the parameters as desired, and scheduling information, and that should do the trick.
That is assuming you have already connected CPS to an SAP system.
Check the topics in the docs within the product and on SDN on:
- Connecting to an SAP system
- Submitting Jobs
- SAP_AbapRun
Regards,
Anton.
Maybe you are looking for
-
Error message on opening desktop
My handheld data are OK, but the desktop data under the same name won't open, and give an error number #8796. Therefore I cannot synch with the handheld overwriting the desktop. It seems that if I could change the name on the handheld I could make a
-
Creation of Inbound Deliveries through IDOC
Hello All, I have a scenario wherein through SPRO the configuration has been set to throw an error message in case a new delivery is getting created through VL31N and the total quantity of the inbound deliveries created till now(including the one get
-
i installed webkit-kpart-svn. is that enough for konqueror to use it? i didn't see any place to opt for webkit.
-
PSE 10 would not load with message to reinstall. My download install program would only show uninstall. I tried to uninstall, but kept gettting an error message. Revo unistaller also would not work. Followed recommendation to uninstall manually- d
-
ITunes store temp out of service...HELP!!!
I have been trying to get on to the iTunes store now for over 24 hours...my message says "*We could not complete your iTunes store request* : The iTunes store is temporarily out of service. try again later" Is anyone else having this problem!? I am g