cancel
Showing results for 
Search instead for 
Did you mean: 

MB_MIGO_BADI

former_member429272
Participant
0 Kudos

I have a requirement that I have to check the P.O Document Date With MIGO Posting Date. If the user is doing the MIGO with goods receipt along with PO number in MIGO then user needs to enter posting date after that then it has to check with P.O document date. If the posting date in MIGO Is = And > than P.O Document It Is Ok Else It has to throw an error. Is there any BADI

I am getting PO details from LINE MODIFY and posting date from STATUS_AND_HEADER

method

How can i do the same ???

Accepted Solutions (1)

Accepted Solutions (1)

former_member256557
Active Participant
0 Kudos

Hi Ravi,

SAP has provided this function in order to allow back postings of stock but if you want to put a validation for this then you can use BADI: MB_MIGO_BADI~POST_DOCUMENT to fulfill your requirement.

Answers (3)

Answers (3)

former_member429272
Participant
0 Kudos

Achieved by using below code

DATA : gwa_mseg TYPE mseg.
DATA : lt_bedat TYPE TABLE OF ekko,
lt_bedat1 TYPE TABLE OF ekko,
wa_bedat TYPE ekko,
wa_bedat1 TYPE ekko.
DATA : lv_msg TYPE char300,
lv_msg1 TYPE char300.

* break hhpl_abap.
*
SELECT ebeln bedat
FROM ekko
INTO CORRESPONDING FIELDS OF TABLE lt_bedat
FOR ALL ENTRIES IN it_mseg
WHERE ebeln = it_mseg-ebeln.

SORT : lt_bedat BY ebeln.

LOOP AT it_mseg INTO gwa_mseg.

CLEAR : wa_bedat.
READ TABLE lt_bedat INTO wa_bedat WITH KEY ebeln = gwa_mseg-ebeln
BINARY SEARCH.
IF sy-subrc = 0.
IF is_mkpf-budat < wa_bedat-bedat.

CONCATENATE 'GRN Date Should be Greater than or Equal to PO Date for' gwa_mseg-ebeln
INTO lv_msg SEPARATED BY space.

MESSAGE : lv_msg TYPE 'E' DISPLAY LIKE 'A'.
ENDIF.

former_member429272
Participant
0 Kudos

Why should a receiver change a defaulted date to a date in the past which would be even earlier than the PO date? - user is currently doing this mainly this issue arises in month ends or year ends so our functional team recommended to put a lock

JL23
Active Contributor
0 Kudos

This is not an answer to "WHY" this is just an answer to a not asked quesion "WHEN"

Please have the situation clearly analyzed before wasting time in developments that harm the work of the wrong people

JL23
Active Contributor
0 Kudos

What problem do you want to solve with that coding? You are only forcing your users to use more workarounds.

Why should a receiver change a defaulted date to a date in the past which would be even earlier than the PO date?

Assumed answer in case he is not just evil and wants to harm your SAP implementation : Because he had really received the goods on that date but could not post the receipt because someone missed to create a PO in the system.

So you are actually forcing him to enter the receipt with a wrong date, while the error was with the purchase order.

Do you think that is the right approach to force people to enter wrong dates?