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.
Showing results for 
Search instead for 
Did you mean: 

Error message in ME_PROCESS_PO_CUST- check method

0 Kudos

I wanted to put a validation at item level while creating PO, The error message should display in Pop up like standard errors, I am able to achieve that in Check method of BADI ME_PROCESS_PO_CUST.

The issue is i want to display all error in the Pop up like if multiple items have failed all items should be in the list, But when i display error in CHECK method, control comes out from method and only one error can be displayed at a time, is it possible to display all errors through this method?


Active Contributor

Should I understand that you didn't use the macros of the include mm_messages_mac to handle error messages in the BAdI, or am I mistaken?

Sample on how to handle errors in PROCESS_ITEM

  INCLUDE mm_messages_mac.
  DATA: ls_item TYPE mepoitem.
* Get data
  ls_item = im_item->get_data( ).
* Cleansing time
  mmpur_context mmcnt_context_badi.
  IF NOT ls_item-id IS INITIAL.
    mmpur_remove_msg_by_context ls_item-id mmcnt_context_badi.
* ...
* Raise an error on field Material
  im_item->invalidate( ).
  mmpur_metafield mmmfd_matnr.
  mmpur_message_forced 'E' 'ZXXX' '123' <item_data>-matnr ' ' ' ' ' '.

0 Kudos

Hi raymond.giuseppi ,

I wanted to change the Service item(s) against Po item , but i am not able to read proper service items with Method GET_DATA .

Please help me out to read and change the service item using get_data , set_data .


Om .

0 Kudos

I used error message without macros like e000(), but even with macros multiple errors are not displayed, control comes out from the method

once you displayed first error

0 Kudos

Strange as macro 'mmpur_message_forced' force the collect.

Could you try to force message handler behavior with following macro :

" message type / dialog / collect
mmpur_message_config 'E' ' ' 'X'. " no display and collect

and some debug (e.g. break-point at start of method CL_MESSAGE_MM=>CREATE)

0 Kudos

Did you try to put your control in methods such as PROCESS_ITEM rather than CHECK?

0 Kudos

You have to set business object (item) for which you output the message:

METHOD if_ex_me_process_po_cust~check.
  INCLUDE mm_messages_mac.

  mmpur_business_obj item_ref.    "Reference to the item
  mmpur_metafield mmmfd_cust_01.  "Field with error
  MESSAGE ... INTO dummy.
  mmpur_message_forced sy-msgty sy-msgid sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  DATA(lf_failed) = 'X'.

  IF lf_failed = 'X'.
    ch_failed = 'X'.