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

Function module in background work process

Former Member
0 Likes
9,497

Hi All,

i'm using trfc for processing FM only in background work process

CALL FUNCTION 'FUNCTION_MODULE' IN BACKGROUND TASK

but when i execute FM it's occupying two work process one is dialog (running current FM )and another one is background( running SAPLERFC) .

so pls suugest me how to avaiod FM to occupy dialog workprocess.

Regards,

Anuj jain

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
6,343

Thanks Amit and Suhas for your support ....

Now i'm sure that we can't process Any RFC directlly in background work process but can i process any FM (not RFC) in background work process ...like

calling FM inside RFC and call that FM in background work process.

Call RFC in diallog

function.

.

call function FM(nt RFC) in background

.

..

..

endfunction.

will it work????? .....

Regards,

Anuj jain

23 REPLIES 23
Read only

Former Member
0 Likes
6,343

Re open.....

Read only

RaymondGiuseppi
Active Contributor
0 Likes
6,343

Why do you use the I[N BACKGROUND TASK|http://help.sap.com/abapdocu_70/en/ABAPCALL_FUNCTION_BACKGROUND_TASK.htm] option (start after commit) and not a simpler [STARTING NEW TASK|http://help.sap.com/abapdocu_70/en/ABAPCALL_FUNCTION_STARTING.htm] task

Nevertheless, check via SM59 there are options on destination (default NONE) (in menu) to manage the RSARFCSE report (which contain the call to the FG you mentioned) (number of call, delay, etc.)

Regards,

Raymond

Read only

Former Member
0 Likes
6,343

Thanks Raymond for your reply,

I'm using IN BACKGROUND becoz i want to rum my FM only in background work process,which is not supported in STARTING NEW TASK.

Regards,

Anuj Jain

Read only

MariaJooRocha
Contributor
0 Likes
6,343

Hi,

Create a programa to call the FM and put it on a job, or execute the programa in background..

Regards,

Maria joão Rocha

Read only

Former Member
0 Likes
6,343

As says "Create a programa to call the FM and put it on a job, or execute the programa in background"

I can't use any program for process FM in BKG job....

Regards,

Anuj

Read only

0 Likes
6,343

Create a report program, call your FM in this report....and execute this report in the background (or through a scheduled job).

does it not work for you?

Read only

Former Member
0 Likes
6,343

Hi Priyank,

I have to Process FM remotely...so that RFC in background...in this case i cant use any report progam .

Regards,

Anuj

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
6,343

You cannot call an RFC in a BG work process.

RFC always executes via a Dialog work process. The addition IN BACKGROUND TASK doesn't facilitate the RFC to be executed in a BG process. Read the documentation thoroughly.

Anyways can you elaborate what's your requirement & why you want the RFC to be executed in BG mode ?

Read only

Former Member
0 Likes
6,343

Thanks suhas for your reply,

But as per below link we can process RFC in background job..

http://help.sap.com/saphelp_nw04/helpdata/EN/22/042585488911d189490000e829fbbd/frameset.htm

but my concern is other....as it's occupying both dialog and backgroud work process.

Regards,

Anuj

Read only

Former Member
0 Likes
6,343

Can any one elaborate on background processing in context of my requirement?

Regards,

Anuj jain

Read only

Former Member
0 Likes
6,343

Hi Anuj,

I tried the same scenario here, and below are my comments.

1. When we call the RFC FM in Background Task, then it will occupy DIALOG work process, and not background work process.

2. The second process which you are seeing, i.e. SAPLERFC, that is required by the server to start the RFC. however, this gets displayed only for some time (to start the background task), after that it disappears.

regards,

amit m.

Read only

Former Member
0 Likes
6,343

Thanks Amit for your findings...

But i want to ask what does background task means..

Either it means to start FM in a particular time in Dialog work process OR it means to start FM in a particular time in only BACKground work process.

Regards,

Anuj jain.

Read only

0 Likes
6,343

Hi Anuj,

It unfortunately means:

start FM in a particular time in Dialog work process

The BACKGROUND word in abap syntax is misleading.

For true background processing, i.e. background WORK PROCESS (of type BGD in SM50)

ONLY ABAP PROGRAMS or Commands or External Programs

can be run under background work process. (as per SM36)

Here we are trying a function module, which is not supported. This is as per my understanding.

regards,

amit m.

Edited by: Amit Mittal on Aug 17, 2010 2:03 PM

Edited by: Amit Mittal on Aug 17, 2010 2:05 PM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
6,343

RFCs always use dialog work process, that's the golden rule for RFCs

BACKGROUND TASK is kind of misnomer. This is used to implement the tRFC (transactional RFC) model. If you read the SAP documentation it's very well documented.

BR,

Suhas

Read only

Former Member
0 Likes
6,343

Hi All,

I'm going to closed this question as i can't find any solution to process my RFC(without report) in background work process (:

Anyway thanks to Amit n suhas for their valuble time.

Regards,

Anuj

Read only

Former Member
0 Likes
6,345

Thanks Amit and Suhas for your support ....

Now i'm sure that we can't process Any RFC directlly in background work process but can i process any FM (not RFC) in background work process ...like

calling FM inside RFC and call that FM in background work process.

Call RFC in diallog

function.

.

call function FM(nt RFC) in background

.

..

..

endfunction.

will it work????? .....

Regards,

Anuj jain

Read only

0 Likes
6,343

Hi again,

As per my understanding we cannot do that, even though the FM is normal and not RFC enabled.

Below are my comments.

1. FMs can be CALLED synchronously or asynchronously ONLY. There is no option of background work process. It will work only with dialog work process.

2. For background work process, we NECESSARILY have to use a SEPARATE Z PROGRAM, and inside that call the FM.

3. We can BACKGROUND a Z Program, not the FM.

Hope this helps.

Regards,

Amit Mittal.

Read only

0 Likes
6,343

Hi Anuj;

I got some infomation on the background processing of RFM.

From your calling statement, it belongs to transacational RFM calling.

Call Function rfm_name

in background task

...

you need to write a 'Commit work' after a serial of such calling which are in same LUW. And only after the statement, the LUM willl start its background processing in the target system. But note that, it does not allowed interactive dialog processing with target system and debugging..

Hope this help you..

regards

Vindy

Read only

Former Member
0 Likes
6,343

Hi Vindy,

"you need to write a 'Commit work' after a serial of such calling which are in same LUW. And only after the statement, the LUM willl start its background processing in the target system. But note that, it does not allowed interactive dialog processing with target system and debugging"

i'm already using commit work in my code...but RFM nt working in background

Regards,

Anuj jain

Read only

0 Likes
6,343

Hi Anuj;

But how can you know it's not running in background.

After the 'Commit work', that FM should work in background automatically same as that postfix meaning.

Were you able to debug that FM executed in foreground?

While in background the control should not be able to come inside that FM

in debugging either. Anyhow, you should not be able to debugging the processing logic of that FM..

Regards

Vindy

Read only

Former Member
0 Likes
6,343

Hi Vindy,

We can check whether the RFM is processing in background or dialog or any workprocess through SM50.

The thing is that CALL FUNCTION 'RFM' IN BACKGROUND is misleading everyone it doen't means that it'll work in BGD workprocess.

Regards,

Anuj

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
6,343

All you wanted to know about ABAP Connectivity techniques: [http://wiki.sdn.sap.com/wiki/display/ABAPConn/ABAPConnectivityHome]

Enjoy SAP !!

Suhas

Read only

Former Member
0 Likes
6,343

Thanks all.