Application Development and Automation 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: 
Read only

Populate Error Message using MB_MIGO_BADI

Former Member
0 Likes
7,745

Hi Friends,

My requirement is whenever the user does a goods receipt using transaction "MIGO" I need to check whether the item selected has an indicator "Delivery Completed" at the PO level and if this indicator is set for this PO item I need to throw an Error message and should not allow the user to create a GR against that item. I have implemented the BADI "MB_MIGO_BADI" for this purpose and I am using the method "POST_DOCUMENT" to check the PO item and throw an error message, bu the issue is afterI throw an error message and when the user tries to exit from the transaction MIGO using the exit button, the system throws an short dump " Screen: Illegal message" because the program attempted to issue a " " message during "Exit Command" processing. In order to avoid this i tried the method "CHECK_ITEM" to populate the error message to application log, it works fine but I am not able to get the line item details inside this method. I even tried to import the line item details from the method "LINE_MODIFY" and then use it in "CHECK_ITEM" method, but the issue here is CHECK_ITEM is called only once for all the line item, ""LINE_MODIFY" was called every time i change the line item, so I was not able to use it. Can you please let me know if there is any other better way to achieve this.

As per the below weblog, this scenario is available as part of the standard in ECC Ehp4, but unfortunately we are on Ehp1.

Hi Friends,

My requirement is whenever the user does a goods receipt using transaction "MIGO" I need to check whether the item selected has an indicator "Delivery Completed" at the PO level and if this indicator is set for this PO item I need to throw an Error message and should not allow the user to create a GR against that item. I have implemented the BADI "MB_MIGO_BADI" for this purpose and I am using the method "POST_DOCUMENT" to check the PO item and throw an error message, bu the issue is afterI throw an error message and when the user tries to exit from the transaction MIGO using the exit button, the system throws an short dump " Screen: Illegal message" because the program attempted to issue a " " message during "Exit Command" processing. In order to avoid this i tried the method "CHECK_ITEM" to populate the error message to application log, it works fine but I am not able to get the line item details inside this method. I even tried to import the line item details from the method "LINE_MODIFY" and then use it in "CHECK_ITEM" method, but the issue here is CHECK_ITEM is called only once for all the line item, ""LINE_MODIFY" was called every time i change the line item, so I was not able to use it. Can you please let me know if there is any other better way to achieve this.

As per the below weblog, this scenario is available as part of the standard in ECC Ehp4, but unfortunately we are on Ehp1.

5 REPLIES 5
Read only

aromalr
Active Participant
0 Likes
3,804

hi,

can you try the function module MICK_MESSAGE_ADD to raise the error message in the badi...

regards

Aromal

Read only

Former Member
0 Likes
3,804

Hi,

To validate the item data and issuing message you can use BADI MB_CHECK_LINE_BADI.

Thanks,

Pawan

Read only

0 Likes
3,804

Hi,

In the BADI MB_MIGO_BADI in order to give a message you can use the method CHECK_ITEM.

Populate the return table ET_BAPIRET2 with your message.

In this method you may not be able access the line item data but you can use Import Export return tables from other methods where you have validated to populate the message in the below manner.

ls_bapiret-type = 'E'.

ls_bapiret-id = 'ZMSG'.

ls_bapiret-number = '001'.

ls_bapiret-message_v1 = ls_goitem-zeile.

APPEND ls_bapiret TO it_bapiret.

Hope this helps you.

Regards,

Deepak.

Read only

Former Member
0 Likes
3,804

Dear Imran,

   To achieve the best possible solution you have to use two methods of this BADI in combination with each other. These two methods are 'LINE_MODIFY' and 'CHECK_ITEM'.

   The method 'LINE_MODIFY' will be called every time there is some activity on the MIGO screen. In this method you will have both the item line id and the item structure available in the interface. You will need to create a class attribute which is an internal table of a locally defined structure. The first field of this  structure will be the line_item_id and the second will be the item structure itself. The first time when this method is called for a line item a new entry is inserted into this class level attribute. For each subsequent time this structure needs to be updated with the new values comparing the line item id.

  The method 'CHECK_ITEM' will be called when you press the 'CHECK' or the 'POST' buttons. In this method based on the line item id the corresponding item structure will be obtained from the class level attribute. Using the data of the structure you can then perform your validations and populate the BAPIRET2_TAB parameter with the message details which will then be dispayed in the popup message box in MIGO.

  Hope this helps.

Best regards,

Pradip

Read only

0 Likes
3,804

Dear Pradip,

Solution given by you for activating error message using BADI MB_MIGO_BADI is for comparing PO line items. However, my requirement is different. I've to activate error message if user tries to change delivery cost vendor in MIGO (Mvnt Type 101/103/105) Freight tab. Below is one exp. to make it more understandable.

Suppose there is two line items in the PO and each line item has multiple delivery cost condition types (freight/packaging/octroi/insurance etc.) both at header and item level and each condition has different vendor tagged in it. Now when user does MIGO (101/103/105), in freight tab user can change vendor for any condition type and save the material document.

My requirement is to populate an error message at the time of POST if user has done so. We used POST_DOCUMENT method in BADI MB_MIGO_BADI for this. However, system is throwing error message on changing last delivery cost vendor only and for rest it is posting material document without throwing any error message.

Please help how to resolve this issue?

Regards,

Prerna Garg