Skip to Content
Author's profile photo Jan Rauscher

Allow error messages for MDG rule derivation BAdI


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)———————————————————————————$*$*
* 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’.
ls_message-msgty = ‘W’.
modify et_message from ls_message index sy-tabix.
*$*$-End:   (1)———————————————————————————$*$*



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Michael Theis
      Michael Theis


      please be aware that doing this might cause inconsistencies in your data. Warnings or errors returned from the derivation method of the rule services BAdI can cause mis-behavior of the delta buffer. You might be faced with un-resolvable error messages that finally require the creation of a new change request.

      For checking data, you should always use the check methods of the rule service BAdI.

      Kind regards


      Author's profile photo Jan Rauscher
      Jan Rauscher
      Blog Post Author

      Hello Michael,

      am aware that the validation and derivation are two kind of things and in most cases info messages are the best option for the derivation BAdI. However in some situations it makes not only sense to derive and change user input but also warn and even stop the process if needed. In one customer project i had such a situation where we had a remarkable amount of rule logic distributed in validation and derivation BAdI and it wouldn't be a good idea to move all logic into the validations BAdI (sometimes customer projects have a time and budget limit). So i wanted to share this quick but helpful solution to have an efficient way to handle the requirement.