2008 Mar 14 10:35 AM
HI All,
Can anyone help me to execute FM in Background with Example
Regards,
S.Janani
HI All,
Can anyone help me to execute FM in Background with Example
Regards,
S.Janani
2008 Mar 14 10:39 AM
Hi,
Create a report to call the FM.
Execute that report in background.
Regards
Sourabh verma
2008 Mar 14 10:42 AM
hi,
Hii
If your aim is to run a FM in background, the you can use the syntax:
CALL FUNCTION func IN BACKGROUND TASK.
Transactional RFC before release 7.0
1. CALL FUNCTION func IN BACKGROUND TASK
DESTINATION dest
parameter_list
AS SEPARATE UNIT.
Transactional RFC as of release 7.0
2. CALL FUNCTION func IN BACKGROUND UNIT
parameter_list.
otherwise
Create a report and call the function module.
The schedule that report in backgroud in SM37.
check this link
JOB_OPEN
JOB_SUBMIT
JOB_CLOSE
Check this sample code which I got from this forum and kindly reward points if it helps.
report zrich_0004 .
data: sdate type sy-datum,
stime type sy-uzeit,
l_valid,
ls_params like pri_params,
l_jobcount like tbtcjob-jobcount,
l_jobname like tbtcjob-jobname.
start-of-selection.
Get Print Parameters
call function 'GET_PRINT_PARAMETERS'
exporting
no_dialog = 'X'
importing
valid = l_valid
out_parameters = ls_params.
Open Job
l_jobname = 'ZRICH_0005'.
call function 'JOB_OPEN'
exporting
jobname = l_jobname
importing
jobcount = l_jobcount.
Submit report to job
submit zrich_0005
via job l_jobname
number l_jobcount
to sap-spool without spool dynpro
spool parameters ls_params
and return.
Kick job off 30 seconds from now.
sdate = sy-datum.
stime = sy-uzeit + 30.
Schedule and close job.
call function 'JOB_CLOSE'
exporting
jobcount = l_jobcount
jobname = l_jobname
sdlstrtdt = sdate
sdlstrttm = stime
strtimmed = 'X'
REWARD POINTS IF HELPFUL,
KUMAR