Log_history of job
Hi all,
In my 10.2.1 database I have a job that runs every 5 sec .
To prevent the job log from growing indiscriminately, I created a job class with attribute log_history set to 2 days and assigned that job class to my job that runs every 5 sec.
According to administrator guide Once a day, the Scheduler automatically purges all log entries from the job log that are older than the specified history.
but when i see the job_logs purging is not occuring ,job_log still showing logs of more than 2 days.
if anyone can help?
Thanks
Hi, certainly.... thanks for your reply
First query:
SQL> column next_run_date format a35
SQL>
SQL> select run_count
2 , state
3 , failure_count
4 , next_run_date
5 from dba_scheduler_jobs
6 where job_name = 'PURGE_LOG';
RUN_COUNT STATE FAILURE_COUNT NEXT_RUN_DATE
1075 SCHEDULED 0 20-JAN-09 03.00.00.500000 AM -07:00Second query:
SQL> column operation format a15
SQL> column status format a15
SQL> column log_date format a35
SQL>
SQL> select *
2 from (select operation, status, log_date
3 from dba_scheduler_job_log
4 where job_name = 'PURGE_LOG'
5 order by log_date desc)
6 where rownum <= 10;
OPERATION STATUS LOG_DATE
RUN SUCCEEDED 19-JAN-09 06.00.39.225498 AM -04:00
RUN SUCCEEDED 18-JAN-09 06.00.43.597260 AM -04:00
SQL>
Note: you only see two job executions for the PURGE_LOG job above because I did a manual dbms_scheduler.purge_log myself on Sunday. Also noteworthy, I have since changed the log_history attribute of my job_class to 1 day (before it was 2 days, and I had to wait 2 days to see if the purge had worked). See below:
SQL> COLUMN JOB_NAME FORMAT A15
SQL> COLUMN JOB_CLASS_NAME FORMAT A20
SQL>
SQL> SELECT a.job_name, a.job_class, b.log_history
2 FROM dba_scheduler_jobs a
3 ,dba_scheduler_job_classes b
4 WHERE a.job_name = 'SESSION_END_JOB'
5 AND a.job_class = b.job_class_name;
JOB_NAME JOB_CLASS LOG_HISTORY
SESSION_END_JOB SESSION_END_JOB_CLASS 1
SQL>Thanks
PS -
Just want to clarify... my co-worker (the original poster) mistyped our version... it is:
SQL> select version from v$instance;
VERSION
10.1.0.4.0
SQL>Edited by: user10756614 on Jan 19, 2009 10:13 AM
Similar Messages
-
Use_current_session = FALSE does not run my job correctly
We have a custom scheduler that invokes jobs based on schedules/conditions. Until now, the jobs were all kicked off in the same session. Since the record set to be processed is increasing, we want the jobs submitted in parallel.
So the main job is split into several discrete jobs & run them in different sessions (dbms_scheduler.run_job with use_current_session = FALSE). The programs & jobs get created successfully.
The program has around 12 arguments defined.
The jobs run; however error out with "ORA-06502: PL/SQL: numeric or value error ORA-06502: PL/SQL: numeric or value error: character to number conversion error" *(DBA_SCHEDULER_JOB_RUN_DETAILS)*
If I run the jobs with this parameter = TRUE the jobs run successfully. Any pointers greatly appreciated.
Here are additional details..
DB: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
dba_scheduler_global_attribute
MAX_JOB_SLAVE_PROCESSES
LOG_HISTORY 30
DEFAULT_TIMEZONE US/Pacific
LAST_OBSERVED_EVENT
EVENT_EXPIRY_TIME
CURRENT_OPEN_WINDOW WEEKEND_WINDOW
v$parameter where name like '%process%'
processes 150
gcs_server_processes 0
db_writer_processes 1
log_archive_max_processes 2
job_queue_processes 20
aq_tm_processes 0
Thanks
Kiran.Hi,
This error seems clear,
character to number conversion error : at "XXA.XXX_ANP_ENGINE_MASTER_PKG", line 24
This is application code which the scheduler did run but the application code is throwing the error.
You will have to debug the issue occurring at line 24 of package "XXA.XXX_ANP_ENGINE_MASTER_PKG". You may be relying on something in your session which is not available in a background session - so the job fails when run in the background.
Hope this helps,
Ravi. -
Is it possible to execute a scheduled job to run on a specific node.
BEGIN
SYS.DBMS_SCHEDULER.CREATE_JOB_CLASS
job_class_name => 'TEST'
,resource_consumer_group => 'DEFAULT_CONSUMER_GROUP'
,service => 'ORCL'
,log_history => 30
,comments => NULL
END;
/ ORCL must exists:
SELECT NAME FROM DBA_SERVICES:
NAME
SYS$BACKGROUND
SYS$USERS
ORCLXDB
ORCL
BEGIN
SYS.DBMS_SCHEDULER.CREATE_JOB
job_name => 'SYS.TEST_JOB'
,start_date => TO_TIMESTAMP_TZ('sysdate','yyyy/mm/dd hh24:mi:ss.ff tzr')
,repeat_interval => NULL
,end_date => NULL
,job_class => 'TEST'
,job_type => 'PLSQL_BLOCK'
,job_action => 'begin null; end;'
,comments => NULL
/ -
I know this is possible, I'm not sure how to go about it using Oracle's Scheduler. I simply want to create a special "queue" that I can submit jobs to which will run one after another. After they run, then then are gone. There many be no jobs at anyone time, and then at other times I may submit 10 jobs to the queue. Currently when I submit jobs they all run parrallel, this is not what I want. I guess I don't understand why Oracle calls it a Job Queue when all my jobs run in parrallel and not in a queue as the name implies.
This is not say that I don't have other jobs which I would not want to send to this "queue". In other cases I would just want to submit the job and let it run right away and not wait on anything.
I'm currently using the DBMS_JOB package, which I'm pretty sure won't let me do what I want.
Any help would be greatly appreciated.
Thanks,
JoeHere is and example that creates Resource Manager objects and
two job classes that will permit 1 and 3 jobs to
run in parallel. Note this will work in 11R1 and 10.2.4
Assumes user user scott/tiger exists.
-- Remove existing scheduler objects, jobs and classes
CONNECT / as sysdba
BEGIN
DBMS_SCHEDULER.DROP_JOB_CLASS(
JOB_CLASS_NAME => 'JOBQ_WIDTH_1_CLASS'
END;
BEGIN
DBMS_SCHEDULER.DROP_JOB_CLASS(
JOB_CLASS_NAME => 'JOBQ_WIDTH_3_CLASS'
END;
BEGIN
FOR I IN 1..30 LOOP
BEGIN
SYS.DBMS_SCHEDULER.DROP_JOB(JOB_NAME => 'SCOTT.SERIAL_' || I, FORCE=>TRUE);
EXCEPTION WHEN OTHERS THEN NULL;
END;
END LOOP;
END;
BEGIN
FOR I IN 1..90 LOOP
BEGIN
SYS.DBMS_SCHEDULER.DROP_JOB(JOB_NAME => 'SCOTT.PAR3_' || I, FORCE=>TRUE);
EXCEPTION WHEN OTHERS THEN NULL;
END;
END LOOP;
END;
ALTER SYSTEM SET RESOURCE_MANAGER_PLAN='';
set echo on
-- Remove previously defined resource plan, resource plan
-- directives, and resource consumer groups for this test
BEGIN
-- Prepare the pending area
DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA;
DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA;
-- Delete resource plan, its resource plan directives, and
-- any associated resource groups
DBMS_RESOURCE_MANAGER.DELETE_PLAN_CASCADE(
plan => 'JOBQS_PLAN'
-- Submit the changes
DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA;
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA;
END;
-- Create resource manager objects
BEGIN
DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP (
CONSUMER_GROUP => 'JOBQ_WIDTH_1_GROUP',
COMMENT => 'Consumer group to force jobs to execute in serial'
DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP (
CONSUMER_GROUP => 'JOBQ_WIDTH_3_GROUP',
COMMENT => 'Consumer group to allow jobs to run in parallel 3'
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
BEGIN
DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.CREATE_PLAN
('JOBQS_PLAN', 'PLAN TO SUPPORT JOBQS');
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(
PLAN => 'JOBQS_PLAN',
GROUP_OR_SUBPLAN => 'JOBQ_WIDTH_1_GROUP',
COMMENT=>'Associates with job class JOBQ_WIDTH_1_CLASS',
CPU_P1 => 25,
PARALLEL_DEGREE_LIMIT_P1 => 1,
ACTIVE_SESS_POOL_P1 =>1
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(
PLAN => 'JOBQS_PLAN',
GROUP_OR_SUBPLAN => 'JOBQ_WIDTH_3_GROUP',
COMMENT=>'Associates with job class JOBQ_WIDTH_3_CLASS',
CPU_P1 => 75,
PARALLEL_DEGREE_LIMIT_P1 => 2,
ACTIVE_SESS_POOL_P1 =>3
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(
PLAN => 'JOBQS_PLAN',
GROUP_OR_SUBPLAN => 'OTHER_GROUPS',
CPU_P1 => 0,
CPU_P2 => 100,
COMMENT=>'Required'
DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
-- Create scheduler classes
BEGIN
DBMS_SCHEDULER.CREATE_JOB_CLASS(
JOB_CLASS_NAME => 'JOBQ_WIDTH_1_CLASS',
LOGGING_LEVEL => DBMS_SCHEDULER.LOGGING_FULL,
LOG_HISTORY => 5,
RESOURCE_CONSUMER_GROUP => 'JOBQ_WIDTH_1_GROUP',
COMMENTS => 'Force jobs to run in serial, through plan JOBQ_PLAN and group JOBQ_WIDTH_1_GROUP'
END;
BEGIN
DBMS_SCHEDULER.CREATE_JOB_CLASS(
JOB_CLASS_NAME => 'JOBQ_WIDTH_3_CLASS',
LOGGING_LEVEL => DBMS_SCHEDULER.LOGGING_FULL,
LOG_HISTORY => 5,
RESOURCE_CONSUMER_GROUP => 'JOBQ_WIDTH_3_GROUP',
COMMENTS => 'Allow up to 3 jobs in parallel, enforced by plan JOBQ_PLAN and group JOBQ_WIDTH_3_GROUP'
END;
connect / as sysdba
grant execute on jobq_width_1_class to scott;
grant execute on jobq_width_3_class to scott;
begin
dbms_resource_manager_privs.grant_switch_consumer_group('scott','JOBQ_WIDTH_1_GROUP',false);
dbms_resource_manager_privs.grant_switch_consumer_group('scott','JOBQ_WIDTH_3_GROUP',false);
end;
alter system set resource_manager_plan='';
connect scott/tiger
begin
for i in 1..30 loop
sys.dbms_scheduler.create_job(job_name => 'scott.serial_' || i,
job_type=>'plsql_block', job_action=>'dbms_lock.sleep(2);',
job_class=>'jobq_width_1_class',
enabled=>true);
end loop;
end;
begin
for i in 1..90 loop
sys.dbms_scheduler.create_job(job_name => 'scott.par3_' || i,
job_type=>'plsql_block', job_action=>'dbms_lock.sleep(2);',
job_class=>'jobq_width_3_class',
enabled=>true);
end loop;
end;
/-- The par3_90 job should finish about the same time as the serial_30 job since
-- we run 3 jobs in paralled and serial respectively.
-- check user_scheduler_job_run_details for after the test completed to verify. -
Add Email Job Notification via SQL Developer
Hello,
I'm a novice in the Oracle Scheduler space and I have what is likely a novice question. However, I'm thoroughly turned around after searching and would gladly welcome some help.
I'm using SQLdeveloper to utilize Oracle Scheduler within my schema.
A procedure has been successfully created. The job which executes the procedure is also successfully configured.
Next I'd like to configure email notification for certain events.
I've found a number of posts regarding the ADD_JOB_EMAIL_NOTIFICATION procedure.
I.e., http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_sched.htm#ARPLS72277
However, I'm having trouble identifying how to get started implementing this within SQL Developer.
Can someone please help with how the ADD_JOB_EMAIL_NOTIFICATION can be implemented within SQL developer?
Another point I want to mention: in a previous prototype, I found a wizard to configure the email notification. I'm not seeing that now. Is there a wizard with SQL Developer in which this information can be configured?
Extremely grateful for any help you can provide.
Thanks - FritzThank you for your response.
I'm entering that block into a SQL worksheet and it has now been accepted. I was mis-interpreting an error message which was thrown in my earlier attempts. Looks like the name of my job was problematic. I've renamed that and the add job email notification block is now being completed.
Thanks much for your help.
Also I've tried using the get_scheduler_attribute to see if an email server is already configured. However, I'm not using this correctly either. Only these attributes can be viewed through get scheduler attribute.
Scheduler Attribute
Description
default_timezone
Default time zone used by the Scheduler for repeat intervals and windows
log_history
Retention period in days for job and window logs
max_job_slave_processes
Maximum number of job slave processes that the Scheduler can start. May be NULL.
current_open_window
Name of the currently open window
event_expiry_time
Time in seconds before an event generated by the Scheduler and enqueued onto the Scheduler event queue expires. May be NULL.
Any suggestions of how to view which notifications are configured for a job?
Thanks again! Fritz -
Logging feature of the job scheduler
Anyone knows what kind of information will be logged when we set logging level to DBMS_SCHEDULER.LOGGING_FULL??
Example:
begin
dbms_scheduler.create_job_class(
job_class_name => 'OLTP_JOBS',
logging_level => DBMS_SCHEDULER.LOGGING_FULL,
log_history => 45,
resource_consumer_group => 'OLTP_GROUP',
comments => 'OLTP Related Jobs'
end;
We are trying to implment a logging mechanism here and see if we can borrow that feature.
ThanksThe setting LOGGING_FULL indicates that all activities on jobs in this classcreation, deletion, run, alteration, and so onwill be recorded in the logs. The logs can be seen from the view DBA_SCHEDULER_JOB_LOG.
-
Oracle 10g Scheduler, the Auto Task Job Class
When we are assign to a job to the auto task JOB Class on Oracle 10g scheduler, please advise what exactly we are asking Oracle to do?
From what I read from my text book, by assigning a job to a Job Class we can control the following..
Resource_Consumer_Group : Determine how much resources being allocate to the job
Logging_Level: Determine the detailing level of logging
Log_history: Determine how long the logged data should be retained
For auto task, what are the value on these paremeters set to?
Thanks,By default, jobs are assigned to DEFAULT_JOB_CLASS.
You can see attributes for the class from:
SELECT * FROM dba_scheduler_job_classes; -
Hi All,
I cant get to stop SharePoint foundation web app service. Its stuck on status stopping
I have tried the following:
reset IIS
restarted the Timer Service
When I try to use powershell command to stop I get the following error:
Can anyone who went through this help PLEASE
Stop-SPServiceInstance : An object of the type
Microsoft.SharePoint.Administration.SPServiceInstanceJobDefinition named
"job-service-instance-1ff39eb2-12d2-457d-a749-265e350eb1b1" already exists
under the parent Microsoft.SharePoint.Administration.SPTimerService named
"SPTimerV4". Rename your object or delete the existing object.
At line:1 char:127
+ ... pplication"} | Stop-SPServiceInstance
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share...ServiceInstance:
SPCmdletStopServiceInstance) [Stop-SPServiceInstance], SPDuplicateObjectEx
ception
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletStopServ
iceInstanceHi,
It seems that the issue is in the timer job definition for executing this operation.
My suggestion is to start the service again and delete the job definition from the error and again try to stop it.
This might be helpful:
http://sharepoint.stackexchange.com/questions/22368/is-there-a-powershell-cmdlet-to-delete-a-timer-job
I had a lot of issues in the past when try to stop this instance after the Web apps are provisioned.
As general rule now If I have multi-server Farm topology that has servers that should not serve Web App requests I turn off the service prior to provisioning any Web Apps in the Farm.
BR,
Ivan -
Report program when run in background job getting cancelled immediately
Hi
When i run a program in foreground i am able to see the output. But when run in background not able to run the job successfully. The job is getting cancelled immediately.
I am using the below function module for output display. Should i need to pass any parameters in the below function module so that i can run the program in background successfully.
CALL METHOD DETAIL_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = IS_LAYOUT
I_SAVE = 'A'
IS_VARIANT = GS_VARIANT
CHANGING
IT_FIELDCATALOG = IT_FIELDCATALOG
IT_OUTTAB = BLOCKED_STOCK_TAB_ALV[].
Please suggest.
Thanks and regards
Rajani YeluriHi Rajani.
ALV require the DRYPOR(screen) for display but incase you run in back ground which have to write to spool but in spool we can only write in format of LIST REPORT not inter-active report like ALV. That why
system cancelled your process immediately.
Hope it helps.
Sayan. -
Report Job was cancelled upon user request???
Hi,
My reports take more than 10 minutes to complete, most times I get
"Report Job was cancelled upon user request".
error, how to fix this problem? Is there any time limit inside the report I can set.
Thankshi ,
There is no limit on the report run time. The most probable reason why you are getting the 'Report cancelled upon user request' message is the users might have hit the "cancel Report" button which is displayed when it is running in 'SYNCHRONOUS MODE'. do not hit that button as it will terminate the report. to increase the speed of returning the results by the report, try improving the sql that you use in the report, or if you have DBA rights try adding in INDEXES on the columns of the tables used by the report.
Hope this helps
Manoj -
Hi ,
I have a requirement in which I have to create a report that should pickup all the cancelled CRM marketing jobs (due to whatever reason) based on on job name, copy them and restart them.
In your selection screen, you will give the cancelled job name (wildcard acceptable..like ZE00*) and a radio button to show the cancelled job list and copy the jobs.
Could anyone guide me on how to go ahead with this report?
Regards,
MohitHi,
in table TBTCO and TBTCP you have all jobs with current status. You can search them by name.
Selected jobs you can "popup_with_table" FM. Then you need to use fm to submit job in ackground;
'JOB_OPEN', 'JOB_SUBMIT' and 'JOB_CLOSE'.
Good luck ! -
I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?
What file format did you export it to?
-
How To Handle With Back Ground JOB From WEBUI When Click On "Appove"
Hi
How To Scheduled A Job Through ABAP Report In back end Of CRM when i click on "Approve" Button in WEBUI From result list.
As per My requirement I have a Search View and Result View
In Search View I have Below Fields
ITC Vendor ID
Claim Status
User status (date status changed)
Model
Serial Number
Date completed of Service Completion
Based on Search Criteria I will get Result In Result View.(Suppose 10 Records I got In Result View)
In the Result View I need to Add one Button As "Approve"
When i Click On Approve button One Pop up Message Need to Open And In that popup window I need to Display Below Text
"Approve Claim Job Has Started In Background
Note: Only Claims Which are in Submitted Status Will be Approved. you May Close This Window"
In SAP CRM System Back Ground Job Need To Start When Click On "Approve" Button In WEBUI .
In the Back Ground ABAP Report which will validate based on Result List Records"
In the Result List we may have all types of Claims which are status in "Submitted" "Pending" "Rejected" "Approve".
I need to collect all records from Result list and validate Those Records who's Status in "Submitted
1)Sort all the claims based on ITC Vendor ID.
2)Grouped all the submitted claims against each ITC Vendor ID from the search result
3)Change the status of the selected submitted claims to Approved.
4)Displays information messages as mentioned whenever a claim is approved, the same message will be captured in the job log.
‘Claims <ClaimID 1>,…<ClaimID N> now approved for ITC Vendor ID’.
5)Sending Email to each IRC.
6)Capture all the approved claims in the below format (Format Attached "Screen Shot Attachment")
7)Store the file in the Application Server AL11 in .csv format
Please Find Attachement For Reference.
1)ITC Claim Screen Shot
2)Screen Shot For Attachment
Thanks
RajHi,
You can add the following code in on approve method to show popup to the user,
IF req_edit IS NOT BOUND. " gloabl attribute in impl class of the view
REFRESH lt_buttons.
lss_button-id = 'btnyes'.
lss_button-text = 'YES'.
lss_button-on_click = 'YES'.
APPEND lss_button TO lt_buttons.
CLEAR lss_button.
lss_button-id = 'btnno'.
lss_button-text = 'NO'.
lss_button-on_click = 'NO'.
APPEND lss_button TO lt_buttons.
CLEAR lss_button.
CALL METHOD comp_controller->window_manager->create_popup_2_confirm
EXPORTING
iv_title = 'ATTENTION'
iv_text = 'Are you sure you want to edit this document?'
iv_btncombination = '99'
iv_custombuttons = lt_buttons
RECEIVING
rv_result = req_edit.
req_edit->set_on_close_event( iv_event_name = 'EDIT' iv_view = me ). "#EC NOTEXT
req_edit->open( ).
RETURN.
ELSE.
lr_node ?= req_edit->get_context_node( 'OUTPUTNODE' ).
lv_outbound = lr_node->get_event_name( ).
* CLEAR ptc_pricing_status.
* lv_outbound = req_edit->get_fired_outbound_plug( ).
IF lv_outbound = 'YES'.
you can use the submit report code here and you can al the validations here
ELSE. " No
if user clicks no nothing to do..
ENDIF.
CLEAR req_edit.
ENDIF.
Best Regards,
Dharmakasi. -
Schedule jobs witj job open, submit and close
Hi gurus,
I need to know if there is any way to schedule various jobs using the FM job_open job_submit and job_close. Like schedule the first job for a date and a hour and schedule others jobs to run after the first job sequential.
Its this possible?
Thk in advanceHi
see the sample code for the Job scheduling using the fun modules
IF p_bjob = 'X'.
CONCATENATE sy-cprog sy-datum sy-uzeit
INTO jobname SEPARATED BY '_'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING
out_archive_parameters = arc_params
out_parameters = print_params
valid = valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF valid = chk.
SUBMIT yREP WITH s_kunnr IN s_cust
AND RETURN
USER sy-uname
VIA JOB jobname
NUMBER jobcount
TO SAP-SPOOL
SPOOL PARAMETERS print_params
ARCHIVE PARAMETERS arc_params
WITHOUT SPOOL DYNPRO.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
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
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.
ELSE.
MESSAGE i029 WITH jobname.
ENDIF.
ELSE.
MESSAGE s000 WITH text-003.
STOP.
ENDIF.
ENDIF.
Regards
anji -
Problems creating background job for program (job open, submit and close)
Hi gurus,
im trying to start a background job using the FM BP_START_DATE_EDITOR to show the start date to the job or if it's imediate. this FM it's working fine, after call it im opening a job, submiting it and call the job close FM and the job close FM creates me the job.
The problem it's when i go to the sm37 to see the job status the job has been canceled, and the job log says that i have to give a start date to the job.
What i dont understand it's either the job is imediate or i choose a date to start the job always gives me this error...
Below goes my code,
any ideas will be rewarded
CLEAR: stdt_modify_type, stdt_output.
CALL FUNCTION 'BP_START_DATE_EDITOR'
EXPORTING
stdt_dialog = 'Y'
stdt_input = stdt_input
stdt_opcode = 14
IMPORTING
stdt_modify_type = stdt_modify_type
stdt_output = stdt_output
EXCEPTIONS
fcal_id_not_defined = 1
incomplete_last_startdate = 2
incomplete_startdate = 3
invalid_dialog_type = 4
invalid_eventid = 5
invalid_opcode = 6
invalid_opmode_name = 7
invalid_periodbehaviour = 8
invalid_predecessor_jobname = 9
last_startdate_in_the_past = 10
no_period_data_given = 11
no_startdate_given = 12
period_and_predjob_no_way = 13
period_too_small_for_limit = 14
predecessor_jobname_not_unique = 15
startdate_interval_too_large = 16
startdate_in_the_past = 17
startdate_is_a_holiday = 18
startdate_out_of_fcal_range = 19
stdt_before_holiday_in_past = 20
unknown_fcal_error_occured = 21
no_workday_nr_given = 22
invalid_workday_countdir = 23
invalid_workday_nr = 24
notbefore_stdt_missing = 25
workday_starttime_missing = 26
no_eventid_given = 27
OTHERS = 28.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
MOVE 'X' TO gv_flag.
ENDIF.
DATA jobname LIKE tbtcjob-jobname.
DATA jobcount LIKE tbtcjob-jobcount.
DATA job_release LIKE btch0000-char1.
DATA job_imediate TYPE c.
CLEAR: jobname, jobcount, job_release.
CONCATENATE 'MAPAEXEC' sy-uname sy-datum
INTO jobname SEPARATED BY space.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = jobname
IMPORTING
jobcount = jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i003(zmapas).
EXIT.
ENDIF.
SUBMIT z_mapa_execucao_orcamental
VIA JOB jobname NUMBER jobcount
WITH ano EQ ano
WITH so_perio IN so_perio
WITH so_date IN so_date
WITH so_org EQ so_org
WITH so_num IN so_num
AND RETURN.
IF stdt_output-startdttyp EQ 'I'.
CLEAR job_imediate.
job_imediate = 'X'.
ENDIF.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
calendar_id = stdt_output-calendarid
event_id = stdt_output-eventid
event_param = stdt_output-eventparm
event_periodic = stdt_output-periodic "?
jobcount = jobcount
jobname = jobname
laststrtdt = stdt_output-laststrtdt
laststrttm = stdt_output-laststrttm
prddays = stdt_output-prddays "??
prdhours = stdt_output-prdhours "?
prdmins = stdt_output-prdmins "??
prdmonths = stdt_output-prdmonths
prdweeks = stdt_output-prdweeks "?
predjob_checkstat = stdt_output-checkstat
pred_jobcount = stdt_output-predjobcnt
pred_jobname = stdt_output-predjob
sdlstrtdt = stdt_output-sdlstrtdt
sdlstrttm = stdt_output-sdlstrttm
strtimmed = job_imediate
targetsystem = stdt_output-instname
start_on_workday_not_before = stdt_output-notbefore
start_on_workday_nr = stdt_output-wdayno
workday_count_direction = stdt_output-wdaycdir
IMPORTING
job_was_released = job_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
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE i003(zmapas).
EXIT.
ELSE.
MESSAGE i004(zmapas) WITH jobname.
ENDIF.
Thanks in advance,
Best Regards
João MartinsHello João.
In debug mode, check the value of variables you passed to parameters sdlstrtdt and sdlstrttm.
As aditional info, I usually achieve your goal without FM BP_START_DATE_EDITOR.
Check this code:
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = w_jobname
IMPORTING
jobcount = w_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
CHECK sy-subrc = 0.
CLEAR seltab_wa.
MOVE: t_jobs-param TO seltab_wa-selname,
t_processar-line+34 TO seltab_wa-low.
APPEND seltab_wa TO seltab.
seltab_wa-selname = 'P_LOJA'.
seltab_wa-low = t_processar-ficheiro+7(4).
APPEND seltab_wa TO seltab.
*** Submete o programa para o JOB
SUBMIT (t_jobs-repid)
WITH SELECTION-TABLE seltab
USER sy-uname
VIA JOB w_jobname NUMBER w_jobcount
AND RETURN.
*** Encerra o JOB
l_hora = sy-uzeit.
ADD 60 TO l_hora.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_jobcount
jobname = w_jobname
sdlstrtdt = sy-datum
sdlstrttm = l_hora
targetserver = w_servidor
IMPORTING
job_was_released = l_liberado
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.
Regards.
Valter Oliveira.
Maybe you are looking for
-
Help Needed on Using IPC in ISA 4.0
Hi All I am working on ISA 4.0 and want to change the pricing shown on Product Detail page. I know only a bit about IPC at this moment. Our CRM is configured to look up to R/3 that is what my ABAP Team lead told me. In ISA it is Calling PriceCalculat
-
Inserting tabbed navigation code makes my web page not display in design view..
Hi everyone.. I am on Dreamweaver 8 for MAC, and was working on a couple of web pages..these pages included divs and tables. But when I tried inserting a tabbed navigation I found at: http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm In a nut
-
How can i tell if my prwrbk is ti or aluminum?
the box doesnt say and well....?
-
Migrating to new server: advice! :)
Hi! My current GroupWise 2012 SP2 server is a SuSE 10 SP4 and I need to migrate to a new server! I currently have 5% disk space left and have ordered additional drives, but while I'm going through the hassle and word is Windemere is not going to be s
-
SAP instance dies when I try to make a change to the role and save
Hello Friends I am an ABAP and XI guy, but am working on Enterprise Portal. I have created an IVIEW (URL) and am trying to associate it with a user and role. I have created user and then when I try to assign role by clicking on AssignROles and then