‎2009 Nov 13 11:16 AM
I HAVE A PROBLEM WITH THE JOB, IN MY PROGRAM THAT THERE IS A LOOP CALLED SEVERAL TIMES A SUBMIT 'VIA JOB'. ALL WORK ON AN ACCOUNT AND TRANSITIONAL JOB FOR SOME THAT ARE HAPPENING IN THIS ACCOUNT TRANSIENT ERROR WHY ARE STUCK ON THAT BEFORE. THERE IS A WAY TO STARTING THE JOB AFTER THE CLOSURE OF THE PREVIOUS?
There any feature you say when the job is CLOSED?
CODE REPORT :
LOOP TAB.
...
..
..
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = va_job_name
IMPORTING
jobcount = va_job_count
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
submit del programma
SUBMIT sapf124
WITH bukrx IN so_bukrx
WITH gjahx IN so_gjahx
WITH docnr IN so_docnr
WITH so_zuonr IN so_zuon
WITH x_saknr = d_saknr
WITH konts IN so_konts
WITH xaugdt = d_xaugdt
WITH xtol = d_xtol
WITH x_testl = cb_test
WITH augdt = p_datum
VIA JOB va_job_name NUMBER va_job_count
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = va_job_count
jobname = va_job_name
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.
ENDLOOP TAB.
Edited by: francesco aiello on Nov 13, 2009 12:23 PM
‎2009 Nov 13 11:51 AM
Quick fix would be to check the status of previous Job within Loop after JOB_CLOSE using fm SHOW_JOBSTATE and wait until the previous job is completed.
However, I would have used events (with parameter) to start the job which will be triggered by previous job just before it ends the execution.
Problem here is you have sapstandard program in job which you can not modify to trigger a event, to overcome that you need to have another program which will can your sap standard program and once it is complete, trigger the event with correct parameter which will then start the next jon in queue. (this is just an idea, which I think should work)
‎2009 Nov 13 11:31 AM
‎2009 Nov 13 11:51 AM
Quick fix would be to check the status of previous Job within Loop after JOB_CLOSE using fm SHOW_JOBSTATE and wait until the previous job is completed.
However, I would have used events (with parameter) to start the job which will be triggered by previous job just before it ends the execution.
Problem here is you have sapstandard program in job which you can not modify to trigger a event, to overcome that you need to have another program which will can your sap standard program and once it is complete, trigger the event with correct parameter which will then start the next jon in queue. (this is just an idea, which I think should work)
‎2009 Nov 13 12:57 PM
thanks for the suggestion, I try first to find another solution before making a copy of the standard