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

BAdI implenetation-default code / OO

Former Member
0 Likes
1,075

We are upgrading to ERP 2005 with IS-CWM activated from 4.0B so my knowledge to OO is almost non-existing.

We have a BAdI : /CWM/DEFAULT_MIGO this BAdI has some default code. The code proposes a quantity and unit in the parallel unit in transaction MIGO. The name of the Class is /CWM/CL_EX_DEFAULT_MIGO and the interface /CWM/IF_EX_DEFAULT_MIGO with a method called DEFAULT_VALUE.

If I implement this BAdI the default code is no longer executed because the BAdI implementation refers to the interface /CWM/IF_EX_DEFAULT_MIGO and the DEFAULT_VALUE method. The code from my own method is executed instead.

My question : In some cases – until a valid batch is entered the <b>default</b> code from the method DEFAULT_VALUE should be execute. The quick solution would be to copy-and-paste the code to my own method. But is it possible to call the default method ? (why should I maintain the code if SAP does it for me)

6 REPLIES 6
Read only

Former Member
0 Likes
784

If I try to insert a call to the method by using "Pattern" in the editor I get this

  CALL METHOD me->/cwm/if_ex_default_migo~default_value
    EXPORTING
      is_goitem           = is_goitem
      is_old_goitem       = is_old_goitem
      i_touched_erfmg     = i_touched_erfmg
      i_touched_cwm_erfmg = i_touched_cwm_erfmg
      i_touched_erfme     = i_touched_erfme
      i_touched_cwm_erfme = i_touched_cwm_erfme
    IMPORTING
      E_/CWM/ERFME        = E_/CWM/ERFME
      E_ERFMG             = E_ERFMG
      E_ERFME             = E_ERFME
      E_/CWM/ERFMG        = E_/CWM/ERFMG
      .

But this call calles my own methode that I just implemented (=endless loop) not the default code of the BAdI

How do I call the default code of a BAdI after I implemented Method ??

Read only

0 Likes
784

I found out how to call the standrdcode:

  DATA: instance_def_obj TYPE REF TO /cwm/if_ex_default_migo.
  CREATE OBJECT instance_def_obj TYPE /cwm/cl_def_im_default_migo.

      CALL METHOD instance_def_obj->default_value
        EXPORTING
          is_goitem           = is_goitem
          is_old_goitem       = is_old_goitem
          i_touched_erfmg     = i_touched_erfmg
          i_touched_cwm_erfmg = i_touched_cwm_erfmg
          i_touched_erfme     = i_touched_erfme
          i_touched_cwm_erfme = i_touched_cwm_erfme
        IMPORTING
          e_/cwm/erfme        = e_/cwm/erfme
          e_erfmg             = e_erfmg
          e_erfme             = e_erfme
          e_/cwm/erfmg        = e_/cwm/erfmg.

This will call the standard code for the BAdI

Read only

Former Member
0 Likes
784

Hi,

Once you have implemented a BADI, the default code will not get executed.

If you wish to separate your custom code and the default code provided by SAP, you could use the Filter functionality and based on the value of the filter, you could set the implementation to be executed.

Regards,

HR

Read only

0 Likes
784

Hi Kim ,

Can u tell me the Business requirement ? So we can go thru that one.

as per my understanding of this issue.

If user entering valid batch no need to go thru the BADI code ?

so in that case put a logic like this.

<b>select single charg  from  mch1 into w_lips-charg
               where matnr eq w_lips-matnr
                 and charg eq w_lips-charg.
if sy-subrc ne 0.
put ur code over here ?
else.
endif.</b>

Regards

Prabhu

Read only

0 Likes
784

Hi Kim ,

Can u tell me the Business requirement ? So we can go thru that one.

as per my understanding of this issue.

If user entering valid batch no need to go thru the BADI code ?

so in that case put a logic like this.

<b>select single charg  from  mch1 into w_lips-charg
               where matnr eq w_lips-matnr
                 and charg eq w_lips-charg.
if sy-subrc ne 0.
put ur code over here ?
else.
endif.</b>

Regards

Prabhu

Read only

0 Likes
784

See abowe.

Yes the standard code for the BAdI has to be executed until a batch is entered. The my own implementation has to be executed.