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

Call abap program within a program asynchronously

Former Member
0 Likes
2,933

Hello,

My requirement is to call a program B within a program A asyncronously so that the calling program A continues to run parallely with program B.

Thanks in advance,

Sanjota

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,879

You could also look at passing off the work via asynch RFC calls... see:

http://help.sap.com/saphelp_nw2004s/helpdata/en/22/0425c6488911d189490000e829fbbd/content.htm

for example.

Jonathan

11 REPLIES 11
Read only

former_member194669
Active Contributor
0 Likes
1,879

Hi,

Use SUBMIT statement


submit b.

Please check this

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/submit.htm

aRs

Read only

0 Likes
1,879

Hi aRs,

Thanks for the reply.

If I use submit program I cannot return back to my program until I give "SUBMIT....AND RETURN" and this statement will wait till the second program executes and then send the control back to the first program.

My requirement is to start the second program in the middle of the first program and still continue with the first program.

Read only

Former Member
0 Likes
1,880

You could also look at passing off the work via asynch RFC calls... see:

http://help.sap.com/saphelp_nw2004s/helpdata/en/22/0425c6488911d189490000e829fbbd/content.htm

for example.

Jonathan

Read only

0 Likes
1,879

Hi Jonathan,

Unfortunately my requirement is to have a custom program B because this program can also be exceuted independantly out of program A logic.

I will check how this can work and get back.Thanks for your reply.

Regards,

Sanjota

Read only

0 Likes
1,879

What is the second program "B" doing?... it may be possible to encapsulate its work in a function module so you can share the processing logic. If you are really interested in getting multiple parallel asynch processes working, have a read through the code for RUTBTPA0 (from around line 780+ ) as it describes how you might achieve this.

Jonathan

Read only

0 Likes
1,879

Hi Jonathan,

This a interface report to transfer data from UNIX server into R3 and then into BW.

Program A: This program will read the file,validate the data ,post the data into FI .

Program B : reads the file data,transforms the file to BW and sends it to BW.

My requirement is when program A successfully validates the file data ,program B should be started from program A to load the file to BW .I had to have two programs because of the time taken by individual process blocks(i.e one is R3 processing and other is BW processing) due to large volume of file data(I can have couple of millions of records in the file).Again program B can be run independantly from program as a part of a requirement.

I am looking at how I can schedule program B as a batch job from program A asynchronously.This will help me to have a log on program B in the spool.

I will go through the program suggested by you and get back .

Thanks for all your help.

Sanjota

Read only

0 Likes
1,879

Hi Sanjota,

One way to address the requirement would be to Start the program B from program A by creating a Job. This is very simple.

You can define Job using this FM 'JOB_OPEN'

http://help.sap.com/saphelp_nw70/helpdata/en/fa/096d67543b11d1898e0000e8322d00/frameset.htm

Then you can call the job with your requirements say Program B is report

http://help.sap.com/saphelp_nw70/helpdata/en/fa/096d67543b11d1898e0000e8322d00/frameset.htm

You can start the job with FM 'JOB_CLOSE'

http://help.sap.com/saphelp_nw70/helpdata/en/fa/096d67543b11d1898e0000e8322d00/frameset.htm

Its easy to do keep a log of program B as it is defined as a Job. You can display Job log using the FM 'BP_JOBLOG_SHOW'

http://help.sap.com/saphelp_nw70/helpdata/en/fa/096d67543b11d1898e0000e8322d00/frameset.htm

Hope this helps.

Read only

0 Likes
1,879

Hi Karthik,

Can I still continue with my program A after calling program B as a batch job ? I

Read only

0 Likes
1,879

Yes, the batch job will run quite separately - you will just have to make up some smarts to get the results of it back into calling program "A".

Jonathan

Read only

0 Likes
1,879

Hi Jonathan,

I don't want the results to be back in program A. I only want the program B to run separately and I guess this will resolve my problem.

I will implement this code and see how it goes and let you know.

Thanks for all your help.

Regards,

Sanjota

Read only

Former Member
0 Likes
1,879

Batch job concept worked.

Thanks Karthik and Jonathan.

Sanjota