Skip to Content
0
Former Member
Feb 25, 2010 at 05:01 PM

BADI BADI_MATERIAL_REF giving problems in MM02 and MM03

409 Views

i just implemented BADI BADI_MATERIAL_REF

as we had requirement to auto populate mstav and mstdv in mm01 when user selected Finished good or trading good but it is

causing problem in MM02 AND MM03 as you cannot view materials undergoing this BADI as SAP keeps giving message 'Enter a material type'

method IF_EX_MATERIAL_REFERENCE~CREATE_MATERIAL.

 if SY-TCODE = 'MM01'.
  if I_mara-mtart = 'FG' or I_mara-mtart = 'TRAD'.

  E_MARAU-MSTAV = 11.
  E_MARAU-MSTDV = SY-DATUM.


ENDIF.
ENDIF.

endmethod.

I added SY-TCODE to ensure MM02 and MM03 were not calling this...

Before implementing BADI i had tried this user exit ZXMG0U02 but it only worked when saving in MM01 and would not populate the screen with MSTAV AND MSTDV fields.

if cmara-mtart = 'FG' or cmara-mtart = 'TRAD'.

  CMARA-MSTAV = 11.
  CMARA-MSTDV = SY-DATUM.



ENDIF.

looking in MARA TABLE field MTART is not populated for these materials undergoing badi. BY adding this line in BADI

E_MARAU-Mtart = I_mara-mtart

causes endless loop of entering UOM.

Edited by: Harry Parmar on Feb 25, 2010 6:02 PM

Edited by: Harry Parmar on Feb 25, 2010 6:03 PM