Application Development 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: 

Scheduling Function Module in BG

Former Member
0 Kudos
212

Hi,

In one of my conditions I have to schedule a FM in Background, how can I do that, by adding 'IN BACKGROUND MODE AS SEPARATE UNIT' can we achieve this, if yes when will be it scheduled for a run ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
94

You can use the required FM in a program and then schedule the program for background run.

You cannot directly execute an FM in background...

CALL FUNCTION func STARTING NEW TASK taskname.

CALL FUNCTION

Variant 5 CALL FUNCTION func IN BACKGROUND TASK.

Additions:

1. ... AS SEPARATE UNIT

2. ... DESTINATION dest

3. ... EXPORTING p1 = f1 ... pn = fn

4. ... TABLES p1 = itab1 ... pn = itabn

Effect Flags the function module func to be run asynchronously. It is

not executed at once, but the data passed with EXPORTING or

TABLES is placed in a database table and the next COMMIT WORK

executes it in another work process.

Note This variant applies only as of Release 3.0, so both the

client system and the server system must be Release 3.0 or

higher.

Note qRFC with Outbound Queue

This is an extension of tRFC. The tRFC is serialized using

queues, ensuring that the sequence of LUWs required by teh

application is observed when the calls are sent.

For further information about qRFC, refer to the Serialized

RFC: qRFC With Outbound Queue section of the SAP Library.

Addition 1 ... AS SEPARATE UNIT

Effect Executes the function module in a separate LUW under a new

transaction ID.

Edited by: Tripat Pal Singh on Jun 15, 2009 10:11 AM

4 REPLIES 4

Former Member
0 Kudos
95

You can use the required FM in a program and then schedule the program for background run.

You cannot directly execute an FM in background...

CALL FUNCTION func STARTING NEW TASK taskname.

CALL FUNCTION

Variant 5 CALL FUNCTION func IN BACKGROUND TASK.

Additions:

1. ... AS SEPARATE UNIT

2. ... DESTINATION dest

3. ... EXPORTING p1 = f1 ... pn = fn

4. ... TABLES p1 = itab1 ... pn = itabn

Effect Flags the function module func to be run asynchronously. It is

not executed at once, but the data passed with EXPORTING or

TABLES is placed in a database table and the next COMMIT WORK

executes it in another work process.

Note This variant applies only as of Release 3.0, so both the

client system and the server system must be Release 3.0 or

higher.

Note qRFC with Outbound Queue

This is an extension of tRFC. The tRFC is serialized using

queues, ensuring that the sequence of LUWs required by teh

application is observed when the calls are sent.

For further information about qRFC, refer to the Serialized

RFC: qRFC With Outbound Queue section of the SAP Library.

Addition 1 ... AS SEPARATE UNIT

Effect Executes the function module in a separate LUW under a new

transaction ID.

Edited by: Tripat Pal Singh on Jun 15, 2009 10:11 AM

0 Kudos
94

Hi,

Thanks for the reply I am not sure if I could understand your post perfectly can you give a small example for this? coming to my import export parameters:I will get a document numbr which I wil pass to the FM and scedule a BG and my import parameters from the FM are none.

0 Kudos
94

What FM do u intend to use?

0 Kudos
94

It is a zfunction module developed by me.My doubt is in order to set a FM in BG what all the things I need to perform.ie if a set a FM in BG by givving

CALL fUNCTION ZXXXXXXX IN BACKGROUND MODE AS A SEPARATE UNIT will this be enough or do I have to do any thing more. Any inputs ?

Edited by: Varun on Jun 16, 2009 10:17 AM