Problem in creating job via submit
sap 4.7
i am opening/scheduling job from other program/job
And from some reason i get two jobs with the same name.
One is working good, and the other one is stay in schedule.
My problem is , why i active two jobs and not only one ?
And why one (that I donu2019t want and need it at all ) is stay as "schedule" ?
this is my code
CONCATENATE EVT_ID JOBCOUNT INTO JOBNAME
SEPARATED BY SPACE.
LCL_TIME = SY-UZEIT + 1000 . " + 15 minute
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = JOBNAME
IMPORTING
JOBCOUNT = JOBCOUNT. " AND RETURN
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = JOBNAME
DELANFREP = SPACE
IMPORTING
JOBCOUNT = JOBCOUNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
if sy-subrc <> 0 .
MESSAGE I099 WITH 'cant craete job' .
endif.
SUBMIT YITF_MOVE_TO_BCKP
VIA JOB JOBNAME NUMBER JOBCOUNT
TO SAP-SPOOL IMMEDIATELY ' '
DESTINATION 'LOCL'
KEEP IN SPOOL 'X'
WITHOUT SPOOL DYNPRO
WITH EVT_PARM = EVT_PARM
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = JOBCOUNT
JOBNAME = JOBNAME
SDLSTRTDT = SY-DATUM "i_strtdt
SDLSTRTTM = LCL_TIME
STRTIMMED = 'X'
this is the status in sm37
YITF_MFHBHY_LOAD 03304501 LEGACY Scheduled
YITF_MFHBHY_LOAD 03304501 LEGACY Complete 04.03.2009 03:49:05
Hi use this Code to fix the issue...
DATA : v_jobhead LIKE tbtcjob.
DATA : v_jobcount LIKE tbtcjob-jobcount.
DATA : v_eventparm LIKE tbtcjob-eventparm.
DATA : v_flg_released TYPE c.
DATA: e_error.
DATA: running LIKE tbtcv-run.
TYPES: esp1_boolean LIKE boole-boole.
CONSTANTS: esp1_false TYPE esp1_boolean VALUE ' ',
esp1_true TYPE esp1_boolean VALUE 'X'.
CONSTANTS: true TYPE boolean VALUE esp1_true,
false TYPE boolean VALUE esp1_false.
PARAMETERS: v_jobnam LIKE tbtcjob-jobname,
v_report LIKE sy-repid,
v_varian LIKE raldb-variant,
v_uname LIKE sy-uname.
START-OF-SELECTION.
* add the new job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
* delanfrep = 'X'
jobname = v_jobnam
IMPORTING
jobcount = v_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc 0.
e_error = true.
ELSE.
CALL FUNCTION 'JOB_SUBMIT' " or you can use SUBMIT statement as well.
EXPORTING
authcknam = v_uname
jobcount = v_jobcount
jobname = v_jobnam
report = v_report
variant = v_varian
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg_set = 9
OTHERS = 10.
IF sy-subrc 0.
e_error = true.
ELSE.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
* EVENT_ID = IC_WWI_WORKPROCESS_EVENT
* EVENT_PARAM = V_EVENTPARM
* EVENT_PERIODIC = 'X'
jobcount = v_jobcount
jobname = v_jobnam
strtimmed = 'X'
IMPORTING
job_was_released = v_flg_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
OTHERS = 8.
IF sy-subrc 0.
e_error = true.
ELSE.
DO.
CALL FUNCTION 'SHOW_JOBSTATE'
EXPORTING
jobcount = v_jobcount
jobname = v_jobnam
* IMPORTING
* ABORTED =
* FINISHED =
* PRELIMINARY =
* READY =
* running =
* SCHEDULED =
EXCEPTIONS
jobcount_missing = 1
jobname_missing = 2
job_notex = 3
OTHERS = 4.
IF sy-subrc 0.
e_error = true.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF running = space.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDIF.
ENDIF.
Similar Messages
-
Create job via program with spool list recipient
It is quite easy to create a job via SM36 and specify a "spool list recipient" to send the resulting spool in attachment to a distribution list.
I haven't find the way to have this 'spool list recipient' when I create the job via program (JOB_OPEN or BP_JOB_CREATE ...)
May be a smart abapper could help me ...hi,
check this sample program which will help u.
*& Report ZRC_JOB_TEST *& *
REPORT ZRC_JOB_TEST .
data : jobcount like TBTCJOB-JOBCOUNT ,
JOB_WAS_RELEASED like BTCH0000-CHAR1 ,
SDLSTRTDT like TBTCJOB-SDLSTRTDT ,
SDLSTRTTM like TBTCJOB-SDLSTRTTM .
data : l_ebeln like ekko-ebeln ,
l_ebelp like ekpo-ebelp .
l_ebeln = '0071005915' .
l_ebelp = '00010' .
CALL FUNCTION 'JOB_OPEN'
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
JOBNAME = 'job1'
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
JOBCLASS =
IMPORTING
JOBCOUNT = JOBCOUNT
CHANGING
RET =
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.
ELSE .
submit ZFI_UPD_PO_DELIV_COMP_BDC
with ebeln = l_ebeln
with ebelp = l_ebelp
via job 'job1' number jobcount
and return .
if sy-subrc = 0 .
SDLSTRTDT = sy-datum .
SDLSTRTTM = sy-uzeit + 600 .
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
AT_OPMODE = ' '
AT_OPMODE_PERIODIC = ' '
CALENDAR_ID = ' '
EVENT_ID = ' '
EVENT_PARAM = ' '
EVENT_PERIODIC = ' '
JOBCOUNT = JOBCOUNT
JOBNAME = 'job1'
LASTSTRTDT = NO_DATE
LASTSTRTTM = NO_TIME
PRDDAYS = 0
PRDHOURS = 0
PRDMINS = 0
PRDMONTHS = 0
PRDWEEKS = 0
PREDJOB_CHECKSTAT = ' '
PRED_JOBCOUNT = ' '
PRED_JOBNAME = ' '
SDLSTRTDT = SDLSTRTDT
SDLSTRTTM = SDLSTRTTM
STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
STRTIMMED = 'X'
TARGETSYSTEM = ' '
START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
START_ON_WORKDAY_NR = 0
WORKDAY_COUNT_DIRECTION = 0
RECIPIENT_OBJ =
TARGETSERVER = ' '
DONT_RELEASE = ' '
TARGETGROUP = ' '
DIRECT_START =
IMPORTING
JOB_WAS_RELEASED = JOB_WAS_RELEASED
CHANGING
RET =
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.
endif .
ENDIF. -
Hey to all
I wanted to create a job that shrink my temp tablespace after one week. Due to huge data loading I get filled. When i create job through EM I could not understand where I put Alter tablespace temp shrink space command . For database home page click server click job link and create button under the command section where I put this command. Plz help I tried to this IN Pl/Sql but job fail
DECLARE
SQLSTMT VARCHAR2 (500);
Begin
SQLSTMT:= ALTER TABLESPACE temp SHRINK SPACE';
execute immediate (sqlstmt);
END;I would not waste my time on creating such jobs.
Main reason: they don't resolve anything. You shrink the tablespace and it will definitely start to grow again.
You are only fighting symptoms. Maybe you want to earn your living out of fighting symptoms, I don't.
Apart from the the syntax of execute immediate is
execute immediate <variable>|<hard coded literal>;
Before asking syntax questions please use the docs (in this case the PL/SQL reference manual) to verify your usage of a construct is syntactically correct.
Also this line
SQLSTMT:= ALTER TABLESPACE temp SHRINK SPACE';
is lacking a '
Sybrand Bakker
Senior Oracle DBA -
Problem with background job using SUBMIT under different user
Hi All,
I am submitting a background job under different user name. I am submitting this job by using JOB_OPEN , SUBMIT report and JOB_CLOSE. But submit statement is returning sy-subrc 8, becuase of this the job_close is failed. Can you please help me to solve this problem.
Thanks in advance.
TjguptaHi,
The user is having all authorizations. is there any difference with user types?
This user is having user type " as communication data".
Thanks,
Tjgupta -
Hello Experts,
I am using SUBMIT Program to execute a standard T-code (F.80).
SUBMIT sapf080 WITH SELECTION-TABLE rspar
AND RETURN.
When I execute the program in background and compare it with F.80 and execute it in background too, spool layout for both are different.
For F.80, It is more detailed with every info like doc number, company code and fiscal year with messages, but for my program only messages are displayed in the spool which is getting unconvinient as I don't know for which document number that message was generated.
Can you please suggest why am I getting 2 different spool layouts for the same program executed in 2 different ways.
Thanks,
Ankit KhannaHello,
Thanks for your replies.
I have added a list option along with SUBMIT statement to get similar spool layouts.
Below piece of code will solve the issue.
DATA list_tab TYPE TABLE OF abaplist.
SUBMIT sapf080 WITH SELECTION-TABLE rspar EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
CALL FUNCTION 'WRITE_LIST'
TABLES
listobject = list_tab.
ENDIF. -
Problem while scheduling job in apex
Hi All ,
I have problem while creating job in apex .Let me explain my problem clearly.I have created a page in
url: http://apex.oracle.com/pls/otn/
Workspace : PREETHI_WORKSPACE
User ID : [email protected]
Password : bowova1
Application :Parse and upload csv file -21007
Page No:1
Page Name :Parse csv file.
Main functionality of this page is to upload csv file into oracle table .First user will browse a file from local machine and upload it in upload region.After that,user enters a table name and clicks create table button which creates a table in DB and also shows the report for the same .Creating table is happening through "create table " process when user clicks "create table" button.Code is working fine .One more things here is, in csv file the second row should have data type mentioned .
My requirement is ,i have to schedule "htmldb_tools.parse_file" in create table process as a job .In this "create table process" we are calling htmldb_tools.parse_file(:P1_FILENAME,'P1_COLLECTION','P1_HEADINGS','P1_COLUMNS','P1_DDL',:P1_TABLENAME);
Problem Iam facing here is that the scope of item :p1_filename is getting lost when we pass it to procedure .I think problem is due to different apex and database session .
Tried a lot through various ways ..Not finding the solution.
Please help...Hi Marco,
I have tried with the setting what u have mentioned in htmldb_tools.parse_file procedure: wwv_flow_api.set_security_group_id(<workspace_id>);
But Job Getting fail and giving error ""ORA-01400: cannot insert NULL into (ORA-01400: cannot insert NULL into ("FLOWS_020200"."WWV_FLOW_COLLECTIONS$"."SESSION_ID")
ORA-06512: at "FLOWS_020200.WWV_FLOW_COLLECTION", line 319
ORA-06512: at "DIMPLE3_HD_DEV.HTMLDB_SID_50", line 196
ORA-06512: at line 2
Please help me out in this issue.
Regards
Dhan -
How to create batch job via a program
hi
i need to know how to create batch job via a program please suggest
aroraWow!
> Total Questions: 234 (138 unresolved)
...and now you ask this?
Please accept our apologies for not pointing out to you way-back-when already that there is a search functionality here at SDN and that the correct forum should be used to post questions to.
Please read "the rules" at the top of the forum page, and search first => ask questions later.
I take the liberty of closing your question for you.
Kind regards,
Julius -
Hi,
I like to create job using Scheduler Jobs > Create Job with Command Type Stored Procedure! But the problem is that I can't see (user sys) procedures on schema i wish to create job on! So i can't pick procedure from Search and Select: Procedure values!?
Is someone know what is the problem?
Thanks, KristjanOK. It is a "Package" and not a Procedure like you mentioned above.
So, you have to do a different thing from a normal stored procedure. What you need is to use a Command Type of PLSQL Block
Assuming the Package TEST_PACLAGE with PACKAGE BODY containing procedure TEST_PROC and is owned by user SYS.
Select SYS as the owner under General
Inside the PL/SQL box enter.
BEGIN
test_package.test_proc;
END;
This should work -
I have a problem when I create message via t-code notif_create.
when I create message via 'notif_create',I can't fill the blank 'Component'.How can I get the 'Component'?
Hi Liu,
the F4 option is available for the component blank and we can select from them generally.ALso check the following SAP Notes...which may prove useful..Note 813075 - DSWP: Create Support Desk message missing category field
Note 857793 - Determine system context for messages
Note 853597 - Sorted display of F4 helps in NOTIF_CREATE
Hope it helps.
Br
Sri
Award points for helpful answers -
Hi,
I have problems when creating a job that is supposed to be run once in background. I use the common steps as described below. My problem is that the report is executed twice.
- First it is executed synchronously when the job is created
- Then it is executed in the normal job step as I want it to do
I don't want it to be executed the first time because it creates data!!!
Code:
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = w_jobid
IMPORTING
jobcount = w_jobnr
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit.
SUBMIT (p_prog)
WITH p_idocnr = p_idocno
USER p_user
VIA JOB w_jobid
NUMBER w_jobnr
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_jobnr
jobname = w_jobid
strtimmed = 'X'
IMPORTING
job_was_released = w_jobrel.
Does anyone have a clue of what I should do to prevent this?
// Regards HansHi again,
1. U are right.
2. It will happen if we use SUBMIT.
3. As per the help documentation,
it will run the program in separate session,
( as soon as submit statement comes)
4. and run the INITIALIZATION event.
The VIA JOB addition also loads the program accessed in a separate internal mode when the SUBMIT statement is executed and the system performs all the steps specified before START-OF-SELECTION. This means the events LOAD-OF-PROGRAM and INITIALIZATION are triggered and selection screen processing is performed. If the selection screen is not processed in the background when VIA SELECTION-SCREEN is specified, the user of the calling program can eidit it and schedule the program accessed in the background request using the function Place in Job. If the user cancels selection screen processing, the program is not scheduled in the background job. In both cases, execution of the program executed is completed after selection screen processing and the system returns to the calling program due to the AND RETURN statement.
regards,
amit m. -
Starting Infoset (Query) in background via submit
Hi all,
I'm facing a problem when executing an infoset (HR) via SUBMIT (report) EXPORTING LIST TO MEMORY AND RETURN. I this way I want to schedule several infosets in a job and capture the output which will be sent through mail.
Via FM. LIST_FROM_MEMORY and FM LIST_TO_ASCI I try to retrieve the selected data (of which I'm sure there is at least ONE record) in an internal table and convert it to ASCI. However, no matter what (for example no restriction on the select-options) the LISTOBJECT parameter from FM LIST_FROM_MEMORY returns me obviously not the correct data and after converting the list to ASCI, the TABLES parameter LISTASCI from FM LIST_TO_ASCI is empty or contains ##(?).
Any suggestion will be highly appreciated and if usefull rewarded appropiately
Regards,
Micky.Short update.
In the infoset the data is set to be displayed as SAP List viewer. However, it doesn't matter what is says, no data is returned. -
Run a job via job schedular, got the error message Connection to Agentlost"
Hi,
I have created a job with 60 scripts and trried to run a job via job schedular after executed some scripts i got error message as " Connection to Agent lost". what is the problem here. how to slove the probelm. please help me.
Thanks in Advance.
ra
Edited by: user4502901 on Nov 9, 2009 6:02 AMHi,
Try increasing your machines Virtual Memory and then run the scripts.
Thanks
Edited by: Openscript User 100 on Nov 10, 2009 9:31 PM -
Hide ui/pw when submitting job via FORMS HOST cmd
I have a oracle procedure that returns the run_command string. Ex . sqlplus ui/pwd @report.sql. The run_command string returned by the procedure is run via the HOST command in oracle Forms.
HOST(run_command) submits the job but it exposes the ui and pa that is used in the run_command string. On UNIX, if I do ps ef | grep sqlplus after the job is submitted by the HOST command, I can see the ui/pwd in the run_command.
How can I submit the job via HOST command without exposing the ui/pwd ?
Thanks
GPThanks for the reply.
The users have individual userid and passwords and I will have to pass it to the shell script that runs the report.
That will be exposed by ps -ef.
I can't create a single query only id because I have some reports that do inserts and updates.
Is there a way I can hide the userid and password that I am passing to the shell script.
Thanks. -
Hi Experts,
I am about to create a batch job. I used FM JOB_OPEN, JOB_SUBMIT and JOB_CLOSE. However, whenever I run the program it creates job for every 1 second. It will not stop creating jobs unless you completely exited in the program. The code is not inside the loop.mariposa,
Suppose you have 100000 records which is going for dump in background also.
Taht time decided to create a job for every 20000 records.
select * from database table
into itab
packaze size 20000
where x = s_x.
your functionality here if required and moved to final internal table.
Now you have to pass this final internal table data to your submit program selection screen.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
jobname = csm_std_reconciliation_job
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
IMPORTING
jobcount = jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID 'CSM' TYPE 'W' NUMBER '045' WITH csm_std_reconciliation_job.
EXIT.
ENDIF.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
ARCPARAMS =
authcknam = sy-uname
COMMANDNAME = ' '
OPERATINGSYSTEM = ' '
EXTPGM_NAME = ' '
EXTPGM_PARAM = ' '
EXTPGM_SET_TRACE_ON = ' '
EXTPGM_STDERR_IN_JOBLOG = 'X'
EXTPGM_STDOUT_IN_JOBLOG = 'X'
EXTPGM_SYSTEM = ' '
EXTPGM_RFCDEST = ' '
EXTPGM_WAIT_FOR_TERMINATION = 'X'
jobcount = jobcount
jobname = csm_std_reconciliation_job
LANGUAGE = SY-LANGU
PRIPARAMS = ' '
report = csm_std_reconciler
variant = csmvari
IMPORTING
STEP_NUMBER =
EXCEPTIONS
bad_priparams = 1
bad_xpgflags = 2
invalid_jobdata = 3
jobname_missing = 4
job_notex = 5
job_submit_failed = 6
lock_failed = 7
program_missing = 8
prog_abap_and_extpg_set = 9
OTHERS = 10
IF sy-subrc <> 0.
MESSAGE ID 'CSM' TYPE 'W' NUMBER '045' WITH csm_std_reconciliation_job.
EXIT.
ENDIF.
strttime = sy-uzeit + timepad.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = csm_std_reconciliation_job
sdlstrtdt = sy-datum
sdlstrttm = strttime
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
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID 'CSM' TYPE 'W' NUMBER '045'
WITH csm_std_reconciliation_job.
EXIT.
ELSE.
MESSAGE ID 'CSM' TYPE 'I' NUMBER '104' WITH
csm_std_reconciliation_job.
ENDIF.
endselect.
Now for every 20000 records it will create one batch job.
Pls. reward if useful. -
Submitting Oracle job via OCCI using dbms_job package
I am using 10g client to connect to a 9i Database on Redhat Linux AS 3.0.
I am trying to submit a job via OCCI. I get back a jobId, but don't see the job in the user_jobs table or the result of the job being executed.
I am using occi::Statement in the following way :
stmt = connection->createStatement("begin dbms_job.submit(:v1, 'submitJobTest;', sysdate,'sysdate+1'); end;");
// where submitJobTest is a stored procedure
stmt->registerOutParam(1, OCCIINT);
stmt->executeUpdate();
int jobId = stmt->getInt(1);
I get back a job id, but can't find it in the user_jobs. The first time I executed the program, i got back jobId 0, then 1 and so on..
Any ideas? Do I need to use dbms_scheduler package?
Thanks, NiloferGood catch!
Had a bug, in that my autocommit was not being set!
Works now.
Thanks,
Nilofer
Maybe you are looking for
-
There is no "transfer purchases" button when I try to do this! My only option is to erase and sync... How do I transfer the music from my iphone without erasing it??
-
Hi, An item with 'display as' is 'display only' will not be updated (via a process after submit). But it will be updated when it is displayed as 'text field'. How come? Regards, Robbert
-
This may be a very basic question...how do I find out what my firmware version my Airport Express currently has? I just bought my Express yesterday, and have it up and running (with a Linksys WRT54G wireless router); and have read on this forum about
-
Migarting from Approva to SAP GRC AC 5.3
Hello All, One of our client using Approva applications now they are planning to move to SAP GRC Access Controls 5.3, so kindly help me or guide he how I proceed. Key doubts u2013 1-How we upload rules in RAR, because we downloaded the rules from App
-
Hi, does anbody know a program that analyses an mdf file structure and locates invalid sectors? the DB is recovery pending due to invalid mdf header. thanks, David