Raise Custom Error Message in the Standard Error list container while creating PR
2024-1-5 19:32:23 Author: blogs.sap.com(查看原文) 阅读量:6 收藏

Business Scenario

Error Message must be generated in the Standard Error List Container in case the PR Item is not created through the Catalog.

Implementation

Badi ME_PROCESS_REQ_CUST

Method PROCESS_ITEM

Error Message to be given is maintained in the message class.

Coding

INCLUDE mm_messages_mac. "Necessary in order to raise the error message
DATA : l_item TYPE mereq_item.   
DATA: lf_check_flag TYPE xfeld. 
DATA: lf_bnfpo_char TYPE char5.

*Read Item details
CALL METHOD im_item->get_data
      RECEIVING
        re_data = l_item.


*Perform your Checks

*Show Error in case the checks are not successful.
    IF lf_check_flag = abap_true.
*Macros are used in order to generate the error.
      lf_bnfpo_char = l_item-bnfpo.
      mmpur_metafield mmmfd_preq_item.
      mmpur_business_obj im_item.
      mmpur_message_forced 'E' 'ZMM' '050' lf_bnfpo_char '' '' ''.
    ENDIF.

Output

Thanks

Ketan


文章来源: https://blogs.sap.com/2024/01/05/raise-custom-error-message-in-the-standard-error-list-container-while-creating-pr/
如有侵权请联系:admin#unsafe.sh