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: 

Error Handling in BADI IF_EX_ME_PROCESS_PO_CUST~POST

jyotsna_singam
Explorer
0 Kudos
1,531

Hi All,

We are customizing BADI 'IF_EX_ME_PROCESS_PO_CUST~POST' to validate the PO when it is created/modified.

We tried using mmpur_message & mmpur_message_forced as below:

IF sy-subrc ne 0.

CALL METHOD im_header->invalidate( ).

mmpur_message 'E' 'YSC' '014' space space space space.

endif.

OR

IF sy-subrc ne 0.

CALL METHOD im_header->invalidate( ).

mmpur_message_forced 'E' 'YSC' '014' space space space space.

endif.

Even if is successfully executing the statement (checked at run time), error message is not getting displayed & there by allowing Po to be created/modified.

What is it that is going wrong? Do we have to add any other piece of code or some flag? Please do the needful.

Thanks & Regards,

Jyotsna

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos
490

Did you read method documentation (answer is no ?) you MUST NOT perform any check here, either use methods CHECK or PROCESS_HEADER.

Regards,

Raymond

8 REPLIES 8

former_member242512
Participant
0 Kudos
490

Hi

I used some validation in similar badi ME_PROCESS_REQ_CUST and method PROCESS_ITEM

Try below code :

            MESSAGE 'text'(001) TYPE  'E'
          DISPLAY LIKE 'I'.

Let me know if it works fine .

0 Kudos
490

It is not working. Po has been modified.

Former Member
0 Kudos
490

I think that the method POST is not done to display messages.

raymond_giuseppi
Active Contributor
0 Kudos
491

Did you read method documentation (answer is no ?) you MUST NOT perform any check here, either use methods CHECK or PROCESS_HEADER.

Regards,

Raymond

0 Kudos
490

Thank all for your guidance. Now we placed our code in check & able to populate the error in message log. But have a small issue. Even when the data entered is corrected, error remains in the log. Is there any way to remove the message from the log using any macros or FM?

0 Kudos
490

You can add a small code at start of methods like IF_EX_ME_PROCESS_PO_CUST~PROCESS_HEADER to remove your own error messages.


ls_header = im_header->get_data( ).
mmpur_context mmcnt_context_badi.
IF NOT ls_header-id IS INITIAL AND im_header->is_valid( ) EQ mmpur_yes.
   mmpur_remove_msg_by_context ls_header-id mmcnt_context_badi.
ENDIF.

Regards,

Raymond

0 Kudos
490

It worked. Thanks alot Raymond

0 Kudos
490

This message was moderated.