Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Getting context in BADI implementation

Former Member
0 Likes
2,785

Hi everobody,

I exeuting the tutorial as in

Im am now experimenting with the context-object:

* Dieses referenziert das Interface IF_BADI_CONTEXT
DATA: ctx TYPE REF TO IF_BADI_CONTEXT.
* Es wird ein konkretes Context-Objekt ctx über die Factory instanziiert
ctx = cl_badi_report_context=>get_instance( repid = sy-repid ).

break muellm.
TRY .
DATA: badi_definition_zmm_szrs0003  TYPE REF TO zmm_szrs0003.
     GET BADI badi_definition_zmm_szrs0003
       CONTEXT
         ctx.
   CATCH cx_badi_not_implemented.
     MESSAGE e499(sy) WITH 'Badi nicht implementiert.'.

ENDTRY.


Assuming I have more than one BADI-Implementation, how do I call the appropriate implementation.

Here in my example the context is the repid.


With other words:

Report Z_ABC should call implementation #1

Report Z_XYZ should call implementation #2

How can I achieve this?


Thanks, Regards Mario






1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,554
3 REPLIES 3
Read only

Former Member
0 Likes
1,555
Read only

0 Likes
1,554

HI Archer,

thx. But this is filters. I have context.

I wonder what the diffenrece is?

Regards Mario

Read only

0 Likes
1,554
  • Without the addition CONTEXT, hence for context-free BAdIs, the generation of the object plug-ins is based on the setting of the BAdI. Either new plug-ins are generated every time the statement GET BADI is executed, or an object plug-in that has already been generated in the current internal session is reused, if it is required again. An object plug-in of this type is a singleton in terms of its BAdI implementation class.

     
  • With the addition CONTEXT, and hence for context-dependent BAdIs, the same object plug-ins are always used for the same content of con. These object plug-ins are singletons in terms of their BAdI implementation class and a BAdI context object.

If a BAdI implementation class implements multiple BAdI interfaces and GET BADI is executed within one internal session for several of these BAdIs, then multiple BAdI objects can point to the same object plug-in. This enables the sharing of data between different BAdIs. For context-free BAdIs, this is only the case for reuse. For context-dependent BAdIs, several BAdI objects from the same context can point to the same object plug-ins.

So in your case, i think you need using Filters.

regards,

Archer