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: 

How to submit a Program in Background without wait ?

Former Member
0 Kudos

hi experts,

I have one requirement in which i want to call another executable program from one program by passing some parameters to the calling program from called program. <b>I dont want to wait till the executatio of the calling program gets over.</b>i just want to submit the program & <b>wants to continue with my calling program</b>.

i am not bothered with the results of the called program.

How to do this...

if possible pl. send me the code. especially i am using some parameters & internal tables to be passed to the called program from calling program.

Regards,

Umesh

10 REPLIES 10

Former Member
0 Kudos

Hi,

This can be done by using SUBMIT.......RETURN stattement . By this ABAP statement you can execute the program from some other program .

Example:

SUBMIT z_report

USING SELECTION-SET ps_variant " variant name of the report

AND RETURN.

I think this solve ur problem ...... Award points!!!!.

0 Kudos

what i read from help is the RETURN will only send back the control to the Calling program. But Actually it will wait till the execution of Called program gets over.

Pl. correct me if i am wrong.

I dont want to wait till the execution of Called Program.....

pl. suggest.

Regards,

Umesh

Former Member
0 Kudos

for this use immediate option whixh is their in SM36

plz reward points if helps.

regards,

rahul

Former Member
0 Kudos

You will need to look at the syntax of the SUBMIT statement, particularly the option VIA JOB. This can be used to create a job running your program and immediately return to your calling program.

Regards,

Nick

Clemenss
Active Contributor
0 Kudos

Hi Umesh,

Nick Youngs answer looks best of all.

An alternative could be to put the functionality into a function. This function must be remote-enabled and called by your program using the addition STARTING NEW TASK.

I just put a sample program for parallel processing in the WIKI code gallery.

<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/Easilyimplementparallelprocessinginonlineandbatchprocessing">parallel processing</a>

Regards,

Clemens

Former Member
0 Kudos

Hi Umesh,

You can exectue the progrm directly by choosing option Execute in background in option Program at the top of ABAP Editor screen. After that it will ask the variant for which you want to execute the program . Give that and choose the option "Ececute immidiately". Now go to transaction SM36 and in job discription give your program name and check in job log and spool about the status of your program.

Please award points if useful !!!!!!!!

Tahnks & Regards,

Dipika

Former Member
0 Kudos

Hi Umesh,

This can be achieved using

SUBMIT ... VIA JOB job NUMBER n statement and return.

This statement just schedules a job in background and returns the control to the calling program and does not wait for the called program's execution.

whereas in

SUBMIT... ... and RETURN (i.e. Without VIA JOB)

control is returned to the calling program after the execution of the called program.

Regards,

Uma

0 Kudos

Hi Uma & all,

is it that i will have to create some job in SM36 & then schedule.

My requirement is everytime it will be a new job with some different parameter to be passed depending on some logic in calling program. I will have to do this programatically. No manual job submission.

Kindly tell me step by step how to do this. I am confused.

Regards,

Umesh

0 Kudos

Hi Umesh,

You can schedule a job programatically .. Please find below the steps..

This will schedule a background job (and this you can view in Sm37) and returns control to the calling program.

DATA: jobnumber TYPE tbtcjob-jobcount,

jobname TYPE tbtcjob-jobname.

  • Set the job name

jobname = 'xxx'.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = jobname

IMPORTING

jobcount = jobnumber

EXCEPTIONS

OTHERS = 0.

SUBMIT reportname USER sy-uname

VIA JOB jobname

NUMBER jobnumber

WITH param1 = "fill the parms/sel fields with new values

WITH Param2= "fill the parameters/sel fields

AND RETURN.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = jobnumber

jobname =jobname

strtimmed = 'X'

EXCEPTIONS

OTHERS = 0.

Thank You.

Regards,

Uma

Former Member
0 Kudos

Thanx a lot Uma...

you have understood my problem very well & suggested a soluation which i have used & my problem got solved.

i have awarded some points to you...

Thanx a lot....