Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
jan_rauscher
Contributor
0 Kudos
Challenge

The MDG rule derivation standard code strictly turns custom triggered error or warning messages of derivation BAdI customer code into info message type. In some situations the derivation BAdI is a perfect location for doing not only derivations but also other checks and data transformations including throwing warning or even error messages (for stopping the MDG process).

 

 

Solution approach

Implement a so-called “implicit enhancement” at the very end of the relevant method IF_USMD_RULE_SERVICE~DERIVE_ENTITY of class CL_USMD_RULE_SERVICE. The disadvantage of an “implicit enhancement” is the dependency on future code-changes of the original code – however this is quite unlikely. The advantage is definitely the simplicity of this solution approach.

 

A suggestion for such an implementation approach:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Class CL_USMD_RULE_SERVICE, Interface IF_USMD_RULE_SERVICE, Method DERIVE_ENTITY, End                                                             A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  ZZ_DERIVE_MSG_TYPE_MGT.    "active version
* this DERIVE method turns all W messages into info message
* in special case that messages out of class ZZ_MSG_CLASS are used, warn messages should remain warnings
loop at et_message into ls_message where msgid eq 'ZZ_MSG_CLASS' and msgty eq 'I'.
if lf_error = 'X' .
ls_message-msgty = 'E'.
else.
ls_message-msgty = 'W'.
endif.
modify et_message from ls_message index sy-tabix.
endloop.
ENDENHANCEMENT.
*$*$-End:   (1)---------------------------------------------------------------------------------$*$*

 

 
2 Comments