05-30-2007 11:02 AM
Hi Friends,
Whats are steps to be followed for executing the reports in the background.
Pls give the complete steps, from starting till printing the report.
TIA.
Regards,
Mark K
05-30-2007 11:04 AM
Hi
Do you want to execute this in background programmitaclly, if yes just look at the options of the SUBMIT command.
Else, instead of F8, use the F9 command and the report can be run in the background.
In order to restrict the user to run it only in background , you can as well check for SY-BATCH condition.
The other way is try to remove "execute in foreground" option from the menu and this can be done with the function module .
Do reward points if useful and close the thread if the doubt is cleared
data: begin of int_exc occurs 0,
code like sy-ucomm,
end of int_exc.
data wf_repid .
initialization.
clear int_exc.
int_exc-code = 'ONLI'.
append int_exc.
int_exc-code = 'PRIN'.
append int_exc.
move: sy-repid to wf_repid .
call function 'RS_SET_SELSCREEN_STATUS'
exporting
p_status = '%_00'
p_program = 'wf_repid'
tables
p_exclude = int_exc
.
Regards,
Sree
Message was edited by:
sree ram
05-30-2007 11:05 AM
1. Go to se38 initial screen.
2. Enter the progarm name
3. Go to program in the menubar -> Execute -> background
05-30-2007 11:05 AM
hi,
There are two ways for you to handle,
one manually setting up the job through SM36 which is better and convinient,
secondly through program using FM's JOB_OPEN, SUBMIT, JOB_CLOSE.
Find below steps in doing both:
Procedure 1:
1. Goto Trans -> SM36
2. Define a job with the program and variant if any
3. Click on start condition in application tool bar
4. In the pop-up window, click on Date/Time
5. Below you can see a check box "Periodic Job"
6. Next click on Period Values
7. Select "Other Period"
8. Now give '15' for Minutes
9. Save the job
In SM37 u can check the status of the jobs that u have assigned to background...
Here u mention the job name or the report name to check the status of the job...
After mentioning the job name or program name u just execute it.. ( without any name also u can execute then it gives u all the jobs set by your user name..
the status colud be released,active,finished etc..
Procedure 2 via Program:
Below is a sample code for the same. Note the ZTEMP2 is the program i am scheduling with 15mins frequency.
DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
L_RELEASE(1) TYPE c.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = 'ZTEMP2'
IMPORTING
JOBCOUNT = P_JOBCNT
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.
SUBMIT ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
WITH DESTINATION = 'HPMISPRT'
WITH IMMEDIATELY = SPACE
WITH KEEP_IN_SPOOL = 'X' AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = P_JOBCNT
JOBNAME = 'ZTEMP2'
STRTIMMED = 'X'
PRDMINS = 15
IMPORTING
JOB_WAS_RELEASED = L_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
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.
Hope the above helps you.
Thanks,
Reward If Helpful.
05-30-2007 11:07 AM
05-30-2007 11:08 AM
GO TO sm36, create a job there and in start conditions specify the date and time at which u want to run the report. go to steps and specify the report name and variant for the report. go to sm37. run this job. .........
reward if useful.
05-30-2007 11:08 AM
Hi
To create a Job Step, the FM 'JOB_OPEN' could be used.
To add a JOBSTEP, In your case an ABAP program, "SUBMIT" could be used.
To close the job step, use FM "JOB_CLOSE".
SAMPLE Code:
CALL FUNCTION 'JOB_OPEN'
EXPORTING
DELANFREP = ' '
JOBGROUP = ' '
jobname = 'XYZ'
sdlstrtdt = sy-datum "Current date
sdlstrttm = sy-uzeit
IMPORTING
jobcount = g_jobcount
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.
-
SUBMIT z_PROGRAM AND RETURN
USER sy-uname " User for runtime authorizations
WITH p_para EQ p_para
"..... Selection screen parameters
VIA JOB g_jobname NUMBER g_jobcount
" Job name and job number
" from JOB_OPEN
TO SAP-SPOOL " Print and archiving options from
" GET_PRINT_PARAMETERS
" Both sets of options come from
" GET_PRINT_PARAMETERS
SPOOL PARAMETERS g_s_user_print_params
ARCHIVE PARAMETERS g_s_user_arc_params
WITHOUT SPOOL DYNPRO.
-
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
AT_OPMODE = ' '
AT_OPMODE_PERIODIC = ' '
CALENDAR_ID = ' '
EVENT_ID = ' '
EVENT_PARAM = ' '
EVENT_PERIODIC = ' '
jobcount = g_jobcount
jobname = g_jobname
LASTSTRTDT = NO_DATE
LASTSTRTTM = NO_TIME
PRDDAYS = 0
PRDHOURS = 0
PRDMINS = 0
PRDMONTHS = 0
PRDWEEKS = 0
PREDJOB_CHECKSTAT = ' '
PRED_JOBCOUNT = ' '
PRED_JOBNAME = ' '
sdlstrtdt = g_datum
sdlstrttm = g_uzeit
STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
STRTIMMED = ' '
TARGETSYSTEM = ' '
START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
START_ON_WORKDAY_NR = 0
WORKDAY_COUNT_DIRECTION = 0
RECIPIENT_OBJ =
TARGETSERVER = ' '
IMPORTING
job_was_released = g_job_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
.
You can get the Print Parameters from FM: 'GET_PRINT_PARAMETERS'.
All the above FMs have detailed documentation which will help you.
Hope this helps you.
Reward All Helpfull Answers........