Skip to Content
author's profile photo Former Member
Former Member

Triggering background jobs

What is the best solution to trigger background jobs within user exits?

Currently the method I am using is quite cumbersome.

1. Create user event in SM62

2. Create background job attached to this user event.

3. Within user exit call function module BP_EVENT_RAISE using user event.

The problem I have with this approach is that in the program I have to add a 15 - 20 sec delay to handle record locking. Lets say I am in a user exit in MM02, triggering this event without the delay can lead to no records been processed.

What are other ways of implementing this solution?

Can I do a SUBMIT report VIA JOB


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Aug 11, 2009 at 07:17 PM

    Try this way also.

    In the userexit update a custom table with document number + flag (pending for process)

    Create standalone program that to be scheduled like every 5 minutes (as you like ) search for this table and get all open documents (with flag eq space ) and process one by one.( Calling jobs)

    This will reduced number of repetative background jobs

    Say User A edit document 100 at 10.00 am and saves at 10.01 am and user B edit document 100 at 10.02 am and save it

    10.03 am ( so every save if you trigger a backgound job, unncessary create jobs for same document number 10 )

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      But if User A changes material master and then User B changes material master again for the same material, then background job should run twice.

      But I do like the custom table idea. I want the standalone program to be triggered on event though - when material master is changed. What are some ways of accomplishing that. I feel like the one I am using is unnecessarily too complicated

  • Posted on Aug 11, 2009 at 08:13 PM

    What's the purpose of the background job? What is it supposed to do?

    It might be better to utilize the change pointers, like the IDocs do. Or maybe you should use the IDocs to begin with...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 12, 2009 at 12:28 AM


    Try the set of function modules:


    Please check in SE37 with JOB_*.

    Before calling these function modules, we need to create Variant for that program. We have one FM to create Variant for the report which is going to be scheduled in background. Please check with createvariant*. I did not remember this one.

    Ex: I have 2 programs.

    Rep1 and Rep2.

    I want to schedule Rep2 from Rep1.

    Rep2 has few fields in Selection-screen.

    In Rep1:

    Step:1 create Variant by using FM

    Step2: call above FM in sequence.

    Thank you,

    Balaji Peethani.

    Add a comment
    10|10000 characters needed characters exceeded

    • Unfortunately I haven't worked with batches and am not sure what this entails. You might want to check with your SD consultant if there is a better way to do this. How often does the country of origin change, anyway? It seems to me that this should really be handled by a business process rather than a program.

      Otherwise it seems to me that a better option would be to use the change tracking tables CDHDR/CDPOS and run a separate program in a scheduled background job. The program would check which materials were changed and do the updates. This will resolve any possible locking and update termination issues and also prevent from changing the batches back and forth if a user made a mistake, for example, and corrected it immediately. Or if, like you said, one user made a change and then another one made a change.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.