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: 

CALL METHOD IF_EX_MB_MIGO_BADI~RESET.

Former Member
0 Kudos

Hi experts,

Can you explain the use of METHOD IF_EX_MB_MIGO_BADI~RESET.

I inserted it in my code but i don't see the effect,

I inserted it this way;

IF v_answer NE 1. "NO

CALL METHOD IF_EX_MB_MIGO_BADI~RESET.

MESSAGE e895(m7) WITH text-005. "Material Doc.

"has not been created

ELSE.

the error message is prompted, is there something needed after call method to make it work?

Thanks,

zry

2 REPLIES 2

Former Member
0 Kudos

i dont know where you have written the code ..i think the badi is MB_MIGO_BADI is for enhancing std tcode migo.. so if you want to enhance the migo then go to implementation and create your zimplementation and write code inside the method reset. ... and activate it..

regards

shiba dutta

Former Member
0 Kudos

Hi,

See the sample code of the BADI which I have written and do accordingly.

I hope this Badi also works fine for you because this is also related to MIGO.

BAdI Name: ZMB_CHECK_LINE_BADI (Implementation name) Checking of line items in MIGO

Definition Name: MB_CHECK_LINE_BADI

Interface Name : IF_EX_MB_CHECK_LINE_BADI

Implementing Class: ZCL_IM_MB_CHECK_LINE_BADI

Method : CHECK_LINE

************************************************************************

METHOD if_ex_mb_check_line_badi~check_line .

DATA : return TYPE STANDARD TABLE OF bapiret2 INITIAL SIZE 0 ,

poitem TYPE STANDARD TABLE OF bapimepoitem INITIAL SIZE 0,

poitemx TYPE STANDARD TABLE OF bapimepoitemx INITIAL SIZE 0,

i_ekbe TYPE STANDARD TABLE OF ekbe INITIAL SIZE 0.

DATA : xmkpf1 TYPE mkpf,

xmseg1 TYPE mseg,

w_ekbe TYPE ekbe,

w_ekbe1 TYPE ekbe,

w_ekpo TYPE ekpo,

poitem1 TYPE bapimepoitem,

gv_qty TYPE menge13,

poitemx1 TYPE bapimepoitemx.

IF is_mseg-bwart EQ '105'.

IF is_mseg-lfbnr NE space.

SELECT SINGLE * INTO w_ekbe1 FROM ekbe WHERE ebeln = is_mseg-ebeln AND

ebelp = is_mseg-ebelp AND

belnr = is_mseg-lfbnr AND

buzei = is_mseg-lfpos AND

gjahr = is_mseg-lfbja.

IF w_ekbe1-grund NE '0005'.

MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You can take only Accepted Quantity into the stock'

'.If you want to accept this stock,' 'obtain approval of Purchasing manager'.

ENDIF.

CLEAR w_ekbe1.

ENDIF.

SELECT * INTO TABLE i_ekbe FROM ekbe WHERE ebeln = is_mseg-ebeln AND

ebelp = is_mseg-ebelp AND

( bwart = '105' OR bwart = '106') .

LOOP AT i_ekbe INTO w_ekbe.

IF w_ekbe-bwart EQ '105'.

gv_qty = gv_qty + w_ekbe-menge.

ELSE.

gv_qty = gv_qty - w_ekbe-menge.

ENDIF.

ENDLOOP.

SELECT SINGLE * INTO w_ekpo FROM ekpo WHERE ebeln = is_mseg-ebeln AND

ebelp = is_mseg-ebelp.

gv_qty = w_ekpo-menge - gv_qty.

IF is_mseg-menge > gv_qty.

MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You have already reached the PO quantity' .

ENDIF.

ELSEIF is_mseg-bwart EQ '103' AND is_mseg-grund = '0005'.

SELECT * INTO TABLE i_ekbe FROM ekbe WHERE ebeln = is_mseg-ebeln AND

ebelp = is_mseg-ebelp AND

( bwart = '103' OR bwart = '104') AND

grund EQ '0005'.

LOOP AT i_ekbe INTO w_ekbe.

IF w_ekbe-bwart EQ '103' .

gv_qty = gv_qty + w_ekbe-wesbs.

ELSE.

gv_qty = gv_qty - w_ekbe-wesbs.

ENDIF.

ENDLOOP.

SELECT SINGLE * INTO w_ekpo FROM ekpo WHERE ebeln = is_mseg-ebeln AND

ebelp = is_mseg-ebelp.

gv_qty = w_ekpo-menge - gv_qty.

IF is_mseg-menge > gv_qty.

MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You cannot exceed the PO quantity' .

ENDIF.

CLEAR w_ekbe1.

ELSEIF is_mseg-bwart EQ '104'.

IF is_mseg-lfbnr NE space.

SELECT SINGLE * INTO w_ekbe1 FROM ekbe WHERE ebeln = is_mseg-ebeln AND

ebelp = is_mseg-ebelp AND

belnr = is_mseg-lfbnr AND

buzei = is_mseg-lfpos AND

gjahr = is_mseg-lfbja.

IF w_ekbe1-grund <> is_mseg-grund.

MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You can cancel this document only with'

'Reason code' w_ekbe1-grund.

ENDIF.

CLEAR w_ekbe1.

ENDIF.

ENDIF.

ENDMETHOD.

Reward if useful.

Regards,

Anji