Application Development 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: 

Badi not invoked in standard code because of act_imp_existing check

Former Member
0 Kudos
176

HI

Can you please tell me when act_imp_existing is set during cl_exithandler->get_instance method call. We are on 46C.

I have debugged and also checked the code of get_instance. act_imp_existing is not set at all. Now I have seen that wherever in SAP standard code BADI method is invoked based on whether act_imp_existing is not initial BADI is not called at all. Is it by design or I have not implemented BADI properly.

Consider this case.

1) MB_DOCUMENT_BADI (called from mb_post_document)

SAP code is

call method cl_exithandler=>get_instance

changing instance = mb_document_badi.

call method mb_document_badi->mb_document_update

exporting

xmkpf = zmkpf[]

xmseg = zmseg[]

xvm07m = zvm07m[].

Here since act_imp_existing is not being used call goes thru whereas

in

2) BADI me_define_caltype (called from me21n, me22n). SAP code is

if static_calctype_instance is initial.

call method cl_exithandler=>get_instance

importing

act_imp_existing = static_calctype_active

changing

instance = static_calctype_instance.

endif.

if not static_calctype_active is initial.

call method static_calctype_instance->define_calctype

exporting

im_x_nekko = p_im_nekko

im_x_oekko = p_im_oekko

im_x_nekpo = p_im_nekpo

im_x_oekpo = p_im_oekpo

im_x_nbekpo = p_im_nbekpo

im_x_obekpo = p_im_obekpo

changing

ch_x_lf_calctype = p_lf_calctype.

endif.

Here since static_calctype_active is not set badi won't be invoked. Please tell me how to invoke define_calctype which I need to manually do repricing during me21n/me22n.

Regards

Saurav Choudhury

9 REPLIES 9

christian_wohlfahrt
Active Contributor
0 Kudos
87

Hi Saurav!

There was apparently somewhere else already the same problem:

But I don't know, if it was solved. Maybe it's time to ask OSS about it.

Regards,

Christian

sergey_korolev
Active Contributor
0 Kudos
87

Hi

I can see in 4.6c the following code:

* act_imp_existing
  IF subrc = 2.
    act_imp_existing = seex_false.
  ELSE.
    act_imp_existing = seex_true.
  ENDIF.

It's at line 97 of GET_INSTANCE method.

0 Kudos
87

HI

Christian and Sergei

Thanks a lot for the reply. But may be there is some note which would apply the correction as per sergei. (But while searching thru oss I could not find any such note). Source code of our system is as follows.

method get_instance.

class cl_abap_typedescr definition load.

data: exit type ref to object,

temp type abap_abstypename,

int_ref type ref to cl_abap_refdescr,

type_ref type ref to cl_abap_typedescr,

interface type seoitfname,

exit_name type exit_def,

clskey type seoclskey,

mult type seex_boolean,

subrc like sy-subrc,

abs_type_classname type string.

  • The absolte type name of the changing parameter instance

  • is got via dynamic describe

call method cl_abap_typedescr=>describe_by_data

exporting

p_data = instance

receiving

p_descr_ref = type_ref.

if type_ref->type_kind ne type_ref->typekind_oref.

raise no_reference.

endif.

catch system-exceptions others = 1.

int_ref ?= type_ref.

endcatch.

if sy-subrc = 1.

raise no_reference.

endif.

call method int_ref->get_referenced_type

receiving

p_descr_ref = type_ref.

if type_ref->type_kind ne type_ref->typekind_intf or

type_ref->absolute_name ns '\INTERFACE='.

raise no_interface_reference.

endif.

  • Get the interface name by the absolute type name

split type_ref->absolute_name at '=' into temp interface.

  • Get the exit_name for the interface name

select exit_name from sxs_inter into exit_name

where inter_name = interface.

exit.

endselect.

if sy-subrc = 4.

raise data_incons_in_exit_managem.

endif.

  • Get the name of the exit class

call function 'SXV_GET_CLIF_BY_NAME'

exporting

name = exit_name

prefix = seex_exit_class_prefix

importing

clif = clskey-clsname.

concatenate '\CLASS=' clskey-clsname into abs_type_classname.

  • Is the given instance initial?

if not instance is initial.

call method cl_abap_typedescr=>describe_by_object_ref

exporting

p_object_ref = instance

receiving

p_descr_ref = type_ref.

check type_ref->absolute_name ne abs_type_classname.

endif.

  • check how many implementations exist for an exit

call function 'SXC_ACT_IMPS_PER_FLT_VAL'

exporting

exit_name = exit_name

exceptions

multiply_active = 1

no_active_implementation = 2

others = 3.

subrc = sy-subrc.

if subrc = 1.

  • there are more than one active implementations

  • read the properties of the exit

select single mltp_use from sxs_attr into mult

where exit_name = exit_name.

if sy-subrc = 4.

raise data_incons_in_exit_managem.

elseif mult = seex_false. " singular exit

raise single_exit_multiply_active.

endif.

endif.

  • ok, then do your job

create object exit type (abs_type_classname).

catch system-exceptions move_cast_error = 1.

instance ?= exit.

endcatch.

if sy-subrc = 1.

raise cast_error.

endif.

endmethod.

0 Kudos
87

Actually there are lots of notes concerning GET_INSTANCE method. For example, note 537844 refers to some hot packages, which you can install. Hope it would solve the problem. Last change date of the calss CL_EXITHANDLER of my system is March or April 2004.

Message was edited by: Sergei Korolev

0 Kudos
87

Dear Sergei

Thanks a lot for your precious time. However above note refers only to SAP_APPL 40 and 470. It does not talk about 46C. In the meanwhile let's see whether OSS gives any solution.

Regards

Saurav

0 Kudos
87

Hi Saurav!

Compare source code in 4.7 (620):


  call method cl_exithandler=>get_instance
      EXPORTING exit_name = 'MB_DOCUMENT_BADI'   "541292
                null_instance_accepted = x       "541292
      CHANGING  instance  =  mb_document_badi.
  IF NOT mb_document_badi is initial.            "541292
    call method  MB_DOCUMENT_BADI->MB_DOCUMENT_UPDATE
       exporting
            XMKPF = ZMKPF[]
            XMSEG = ZMSEG[]
            XVM07M = ZVM07M[].
  ENDIF.                                         "541292

Based on a performance improvement, exit_name can be given explicit - something which is missing in 4.6C.

I would like to know, if version of 4.6C is only slow - or sometimes buggy and can't find an existing implementation. OSS 541292 is of type performance, but in description cause is program error - somehow confusing.

Maybe OSS 537844 was implemented in your system - this would lead to this error (but it's not part of a support package).

Let's see, if your OSS question will bring some light into this.

Regards,

Christian

0 Kudos
87

HI

Christian

Thanks a lot for your response. The concerned note was not applied in my system. get_instance method in my system still has got only two parameters. Anyway I am still waiting for response from sap.

Thanks

Saurav

0 Kudos
87

Hi Saurav,

A quick q. Can you please tell me whether SAP has got back to you regarding this? I am facing the same problem.

Thanks a lot.

0 Kudos
87

hi...

I am also facing the same problem . plz help me ....

it shows the dump as :

Exception condition "DATA_INCONS_IN_EXIT_MANAGEM" raised.

Regards

Deepa.