Background:
Today, I was replying to a thread where the subject question was asked. Naturally the user exit comes to everyone's mind is QQMA0014 which is used to prevent Notification Saving, in case desired condition set by us is not fulfilled. Similar were the replies including one by me. Soon I realized that these fields of DMS in a Notification are not a part of import structure of the exit namely I_VIQMEL. The record linking DMS fields to the Notification will be available in table DRAD after the Notification is saved. So I modified my reply accordingly and gave a Code for 'Making DMS entry mandatory while Change Notification'. I also suggested that in case the control at 'Change Notification' level as suggested is not suitable and control at 'Create Notification' level is only suitable for him, then his ABAPer will be needed to explore the same using field-symbols and the runtime internal tables of the Standard program namely SAPLIQS0.
Present Work
I then started exploring the solution myself and I got what I was searching for, i.e., the internal tables related to DRAD table in this Notification Create program namely SAPLIQS0. Using this I wrote a few lines of code in the user-exit QQMA0014, which worked fine and forced user to attach a DIR in the DMS link tab while creating a Notification. Later these few lines developed into the code given below, which takes care of other dependent aspects listed later in this document. I believe this work will be useful to many whosoever got such application in their functions.
So the code here to be put in the include ZXQQMU20 of the user-exit QQMA0014
DATA: BEGIN OF I_DRAD OCCURS 10. INCLUDE STRUCTURE DRAD. DATA:END OF I_DRAD. DATA: BEGIN OF I_DRAD1 OCCURS 10. INCLUDE STRUCTURE DRAD. DATA:END OF I_DRAD1. DATA: V_DOKOB TYPE DOKOB. FIELD-SYMBOLS : <L_DRAD> TYPE ANY. FIELD-SYMBOLS : <L_DRAD1> TYPE ANY. ASSIGN ('(SAPLIQS0)GT_DRAD_CHANGE[]') TO <L_DRAD>. ASSIGN ('(SAPLIQS0)GT_DRAD[]') TO <L_DRAD1>. I_DRAD[] = <L_DRAD>. I_DRAD1[] = <L_DRAD1>. SELECT SINGLE DOKOB FROM DRAD INTO V_DOKOB WHERE OBJKY = I_VIQMEL-QMNUM. IF SY-TCODE = 'IW21' AND I_VIQMEL-QMART = 'M1'. IF V_DOKOB IS INITIAL AND I_DRAD[] IS INITIAL. MESSAGE: 'Attaching DIR is mandatory' TYPE 'E' DISPLAY LIKE 'I'. ENDIF. ELSEIF ( SY-TCODE = 'IW22' OR SY-TCODE = 'IW32' ) AND I_VIQMEL-QMART = 'M1'. IF V_DOKOB IS INITIAL AND I_DRAD[] IS INITIAL AND I_DRAD1[] IS INITIAL. MESSAGE: 'Attaching DIR is mandatory' TYPE 'E' DISPLAY LIKE 'I'. ELSEIF V_DOKOB IS NOT INITIAL AND I_DRAD[] IS INITIAL AND I_DRAD1[] IS NOT INITIAL. MESSAGE: 'Attaching DIR is mandatory' TYPE 'E' DISPLAY LIKE 'I'. ENDIF. ENDIF.
After this, we get the below given error pop-up whenever we try to skip DIR attaching in the DMS link tab, in the following cases:
1. While Creating a M1 Notification directly.
2. While updating M1 Notification already created through IW31 (Create Order integrated with M1 notification)
3. While deleting DIR entry in change mode of such Notification.
Note:
1. This work is applicable to QM/CS Notifications also. In Line1 and Line26 just replace values IW21, IW22 with the respective Create/Change Notification Tcodes and value 'M1' with the respective Notification type.
2. As mentioned above, this code has also been tested for M1 Notifications created through IW31. In such Notifications user will be forced to attach DIR in Order/Notification change mode (IW22/IW32). QM/CS users need change the IW32 value in line26 accordingly .
As always mentioned the author believed in documenting useful knowledge pieces irrespective of its length, Hope present and future members will find this useful.
Thank you
KJogeswaraRao