Skip to Content
Author's profile photo Roberto Vacca

BAdI MB_MIGO_BADI – In the middle of nowhere


Brains hello!! I’m going to give you some advices on how to implement this so called MB_MIGO_BADI. This content would like to be only a start-point to go over different situations on MIGO transaction.

First of all we must say that  nothing comes from nothing and that all comes from changes. Most of informations here are collected from web-sites, forum and SAP.


  • How to implement BADI MB_MIGO_BADI
  • How to add Tabstrips
  • How to pass data through BADI
  • How to filter BADI


And here’s one other opportunity to loose yourself in a wood. No documentation and no references. Only perceptions and ideas.MB_MIGO_BADI it’s an other way to say: “Hey I want my “special present. I don’t want the same soup’ potatoes and beans”.This could be a solution when you need to add some Custom info on your goods receipt entry for certain type of orders/documents.

This is your situation when you launch MIGO withouth BADI implementation:

And This is your situation when you’ve implemented BADI MB_MIGO_BADI:

This solution will show how to save Batch Characteristic without a Batch on the MIGO’s item detail. For Header detail is quite the same logic.

  • How to implement

First of all create a Z*/Y* custom implementation of MB_BADI_MIGO.Transaction SE18 with MB_BADI_MIGO and go to => Implementation => Create:

Give a Z* custom name to your implementation.  MB_BADI_MIGO will need to create a custom enhancement point.

Now you have your BAdI implemented but you still need to activate Dynpros and flow logic code.

  • How to add Tabstrips

For this we need:

1 – A custom table to join MIGO data with Custom Data;

2 – A custom data type and structure to pass data through applications;

3 – Function group to generate custom function and custom dynpros to populate tabstrip, database table and check data.

In sequence:1 – Create a custom table like ZMIGO_BADI_CHARG (enhancement category Numeric or Char). and put these Key Fields:

          • MANDT                      key
          • MBLNR                      key
          • MJAHR                      key
          • ZEILE                         key
          • LOTTO_QI                  non-key data item detail

These are necessary  fields to link custom records to standard entry MIGO registration.After these fields you can put your custom data such Batch Characteristic in this example.

2 – Create a table type data element and a Line Type or Structure data element

      • ZTY_T_EXTDATA_CHARG Table Type (declare data type)


      • ZMIGO_BADI_CHARG_SCREEN_FIELD structure (send data TO/FROM custom dynpro)

3 – Create Custom Function Group to add custom function and Dynpro like this:

You need in this case 2 dynpro to be called in “Modification Action on items” and in “View Action on items”.Dynpro will have some logic to manage Search Help Field

Your fields in Dynpro will have your TABLE REFERENCE FIELDNAME such ZMIGO_BADI_CHARG-LOTTO_QI.These will be useful for passing data through methods/functions and dynpros.At this point you have created all stuff for ITEM DETAIL TABSTRIP.

  • How to pass data through BADI

To pass data through BADI you’ll have to define some Global Attributes in the Z class Linked to our BADI Implementation:

You’ll find explanation for Each attribute above in the Description Column.GF_CLASS_ID will be our Attribute to filter our Code only for Our Custom solution. We can put a name such “MIGO_BADI_CUSTOM1” to make the difference. We’ll see after the purpose.MB_MIGO_BADI is multy use BADI and can be implemented different times. We need to manage this particular attribute and pay attention each time a method is called in the BADI.G_LINE_ID will contain the current Item Line ID . This will be important for our validation functions and methods.G_NO_INPUT and G_CANCEL are useful for comunicate “Status” between PBO and PAI and methods. MIGO Action will be registered on method MODE_SET and we need to mantain memory of this.These methods will be inherited from interface IF_EX_MB_MIGO_BADI.

For details on each method implementation you can see example from SAP documentation and from  CIN_PLUG_IN_TO_MIGO implementation for INDIA (if available in your system package).The most important logic is feed G_NO_INPUT to tell PBO_DETAIL method How to set Dynpro (0001-> For modification or 0002 -> View).

In this section you finally activate your Tabstrip. You’ll  see it when you’ll launch MIGO.

  • How to filter BADI

To filter, you’ll find some advice on SAP forum but will tell you to read through SAP Memory. I suggest to use function modules Global Memory Area.

You need to focus on LINE_MODIFY method of our badi.

This method start each time an item is modified or added in MIGO’s entry.

At the start you’ll need to launch a custom  function that must be part of your Custom Function Group, passing CS_GOITEM structure.

Your GT_EXITEM will contain all items MODIFIED, NEW, etc.. This internal table should be declared on TOP Include Function Group.

Will be the reference for your checks. Each time you’ll need to filter data from PBO_DETAIL or other methods, you’ll need only to call a CUSTOM FUNCTION in the Function group and test this table.

Your custom check function could be something that take a LINE_ID and give out a Control flag, like this:

For example this function test a filter only for item with NO BATCH. If item has got a Batch linked then BADI will not show our Custom Tabstrip and logics will be bypassed.

I hope this guide puts some light on you and take out of the darkness (smile)


Related Content

Related Documents

Related SAP Notes/KBAs

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Eric Chen
      Eric Chen

      Hi Roberto

      Good application documentation of BAdI: MB_MIGO_BADI.

      Thanks for sharing!

      Keep posting.

      Author's profile photo Tony Wang
      Tony Wang

      the pictures are not visible, any chance to recover it? thanks!