Skip to Content
avatar image
Former Member

Migo Inside Migo

Hi All

I have a requirement where for movement type 351 in MIGO, i have to add additional check if the unrestricted stock is less than the stock to be posted, then I have to check the vendor consignment stock also to check if using vendor consignemnt stock we can complete the STO. If yes, then I have to post a MIGO for movement type 411K during actual posting of 351 at the backend to move stock from vendor consignment to unrestricted stock first so that for 351 movement, stock is available for posting.

Now, I am facing issue while trying to do MIGO inside MIGO. I tried using Post method of BADI MB_MIGO_BADI but it gave internal sap error. I tried to post it through wrapper program using submit and return, it gave error that material is already locked for valuation (for 351 I guess). If i add the posting logic in Check method for sy-ucomm POST, it works fine but then this might cause inconsistency if in further checks any error comes and 351 MIGO is not done.

Basically I need a point after checks has been completed successfully and Posting processing has to start.

Another problem is how to suppress the standard messages for stock which come as the stock is less in unrestricted available stock.

Can anyone has any ideas or solutions to meet this requirement?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 11, 2017 at 07:04 AM


    The Badi will only be referencing the current data so it would be a bapi that you wouild need. However, since you are trying to modify the material that you are already using that won't work as you found out as well.

    Then go one of 2 ways.

    Call a function module as a parallel task, checking the enqueue of the material you are migo'ing, sleeping for a while then checking again. When you get the lock carry out your additional postings,

    Or (the way I would prefer)

    In the badi method Post Document I would write the data required to perform the subsequent postings to a custom table.(ie a queue). Then have a batch program that runs every so often, reads the queue and processes the additional movements for all entries on the queue, removing each entry as it completes without error from the queue, or writing a status message to a message field in the queue, leaving the entry in place.

    This means that you can see where items have errored, why that have errored and they will be retried until the error condition is removed when they will be posted.

    You could also enhance that by allowing a user to add entries and remove entries from the queue using something like an ALV grid.


    Add comment
    10|10000 characters needed characters exceeded

  • May 11, 2017 at 11:46 AM
    Add comment
    10|10000 characters needed characters exceeded