Entering content frameBackground documentation Multiple Use Business Add-Ins Locate the document in its SAP Library structure

You can differentiate between single and multiple use Business Add-Ins. Single use add-ins are based on procedures, whereas multiple use add-ins have characteristics similar to those of events. In the first case, the program waits for the enhancement to return something, usually a return code. Benefit calculation in HR is a good example of this type of enhancement. Here, different calculations can be performed according to whichever implementation is active. With multiple use add-ins, an event is processed in program flow that may be of interest for other components. These components can then use this event as a hook to hang their own additional actions on.

Note

Since the call sequence cannot be predicted, it does not make sense to allow return values for this second type.

Note

In addition to importing parameters, you can also use changing parameters for multiple use Business Add-Ins. Since for multiple implementation of BAdIs there is no sequence control, using changing parameters can cause problems: there is no guarantee that implementations do overwrite the results of previous implementations. Sequence control is technically impossible, since at the time of the definition the interface does not know which implementations there will be and which parameters will be changed by implementations.

Example:

You want your application to continue processing indexes with a different component after you have saved (in other words, the system should allow you to use an add-in after saving). Since this is a good callup point for numerous different functions, you want to create an enhancement at this juncture that can be used by multiple subscribers.

To create a multiple use Business Add-In, proceed as follows:

  1. Define an add-in and select the Multiple use checkbox from the Administration tab.
  2. Define an interface with method 'OBJECT_SAVED' and the import parameter 'OBJECTNAME'.

Calling your enhancement in the application program

program event.

data exit_obj type ref to if_ex_event.

call method cl_exithandler =>get_instance
     changing instance = exit.

form save_object using obj_name type c.

update …
call method exit_obj->object_saved
     exporting objectname = obj_name.
endform.

The number of subscribers that subsequently call the event and hang their own additional actions on it is of no importance to the application program calling the add-in. Active implementations are called in the adapter method.

 

 

Leaving content frame