ABAP News for Release 7.51 – Short Form for MESSAGE
With ABAP 7.50, a new interface IF_T100_DYN_MSG was introduced that enriched the existing IF_T100_Message with
- an attribute MSGTY for the message type
- and attributes MSGV1 to MSGV4 for the placeholders of the message.
Using that interface some colleagues soon found a small gap:
TRY. ... CATCH cx_demo_dyn_t100 INTO DATA(oref). MESSAGE oref TYPE oref->if_t100_dyn_msg~msgty. ENDTRY.
If you catch an exception where the exception class implements IF_T100_DYN_MSG and you want to send the respective message with the message type stored in the attribute MSGTY, well, why should you name it explicitly?
This was resolved with ABAP 7.51. If oref of the statement variant MESSAGE oref points to an object that implements the system interface IF_T100_DYN_MSG, the addition TYPE can be omitted and the message type in MSGTY is used:
TRY. ... CATCH cx_demo_dyn_t100 INTO DATA(oref). MESSAGE oref. ENDTRY.
And that’s all about that.
For more information see MESSAGE – msg.