2013 Jan 30 12:29 PM
Hi experts, I am submitting vf44 (SDRRAV01) program via selection screen inputs, my z program should run in both fore ground as well as background, even i have used sy-batch eq X but still i am unable to execute in background.
2013 Jan 30 12:37 PM
What is the exact problem. Do you want the program to automatically execute in background, I hope youd did not expect to much of a SY-BATCH = 'X' statement ? (Read some documentation like SUBMIT - job_options.)
Regards,
Raymond
2013 Jan 30 12:35 PM
2013 Jan 30 12:40 PM
hi hawkins,
this steps i need to skip when i submit (SDRRAV01).
In the selection screen :After filling the screen fields press F9.
A screen appears requesting U to print the Background Parameters
*Enter the output device(Eg HPLJ /SAP2 etc)
*In the spool options Uncheck Print immedietly,Uncheck delete after output,and new spool request.
Press enter.
Another screen appears with heading start time .U can press start immly ,then save
Now the Background job is scheduled for the given program .
2013 Jan 30 12:37 PM
What is the exact problem. Do you want the program to automatically execute in background, I hope youd did not expect to much of a SY-BATCH = 'X' statement ? (Read some documentation like SUBMIT - job_options.)
Regards,
Raymond
2013 Jan 30 12:43 PM
hi raymond,
here is the sample code of my requirement,
IF sy-batch = 'X'.
SUBMIT sdrrav01 VIA SELECTION-SCREEN
WITH sbukrs IN lt_bukrs
WITH sauart IN lt_auart
WITH paccgrad EQ gc_paccgrad
WITH ppostdat EQ sy-datum
WITH prlkz EQ gc_prlkz
WITH svbeln IN lt_vbeln
WITH ppoper_h EQ bkpf-monat
WITH pgjahr_h EQ bkpf-gjahr
AND RETURN.
ELSE.
* Run the program (ZOTC_R_VEHREVREC) in foreground
SUBMIT sdrrav01
VIA SELECTION-SCREEN
WITH sbukrs IN lt_bukrs
WITH sauart IN lt_auart
WITH paccgrad EQ gc_paccgrad
WITH ppostdat EQ sy-datum
WITH prlkz EQ gc_prlkz
WITH svbeln IN lt_vbeln
WITH ppoper_h EQ bkpf-monat
WITH pgjahr_h EQ bkpf-gjahr
AND RETURN.
2013 Jan 30 12:46 PM
hi raymond,
What i needed is when i submit i get selection screen in that i will be using execute button for fore ground and job button for background, so what should i write in the submit statement to make it in background
2013 Jan 30 1:25 PM
It looks like you are populating all the data in the selection screen from your program itself. What is the need of via selection screen? are you changing any values in the selection screen?
You can just use submit for forground and submit via job for background.
thanks.
2013 Jan 30 1:35 PM
can we submit program via background, if u dont mind can u please tell me the syntax for submitting in the background
2013 Jan 30 1:45 PM
First open a job using
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = lv_jobname
jobgroup = 'INVOICE' "select the appropriate job group.
IMPORTING
jobcount = gv_jobcount
then submit the program using
SUBMIT programname
VIA JOB lv_jobname
NUMBER gv_jobcount
WITH p_vkorg = p_sorg
...............
AND RETURN.
then close the job using
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobname = lv_jobname "JOBNAME'
jobcount = gv_jobcount
strtimmed = zif_sd_constants=>gc_true
EXCEPTIONS
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
closing the job will start the job immediately or at a specified time depending on the parameters selected in job_close
2013 Jan 30 2:00 PM
i have done this for single sales document its running fine for multiple sales document the job is not doing,
here is my code for job can you please tell me what mistake i have done
IF sy-batch = 'X'.
DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT sdrrav01
WITH sbukrs IN lt_bukrs
WITH sauart IN lt_auart
WITH paccgrad EQ gc_paccgrad
WITH ppostdat EQ sy-datum
WITH prlkz EQ gc_prlkz
WITH svbeln IN lt_vbeln
WITH ppoper_h EQ bkpf-monat
WITH pgjahr_h EQ bkpf-gjahr
TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = 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.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDIF.
2013 Jan 30 2:08 PM
Remove the VIA SELECTION-SCREEN and as I already written (click on the links) use the VIA JOB job NUMBER n. between JOB_OPEN and JOB_CLOSE, look at the sample provided by SAP using the link I provided above. Also use the FM GET_PRINT_PARAMETER to fill the print parameter.
In your last posted code, if you are already in background, then you create another background job ?
Regards,
Raymond
2013 Jan 30 2:57 PM
Thanks Raymond,
I am facing 1 more problem from the same program,
when i execute in the foreground i am getting selection screen with inputs but further executing i m not getting any output, after analysing i came to know there is problem with the multiple screen option for sales document, what is happening is when i open multiple screen of sales document to see the entries and scrolling upto last and closing its saying do you want to save the changes, if i save and execute i will get the output if i dont save i wont get the output.
I am struck with this problem please i need help.