How to call ABAP code after releasing a Purchase Order?

1.6k Views Asked by At

I want to trigger an IDoc or Web-service after releasing a purchase order. What is the best way to do it? Via output determination (what would be the condition in this case?) or via a BADI or user exit?

Best Regards

2

There are 2 best solutions below

0
On BEST ANSWER

You can try M06E0005 user-exit. It is used to change release role determination during release workflow events and can be utilized to run custom code.

0
On

For this kind of requests, I would suggest to use SAP Business Workflow. In your case, the SAP standard will trigger the event Released of the business object BUS2012 (Purchase Order) in the Business Object Repository (BOR). With transaction SWETYPV, you can attach consumers to this event. The consumers will automatically be called (if workflow is active in your system, of course). A consumer may be a workflow, a function module or a method of an ABAP OO class.

Advantages, compared to other possible solutions:

  • The coupling itself is pure customizing, no need to add ABAP code to the purchase order processing.
  • The coupling is loose (via event), reducing dependencies.
  • The coupling can be activated and deactivated dynamically via workflow customizing.
  • There are monitoring tools to trace the triggered events and the execution of their event handlers (e.g. transaction SWEL).
  • SAP Business workflow is classical and well-tried technology.