FYI:
First you have to set the context for your custom message before you can use mmpur_remove_msg_by_context. To set the context please use mmpur_context i (i = integer). I suggest a context higher than 900.
Example for checking incoterms:
INCLUDE mm_messages_mac.
IF ls_data_item-inco1 IS INITIAL OR ls_data_item-inco2 IS INITIAL.
mmpur_context 902.
CALL METHOD im_item->invalidate( ).
mmpur_message_forced 'E' 'ZLO_MM' '032' ls_data_item-ebelp '' '' ''.
ELSE.
mmpur_remove_msg_by_context ls_data_item-id 902.
ENDIF.
Best regards,
Sebastian