Show TOC

 FAQsLocate this document in the navigation structure

When do I use a context-dependent BAdI? When do I select instance reuse?

It makes sense to bind a BAdI to a context only if the same BAdI is called several times and has instance methods. The context guarantees that an already instantiated implementation class is reused provided that the same context is transferred. If the implementation uses local data, the data is kept.

  • If a BAdI interface contains only static methods and is used more than once in an internal session, for performance reasons, you have to use a non context-dependent BAdI with instance reuse.
  • If a BAdI is used only once in an internal session, again for performance reasons, you should always use a non context-dependent BAdI without instance reuse.
  • In all other cases, use a non context-dependent BAdI without instance reuse.

When do I use the fallback class in the BAdI definition and when do I create a default BAdI implementation?

A default implementation can have filter conditions and you can have many different default implementations with different filter conditions. If at compile time no non-default implementation for a given filter value is provided, the system selects the suitable default implementation. If there is no suitable default implementation, the system selects the fallback class.

Tip

A BAdI defines the filter language. You create one default implementation for German and one for English, and for all other languages you create a default fallback class.

Can I change a BAdI after the delivery and what are the consequences?

The new BAdIs which are part of the Enhancement Framework have upgrade support. If a BAdI definition is imported into a system in which there are implementations of this BAdI, the framework checks if the imported BAdI definition and the BAdI implementations are still compatible. If incompatibilities are detected, there is an adjustment tool that provides information about which implementations must be adjusted and supports the user in adjusting the relevant BAdI implementation.

Before a BAdI implementation is adjusted, the incompatibility between the BAdI implementation and the definition can cause syntax errors (for example, due to changes to a method interface). This is critical especially for central BAdIs. An error in a BAdI in the user management can, for example, make logons impossible.

In general, it makes sense to perform only compatible changes, such as:

  • Adding new optional parameters.
  • Changing a single-use BAdI to a multiple-use BAdI (without changing parameters).
  • Changing an SAP-internal BAdI to a non-SAP-internal BAdI.
  • Adding a screen or menu enhancement with the related default values.
  • Adding new methods as long as an empty implementation works.

Can I deliver a normal class from which the BAdI implementation classes can inherit? Can I implement several BAdIs in the same BAdI implementation class?

Yes, for the BAdIs of the enhancement concept, BAdI implementation classes can be treated like normal classes. They can inherit from other classes and implement several interfaces. It is also possible to inherit from any BAdI implementation class.

Is there a naming convention recommended by SAP for BAdIs in the Enhancement Framework?

We recommend that you use the BADI_ prefix for all BAdIs. In this way you avoid namespace conflicts with other global data types, classes, or interfaces. BAdIs must belong their own namespace so that in ABAP you can use REF TO to create a unique BAdI reference variable.