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

Problem while deleting standard error message from ME21n/Me22n and PO not getting saved

Former Member
0 Kudos

Hi Experts,

I am trying to remove standard error message from ME21n/ME22N using BADI ME_PROCESS_PO_CUST and method PROCESS_ITEM and giving my own custom error message if article is not maintained in site, I used MMPUR_MSG_REMOVE_BY_CONTEXT - passing the item id and context as '5'.

Now it is deleting 2 messages from that context ( Enter quantity also if quantity not entered) - I want to delete only 1 - is there a way to delete the message checking signature also?

Next after the messages are corrected if I go and try to save the PO still 1 error message is getting populated in the header as 'Purchase order still contain faulty items' - however if I click error log there is no error message displayed in log- but I am unable to save and create the PO - but if I end the session and create a new ME21n with the same detail it is getting saved.

If there is any way to check if the header and item is error free and then forcefully deleting the 1 error from the log so that the PO will be saved?

Please help, it is urgent.

Thanks.

1 ACCEPTED SOLUTION

former_member199637
Participant
0 Kudos

Hello Rajesh,

Below is logic to remove and add specific error.

DATA :  l_msg_handler    TYPE REF TO cl_message_handler_mm.

1. Get all the error/warning messages using GETLIST method of class CL_MESSAGE_HANDLER_MM

2. Use Method REMOVE of class CL_MESSAGE_HANDLER_MM to remove messages.

3. Use Method CREATE of class CL_MESSAGE_MM to add your messages.

To check whether the PO header or line is error free method IS_VALID can be used.

Regards,

Puneet Desai

8 REPLIES 8

former_member199637
Participant
0 Kudos

Hello Rajesh,

Below is logic to remove and add specific error.

DATA :  l_msg_handler    TYPE REF TO cl_message_handler_mm.

1. Get all the error/warning messages using GETLIST method of class CL_MESSAGE_HANDLER_MM

2. Use Method REMOVE of class CL_MESSAGE_HANDLER_MM to remove messages.

3. Use Method CREATE of class CL_MESSAGE_MM to add your messages.

To check whether the PO header or line is error free method IS_VALID can be used.

Regards,

Puneet Desai

0 Kudos

Hi Puneet,

I am able to delete particular error message by the way you suggested but the 2nd problem still persists - as I am unable to save the PO though it does not have any error ( I have corrected all).

Any solution please?

0 Kudos

Hello Rajesh,

In method CHECK of BAdI interface, once again call the method GETLIST method of class CL_MESSAGE_HANDLER_MM and if no error message other than 'Purchase order still contain faulty items' is present then use method REMOVE of class CL_MESSAGE_HANDLER_MM to remove all the error messages .

I hope this will solve your problem.

Regards,

Puneet Desai

0 Kudos

Hi Puneet,

     i know this discussion is still last year but if ever you can read this or whoever have an answer to this, i have a prob:

     I'm facing a dump INSIDE the remove method of that class whenever im using two line items in creating a PO. in the "INSERT l_event INTO deleted_events[]." line of the method.

     BTW, im issuing multiple error msgs per line item, so what i have to do is delete error msg one by one. i have no problem in issuance of error msg.

     Is there any other way to remove these error msgs one by one?

     Thanks in advance.

0 Kudos

Hii Rajesh,

follow the Puneet Desai post and try use method cleanup of class CL_MESSAGE_HANDLER_MM.

Hope this will work

regards

Syed

former_member210621
Participant
0 Kudos

Hi Rajesh,

Please check the configuration for standard message handling in SPRO. You can change the setting (hide, unhide, change message types, etc) defined in it.

Regards,

Ketan

Former Member
0 Kudos

Hi Rajesh,

The problem of removing two messages instead one arises because both messages have the same id and context.

To be able to delete messages one by one, we can use different context (id number associated with the item and can not be changed painlessly).

Using mmpur_business_obj_id we set context equal '5' . We need to create mmpur_business_obj_id_cust with own context value:

DEFINE mmpur_business_obj_id_cust.

    gl_subrc = sy-subrc.

    gl_tabix = sy-tabix.

    call method cl_handle_manager_mm=>get

      exporting

        im_id     = &1

      importing

        ex_handle = gl_handle.

    call method cl_message_mm=>set_current_business_obj

      exporting

        im_business_obj = gl_handle.

    call method cl_message_mm=>set_current_context

      exporting

        im_context = &2.

    sy-subrc = gl_subrc.

    sy-tabix = gl_tabix.

END-OF-DEFINITION.

So, to add message:

mmpur_business_obj_id_cust lv_id lv_context.

mmpur_message_forced 'E' 'ZTSD_CHECK_PO' '000' '' '' '' ''.

Remove message:

mmpur_remove_msg_by_context lv_id lv_context.

prakashhospet
Explorer
0 Kudos

HI puneet.desai

Once we display any Custom Error message from the Check Method, after correcting the error we are still getting the old messages. Tried deleting the Old messages using Methods from class cl_message_handler_mm.

How to delete custom error message but not delete SAP standard error message in PO badi IF_EX_ME_PROCESS_PO_CUST.

Can you please help here.

Thanks,

Prakash A