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

Code after Job

0 Likes
1,147

Hi everybody, i have a program that executes a job using the FM JOb_open, the submit of a report and the fm JOB_CLOSE: i want that the following code, after the FM Job_close, is run after that the job is finished.

There is a Function Module that do this ?

Thank you

4 REPLIES 4
Read only

Sandra_Rossi
Active Contributor
1,096

You have three options.

  1. The simplest one is to place a second step in the job (the "submit of a report" you indicate being the first step), which calls a new program that you create with the code inside it.
  2. A more complex one is to have a second job, that you link to the first job, which calls a new program that you create with the code inside it.
  3. You do an "endless loop" (put a reasonable limit) until the first job ends, in each loop you read the contents of the table TBTCO which contains the job statuses, exit the loop if the first job has ended, or repeating again after waiting a few seconds to not read too much.

The question has been already asked and answered. You can find more information in the forum.

NB: I don't post it as an answer to not add noise to the forum, it's just a matter of searching, I just give you hints to find answers faster.

Read only

hrmanagerde
Active Participant
0 Likes
1,096

Hi Francesco, which code?

Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
0 Likes
1,096
sandra.rossi

You should convert your comment to an answer. It's really informative.

Read only

Sandra_Rossi
Active Contributor
1,096

3a9e4ce873a94034b33dc62b0ce600ee It's as informative as all existing informative answers concerning the same question. People who search would probably not find my asnwer.

Searching for below words, I get one answer in the topmost results about SHOW_JOBSTATE (which corresponds to TBTCO I mention).

code after job site:sap.com

Because the search words are not good enough to return efficient results at the top, if we adjust the search, "code end of job" or "wait end of job", there are many more answers, which mention all the possibilities above, even a detailed blog post. Okay, maybe not the adding of a second step in the job.

Okay, I admit maybe it's a good candidate for an answer. So, I have just decided that I will convert my comments into answers if they reach 5 likes or more 😄 - with a little work to do it for past ones (~50).