Following is the code when used in the include ZXQQMU20 (exit QQMA0014), prevents use of Code Group other than one from RefObj CatProfile in Object Part . (This is your requirement)
IF i_viqmel-qmart EQ 'M2'.
DATA: i_rbnr TYPE TABLE OF t352c,
w_rbnr TYPE t352c.
SELECT * FROM t352c INTO TABLE i_rbnr WHERE rbnr = i_viqmel-rbnr.
LOOP AT t_viqmfe WHERE aeknz <> 'D'.
clear sy-subrc.
READ TABLE i_rbnr INTO w_rbnr WITH KEY qcodegrp = t_viqmfe-otgrp .
IF sy-subrc <> 0.
MESSAGE: 'Atleast one Code Group used in Object part is not from the Ref.Object CatProfile.' TYPE 'I'.
RAISE exit_from_save.
ENDIF.
ENDLOOP.
ENDIF.
This throws the following error popup, when the rule is violated and prevents Notification from Save.
This can help you achieve similar effect for other Catalogs also if you want. Work with your ABAPer.
Note:
I have assumed the Notification type as 'M2'.
Good luck
KJogeswaraRao