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: 

MIGO Reset implementation

0 Kudos

Hi Friends,

I have implemented BADI MB_MIGO_BADI for MIGO.

in the POST_DOCUMENT method i am displaying some messages with application log. which is working fine.

problem is : when do MIGO for one purchase order it shows the message in application. and when with out leaving MIGO transaction if i do for another purchase order the application log shows messages as double(including the one for previous purchase orders).

i beleive we also need to implement RESET method, but i don't know what write in this method.

any inputs on this?

i am already clearing all internal tables related to application log.

Thanks

3 REPLIES 3

Former Member
0 Kudos

Hi

see the sample code of the BADI and do accordingly

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.

Regards

Anji

0 Kudos

Hi Anji,

Thanks for the reply.

but my problem is not how to implement BADI.

my problem was how to clear the buffered values in memory of MIGO transaction.

because if i am continuosly doing MIGO one after the other, all the messages are appending to application log.

and i don't want that.

thanks.

0 Kudos

Hi Anji,

don't worry. i have solved my problem.

after displaying the application log popup, i am deleting all the messages with

Function module BAL_LOG_MSG_DELETE_ALL.

Thanks.