Show TOC Entering content frame

Object documentation Instance Generation Mode Locate the document in its SAP Library structure

Definition

This property controls the instantiation of the object plug-ins during execution of the statement GET BADI. The following are possible specifications:

·        Newly created instantiation

·        Reused instantiation

·        Context-dependent instantiation

Use

The first two specifications define context-free BAdIs. In the case of the newly created instantiation, new object plug-ins are created at each execution of the statement GET BADI. In the case of the reused instantiation, an object plug-in that was used once in the current internal mode is reused – if it is required more than once.

In the case of context-dependent instantiation, a context must be specified for GET BADI. This context controls the instantiation. Only one object plug-in is created for each context and implementing class. Each time there is another GET BADI with the same context, it is reused. A context is an instance of a class that implements the tag interface if_badi_context. The specification takes place in the form of a reference to such an instance.

Note

If object plug-ins are to get reusable data, only specifications 1 and 2 are allowed.

Example

The figures below show the situation for context-free BAdIs, after two statements following each other:

GET BADI bd1.

GET BADI bd2.

The upper rectangles represent the BAdI objects. The broken-line arrows show which object plug-ins are referenced by the BAdI objects, whereby the case of two suitable BAdI implementation classes cl_imp1 and cl_imp2 is demonstrated.

Figure 1 shows the newly created instantiation. Each time a BAdI object is created, new object plug-ins are created – first imp1 and imp2, then imp3 and imp4.

Figure 1

This graphic is explained in the accompanying text

Figure 2 shows the reused instantiation. For each BAdI implementation class, only one instance is created. All BAdI objects reference the same instance, irrespective of where (in internal mode) and how the BAdI object is called.

Figure 2

This graphic is explained in the accompanying text

 

 

Leaving content frame