Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

RFC in BAckGround

Former Member
0 Likes
533

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

2 REPLIES 2
Read only

Former Member
0 Likes
385

Hi,

Create a report to call the FM.

Execute that report in background.

Regards

Sourabh verma

Read only

Former Member
0 Likes
385

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