Skip to Content

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)———————————————————————————$*$*

 

 

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Michael Theis

    Hi,

    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

    Michael

    (0) 

Leave a Reply