Schedule Job with Abap
Hi Experts
Im executing jobs thru abap program, but now I need schedule this job. Does anybody know how can I do it? Can you show me the abap code or function module?
Thank you in advance!
Hi Ram,
I have a front-end screen where the end-user select date &time for schedule this job. Now Im using
FUNCTION 'JOB_SUBMIT',
EXPORTING
authcknam = sy-uname
jobcount = p_job
jobname = 'BUNDLE_EXECUTE'
report = 'UPC_BUNDLE_EXECUTE'
variant = l_seq.
but I dont know how send the date and time in order to schedule the job.
Does I need use other function?
Thank you!
Similar Messages
-
Schedule job with JOB_CLOSE until a certain time
Hello all,
I'd like to schedule a background job with JOB_CLOSE until a certain time, i.e. first start time at 10 a.m., repitition period 15 min., last start time 1 p.m.
I tried this using parameter LASTSTRTTM, e.g.:
i_startdate = sy-datum.
i_starttime = '100000'.
i_prdmins = '15'.
i_laststrtdt = sy-datum.
i_laststrttm = '130000'.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = 'MY_JOB'
sdlstrtdt = i_startdate
sdlstrttm = i_starttime
laststrtdt = i_laststrtdt
laststrttm = i_laststrttm
prdmins = i_prdmins
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
but I didn't succeed - the job didn't stop at 1 p.m. Any hints?
Best regards
Martin LehmannHi Martin,
i_startdate = sy-datum. " 1st time Job Start Date
i_starttime = '100000'.
i_prdmins = '15'.
i_laststrtdt = sy-datum. " If Job is not started by this date, then it wont be started once this date is completed
i_laststrttm = '130000'.
What it means is, if i want to start a job by 10th Oct.. & expect that it should be started maximum by 20th Oct.. If its 20th Oct & still the job is not started,... then terminate the job & do not start it..
If the job is already started, then it wont stop.
Hope its clear.
Best regards,
Prashant -
How to schedule job with spool list recipient in CPS ?
Dear Guru,
i import job with spool list recipient from r3 to cps and schedule in CPS, job is finished but there is no spool send to the recipient ?
Please advise ?
Best regards,
Supat Jupraphat.What job definition did you use? SAP_AbapRun? SAP_AbapRunPrint? SAP_AbapRunPrintExt?
Do you have XBP 2.0 or 3.0 in the SAP system? (check SE38 > INITXBP2)
Have you loaded the CPS transport files in the SAP system?
Note that using spoollist recipients either involves SAP_AbapRunPrintExt in combination with XBP3.0
OR
It involves SAP_AbapRun or SAP_AbapRunPrint and XBP 2.0 using transportation files in the SAP System.
Please check the section of the CPS admin guide called: "Enhanced SAP Interfaces with Redwood Transports"
Regards,
David -
Scheduling jobs with condition-after job programatically
Hi,
Could anybody please tell me how can we schedule jobs from programs(prgramatically) with condition-start after job(after a particular job completed) like we have the same option in sm36.
Thanks,
Rahul.Hello Rahul,
Check the following Link Page Number 41.
"Sample Program: Wait for Predecessor Job with
JOB_CLOSE"
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBLIB/BCDWBLIB.pdf
Regards,
Abhishek Jolly -
Schedule Job with Job_close after successful job doesn't work
Hi guys,
I'm using FM CLOSE_JOB with parameters :
JOBCOUNT = w_JobId
JOBNAME = w_JobName
PREDJOB_CHECKSTAT = 'X'
PRED_JOBCOUNT = w_oldJobId
PRED_JOBNAME = w_oldJobName
I have about 9 jobs wich must run the one after the others. The first start without PRED* parameters, but the 8 others one are filled with CHECKSTAT, and previous job name and id.
It works fine for the side "the one after the others", BUT, wathever the previous job give as result (cancelled or finished), the next one starts whereas I pass the parameter CHECKSTAT to X.
Any ideas of the problem and how to solve it?
Thanks in advance for your answers.Here my code with explanation :
REPORT YCOMJ023.
start-of-selection.
"Initialization of my vars
w_StepCount = 0. >> number of steps maxi in a job
w_jobCount = 1. >> number to see easier in SM37 the job order
CONCATENATE pe_name '_STEPS' w_jobCountC INTO w_JobName. (example : TOTO_STEP1)
CONDENSE w_JobName NO-GAPS.
"I open my first job
CALL FUNCTION 'JOB_OPEN' (OPEN job TOTO_STEP1)
EXPORTING
jobname = w_JobName
IMPORTING
jobcount = w_JobID
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
"We keep in memory first job IDs to close it at the end of the prg
w_firstjobName = w_JobName.
w_firstjobID = w_JobID.
"imagine you do the bellow code in a loop and it makes several jobs TOTO_STEP2 TOTO_STEP3 TOTO_STEP4...
ADD 1 TO w_StepCount.
IF w_StepCount GT 250.
"I call close job eatch time I reach 250 steps
PERFORM fx_jobclose.
ENDIF.
submit RKGALKEUB to sap-spool and return
without spool dynpro
spool parameters print_parameters
VIA JOB w_JobName NUMBER w_JobID
"End of the programmI close the current Job and the first one :
"Current
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = w_JobId
JOBNAME = w_JobName
PREDJOB_CHECKSTAT = 'X'
PRED_JOBCOUNT = w_oldJobId
PRED_JOBNAME = w_oldJobName.
"First one + launch with STRIMMED
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = w_firstjobId
JOBNAME = w_firstjobName
STRTIMMED = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
*& Form fx_jobclose
* text
FORM fx_jobclose.
"Step to zero to do a new loop after this form
w_StepCount = 0.
DATA : w_job_released TYPE CHAR1.
"If the flag IsFirst, we don't do nothing, because it's the first JOb, and it should not be closed
IF w_IsFirst = 'X'.
"Flag is set to blank
w_IsFirst = ''.
ELSE.
"Else it mean we are closing a job with predecessor :
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = w_JobId
JOBNAME = w_JobName
PREDJOB_CHECKSTAT = 'X'
PRED_JOBCOUNT = w_oldJobId
PRED_JOBNAME = w_oldJobName
"SDLSTRTDT = sy-datum
"SDLSTRTTM = sy-timlo
IMPORTING
JOB_WAS_RELEASED = w_job_released.
ENDIF.
"Vars get the value of current job, witch will become the older one
w_oldJobId = w_jobID.
w_oldJobName = w_JobName.
"I make the new TOTO_STEPX job name
ADD 1 TO w_jobCount.
w_jobCountC = w_jobCount.
CONCATENATE pe_name '_STEPS' w_jobCountC INTO w_JobName.
CONDENSE w_JobName NO-GAPS.
"I open the new job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = w_JobName
IMPORTING
jobcount = w_JobId
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
ENDFORM. "fx_jobclose
I hope my code is clear enought, I tried to delete the superfluities code. -
Schedule Jobs with multiple steps via ABAP Program
Hi,
I need to schedule multiple programs via background jobs on a daily basis. Since all these jobs are to be run as a single job, the various programs have to be run as steps in a major job.
I am however not very clear on how this can be done via an ABAP program ( the idea of a program is that various parameters to be passed to each program in the step can be entered dynamically rather than via variants).
I am using the JOB_OPEN and JOB_CLOSE functions and submitting the programs with selection screen parameters dynamically passed to create a job. I need to do this for various programs as a job step (WITHOUT Variants being defined).
Can anyone suggest any ideas for this? I have tried out JOB_SUBMIT Function but am not very confident I know what exactly it is for as it asks for a variant.
Thanks very much,
PreetHi Preet,
just to be sure: you know, that variants can be dynamical, too?
It's quite usual to assign dynamical current date, but it's also possible to add / subtract value and even define own functionality.
Maybe it's easier to implement a dynamical selection and handle static jobs.
If you try to plan a job (online or with JOB_SUBMIT), you have to use variants - you can create (or change) them dynamical in beforehand. Only SE38, F8, F9 is creating a temporary variant, so that no saved variant is necessary.
But if you end up creating variants dynamical, you can change one existing variant, too. Then you can use a static job definition (with periodical starting rule).
So: have a look, if dynamic variants are enough, otherwise change variants per job.
Regards,
Christian -
KM Scheduler job with MDM APIs
Hi,
I am trying to write a background job that makes use of MDM APIs. I created a Portal Application Project and put in the required code. I added the required MDM jar fiels in to the java build path. How ever, I don't know how to add Library Reference with value "com.sap.mdm.tech.mdm4j" since this is not a Webdynpro project. Without this the KM Scheduler fails to run the job thowing an exception ''NoClassDefFoundError...".
Can any one tell me how do I go about?
Thanks,
SudheerTrying to post the question under different category
-
How to schedule job with a system user BTC_100
Hi,
Someone setup the background job user BTC_100 as a system user (not a dialog nor service user). I need to schedule a new job and want to have the createBy as BTC_100 instead of my own ID.
I got error (Please logon as a dialog user) when tried to logon as BTC_100.
Do people usually set up their background job ID as a system ID? How can I schedule a new job as BTC_100?
Many thanks in advance!
-SerineHi Prince,
Besides the step owner, I wanted to have the job owner to be BTC_100 as well. Otherwise when I run SM37 and search for job, I'll have to put my ID instead of keep it as BTC_100.
From SUIM, I see BTC_100 has been changed from dialog to SYSTEM so maybe I have to change it to dialog first, create the job and then change it back to SYSTEM?
thanks!
-Serine -
Schedule job with dependencies in another job
Hi All,
I Have a job in sm36 schedule but I want to create a new job and will be started after my first job,
for exemple : I have a job Test1 started in 30 and 30 minutes and I create a new job test2 that this job has to executable after the job test1, I can to do this but my slave job only executable one time, I need that this job stay continued always after job test1 and don't finish.
Thank for Help.
Regards,
Osvaldo Antonio dos SantosHi,
I am afraid your reqmt may not be possible.
You can very well run one job after another job by maintaining the After event parameters in SM36. However you cannot enable a job run for ever. Once there is no input meeting the selection criteria, teh job will finish.
Instead of thinking of enabling the job for ever, you can maintain the jobtest2 as after event of jobtest1.
After that you can create jobtest3 using the same variant of jobtest2 and schedule it to run once in 15 min or 30min or so.
Hope this helps you
Pls reward if it is of some help to you -
Get AM from POJO (to run as scheduled job) with ADFBC?
In JDev 10.1.3.2 I am trying to write a java class (app) that will be run by a CRON job. This app must get a handle to a view object, execute it's query and do something with the results (send emails)...
I am assuming I need an app module and need to get the view object from the app module, but cannot figure out just how to do this. I tried:
MyAppModImpl am = new MyAppModImpl();
ViewObject vo = am.findViewObject("MyViewObject");
but the vo is null.
Am I going about this in the wrong way?
Thanks,
GinniThanks Shay. I got it working, like this:
String amDef = "org.aero.kas.evc.expirations.ExpirationService";
String config = "ExpirationsServiceLocal";
ApplicationModule am =
Configuration.createRootApplicationModule(amDef, config);
//ExpirationsServiceImpl am = new ExpirationsServiceImpl();
ClearancesExpiringThisMonthImpl vo = (ClearancesExpiringThisMonthImpl)am.findViewObject("ClearancesExpiringThisMonth");
vo.executeQuery();
RowSet rowSet = vo.getRowSet();
I tested it and it's all good! Amazing!
Now, when I deloy this beast to OAS 10.1.2 on Unix, apparently I'll need to have an admin write a Cron job to make the app run on the first of each month. What info do I need to give them? I've never deployed an app yet... this will be our very first one.
Thanks! -
Scheduling Jobs with email notifications.
Hi,
Using the information which i got from internet i created procedure and also below job to run on server.
Procedure name : refresh_tapas_rs
BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'TAPAS_REFRESH',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN refresh_tapas_rs; END;',
start_date => '24-APR-13 11.40.00AM',
repeat_interval => NULL,
--'freq=hourly; byminute=0; bysecond=0;',
end_date => NULL,
enabled => TRUE,
comments => 'Job defined entirely by the CREATE JOB procedure.');
END;
It's working fine.
i wanted to add few more things into this.
1. this should run - every Sunday morning 10 AM.
2. once this is completed my manager should get email with status immediately.
please help me to add this functionality.995263 wrote:
Hi,
Using the information which i got from internet i created procedure and also below job to run on server.
Procedure name : refresh_tapas_rs
BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'TAPAS_REFRESH',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN refresh_tapas_rs; END;',
start_date => '24-APR-13 11.40.00AM',
repeat_interval => NULL,
--'freq=hourly; byminute=0; bysecond=0;',
end_date => NULL,
enabled => TRUE,
comments => 'Job defined entirely by the CREATE JOB procedure.');
END;
It's working fine.
i wanted to add few more things into this.
1. this should run - every Sunday morning 10 AM.
2. once this is completed my manager should get email with status immediately.
please help me to add this functionality.I believe below should help you:
BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'TAPAS_REFRESH',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN refresh_tapas_rs; END;',
start_date => '24-APR-13 11.40.00AM',
repeat_interval => 'freq=weekly; byday=sun; byhour=10; byminute=0; bysecond=0;',
end_date => NULL,
enabled => TRUE,
comments => 'Job defined entirely by the CREATE JOB procedure.');
send_email (relevant_parameters); --> You need to have this procedure, to Send mails, in your database. You can get many ready to use samples online.
END;
/ -
Problem with variable in scheduled job
I'm trying to get the following scheduled job to run:
switch(config)# scheduler job name backup_job
switch(config-job)# cli var name timestamp $(TIMESTAMP) ; copy running-config bootflash:/$(SWITCHNAME)-cfg.$(timestamp) ; copy bootflash:/$(SWITCHNAME)-cfg.$(timestamp) tftp://1.2.3.4/
switch(config-job)# exit
switch(config)# scheduler schedule name backup_timetable
switch(config-schedule)# job name backup_job
switch(config-schedule)# time daily 1:23
switch(config-schedule)# exit
switch(config)# exit
This job is taken directly from multiple Cisco MDS and Nexus documents. From what I can tell, the purpose of this job is to save the running configuration to a file on bootflash with date & time in the file name and then to copy the file from bootflash to tftp server.
I can create the job and schedule successfully:
switch(config)#show scheduler job name backup_job
Job Name: backup_job
cli var name timestamp $(TIMESTAMP)
copy running-config bootflash:/$(SWITCHNAME)-cfg.$(timestamp)
copy bootflash:/$(SWITCHNAME)-cfg.$(timestamp) tftp://1.2.3.4
==============================================================================
switch(config)#show scheduler schedule name backup_timetable
Schedule Name : backup_timetable
User Name : admin
Schedule Type : Run every day at 10 Hrs 48 Mins
Last Execution Time : Tue Mar 6 10:48:00 2012
Last Completion Time: Tue Mar 6 10:48:00 2012
Execution count : 1
Job Name Last Execution Status
backup_job Success (0)
==============================================================================
The scheduled job runs successfully but the files that are created have the variable $(TIMESTAMP) in the file name instead of the actual date and time e.g. switch-cfg.$(TIMESTAMP)
The logfile contains the following:
Schedule Name : backup_timetable User Name : admin
Completion time: Tue Mar 6 10:59:26 2012
--------------------------------- Job Output ---------------------------------
`cli var name timestamp $(TIMESTAMP)`
`copy running-config bootflash:/PEN-9509-2-cfg.$(TIMESTAMP) `
Copy complete, now saving to disk (please wait)...
`copy bootflash:/PEN-9509-2-cfg.$(TIMESTAMP) tftp://1.2.3.4 `
Trying to connect to tftp server......
Connection to server Established. Copying Started.....
It looks to me that the $(timestamp) variable is being created successfully and is being replaced with the $(TIMESTAMP) variable but this is not being replaced with the actual date and time.
The thing I don't get is that this looks to me that we're trying to nest variables and the same Cisco documents from which I get this configuration also state that nested variables are not allowed.
I have tried this on different hardware - MDS9500, MDS9100, Nexus 5000, Nexus 7000 and different software - SAN-OS 3.3, NX-OS 4.1, NX-OS 5.2 but cannot get it to work. I have also tried to put the commands in a script and run with the run-script command but it still does not work.
There is probably another method to achieve what this configuration is trying to achieve (and I would like to know if there is) but I want to know if this particular configuration will work.
Can anyone tell me if they have got this working or can see what I'm doing wrong or can try running this in a lab please?I managed to get this resolved with a bit of a workaround. If I put the copy commands in a script and pass the variable to the run-script command as part of the scheduled job then it works ok. Trying to create the variable within the script (or as a separate scheduled job command) still doesn’t work.
So, creating a script file (script) as follows:
copy running-config bootflash:/$(SWITCHNAME)-cfg.$(timestamp)
copy bootflash:/$(SWITCHNAME)-cfg.$(timestamp) tftp://1.2.3.4
and creating a scheduled job with the following command:
run-script bootflash:script timestamp=”$(TIMESTAMP)”
achieves the desired result. -
BI Publisher (Obiee 11g) Scheduled jobs start randomly after services restarting
Hi everybody,
I've a problem with scheduled jobs on BI Publisher that start randomly after server restarting.
For example if there's a job scheduled every day at 8.00 am it works fine until the server is not restarted but when I restart it next job running start at 9.28 am (it is an example because the real start time is very unpredictable).
In my case bi publisher is integrated with obiee 11g (11.1.1.6.2) and I've scheduled jobs with administrative user (weblogic). For this user I've set the Bi Publisher Preferences (report locale = Italiano-Italia, Report Time Zone = GMT +1:00) from obiee analytics user account preferencies.
Can anyone have this problem too and help me?
Thanks
AnnalisaThese are not helpful. The first link is to OBIEE 10g and the second is just an install guide. I am having the same issue with BI Publisher returning java.lang.NullPointerException in OBIEE 11g. Any help would be appreciated. Thanks,
Paul
Edited by: pneedleman on Nov 17, 2010 10:15 AM -
Migrate scheduler jobs between 2 databases
Hello,
I'm working on migrating a tablespace between 2 databases on different platforms.
I'm using DataPump for export/import, and I'm using the CONTENT=METADATA_ONLY parameter for the export/import of schema and tablespace.
The schema owner has some scheduler jobs on the source DB, and after the migration, the same jobs appear on the target machine, but the ones with arguments cannot be run - I saw a bug (#5239417) exists on MetaLink on this subject - cannot migrate scheduler jobs with arguments if the above export parameter is used.
Are there other ways to transfer the scheduler jobs between my 2 databases?
Thank you,
Adrian
Edited by: AdrianM on Apr 6, 2010 7:54 PMis it JOB and SCHEDULE, my guess is schedule
if it's job, then you can use dbms_job.user_export
if it's schedule, did you try to generate DDL script instead of running the actual import and then run that DDL on a side? http://www.dba-oracle.com/job_scheduling/export_scheduler.htm -
Schedule a Job with multiple steps via ABAP Program
Hi Friends,
I want to create a report(Ex: ZREP) that will run another program(Ex: ZPGM) in background. What I need to do is, when I execute the report ZREP it should run the ZPGM automatically in background. This background execution should happen through JOB with multiple steps.
Why i am mentioned steps is, i have 1000 records in ZTABLE and need to execute 100 records each in one step and need to proecess in ZPGM with selection parameters. So in my case my job should create with 10 steps and need to execute in sequential manner.
FYI, In the ZREP selection screen i need to enter the records count/ interval to derive the job steps.
Please guide how to go ahead? Thanks in advance for all the help.
Regards,
Raghu.Hi Raghu,
You can try the following pieces of code:
Loop at gt_table. "This table contains 100 records previously appended
w_jobname = c_job_emision "Job Name.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = w_jobname
IMPORTING
jobcount = w_jobacount
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.
* Perform or create T_SELTAB with parameters options
PERFORM Create_seltab_table.
*Call second program.
SUBMIT ZREP WITH SELECTION-TABLE t_seltab AND RETURN.
*Close Job.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_jobacount
jobname = w_jobname
strtimmed = c_x "Immediate Start
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDLOOP.
Hope this helps.
Regards
Ernesto
PS: Raymond Giuseppi was faster.
Edited by: Ernesto Caballero on Mar 10, 2010 1:57 PM
Maybe you are looking for
-
Hi, I have a variable in which some value will be there and that will change. I.e it cannot be fixed. For Ex g_var has 20 or 30 etc. I need to display my output starting that that value. How do I get his. I am sure I need to use field symbols.But am
-
New PB 15" Fans, SMS, Temps, Gfx and other related questions!!
Hi All, Apologies if this is a long one - I have a few points to raise. As a new 15" PB user I have spent the last week or so scouring these boards for information on my new baby. Much of it has been interesting, and I'd like to address a few of the
-
Web service based data Control lost it's operations
HELP!! I came back into a Jdeveloper project that had web services exposed as data controls and now the operations and their returns are missing in the Data Control Palette!! All I see is the Data Control name, NO operations under them. How do I get
-
Portal and IC Web client Transaction Launcher conflict
We have integrated IC Web Client within Enterprise Portal by creating iview that launches IC Web client in a new browser window Additionally, within IC Web client we have configured the Navigation Bar using the transaction launcher launch to various
-
One PC knocks out the Internet. Please help.
I need some help. I am utterly baffled by this problem. The basic problem is once my PC is connected to my router, none of the computers can access the internet. Here is my setup. I have a Belkin Router (no wireless) connected to cable broadband mode