Skip to Content
Technical Articles
Author's profile photo Raghavendran Venkatesan




Requirement: An automation requested from client for posting GR against purchase order of Delivery at PGI and delivery creation, picking for the sales order. The following is the flow chart of the requirement.

First, we must create an output type for our delivery in our case we can consider the output type as ZXXX.

In the processing routine of the output type medium should be “Special function”, give the program name and the form name.

Create a routine,  VOFM->Output control and assign it for V2 in sales and activate it.

we need to change the dispatch time of our output type ZXXX to “Send with periodically scheduled job” avoid lock object issue.

As this is an automation process we must create a periodical job which should execute at the time of triggering an event.

We need to create an event for this using the transaction SM62.

Create an RFC functional module which contains the FM to trigger the event, this RFC FM will be called in the routine at the time of PGI.

Once the PGI is done the output type ZXXX will be in ready to process state. The RFC FM triggers the event which in turn executes the BG job and the output is processed successfully.


The following are the required screen shots.

Logic in VOFM routine:

RFC FM which is called in the routine


Use Job wizard to create a BG Job.

Give the Job name

Select ABAP program step.

Give program name as RSNAT00 and saved variant name

Select After event option

Give Event name created in SM62 and check periodically option.

The periodically option is selected to trigger the Job whenever the event is triggered.

Complete the process.


Requested output is achieved.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Matthew Billingham
      Matthew Billingham

      In the blog editor there is a button like this {;} If you click on it, you can paste in ABAP code (use right click paste as plain text). The ABAP will then be nicely formatted and readable.

      Also note that your ABAP is not best practice, using as it does obsolete FORMs. Furthermore, you're only using STANDARD tables. Your program would perform better if you used HASHED tables and in your reads and loops, use appropriate keys.

      Author's profile photo Pradeep Mani
      Pradeep Mani

      Can this used for Individual Purchase order process?

      Author's profile photo Raghavendran Venkatesan
      Raghavendran Venkatesan
      Blog Post Author

      Dear Pradeep,

      from your high level question i can say it can be achieved. please let me know your requirement in detail for detailed explanation.




      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      As Matthew Billingham pointed out, the code is rather outdated and inefficient. Even FORMs aside, many things could be improved in it. (And SELECT statements with one field per line that go on for pages are my personal formatting pet peeve. Just why?)

      The design is not efficient in this case either IMHO. Using output with function assigned is the way to go and a great feature in SAP - you got that right. But why bring additional complexity with an event-based background job?

      You can check if the object is locked in the function itself. If the lock can’t be obtained within reasonable time you can update the output log with an error. In this design you’ll have no clue if a problem happens anywhere in the background job processing. And the event-based jobs are the worse since the event adds another potential point of failure.

      Thanks for sharing but next time please consider a simpler design and update the code to current standards (see this blog, for example).

      P.S. Please also don’t use all caps in the title, it is considered shouting online.