Skip to Content
Author's profile photo K Jogeswara Rao

Making DMS entry mandatory while Creating a Notification (PM/CS/QM)

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.

Capture.JPG

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

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo sandeep praharaj
      sandeep praharaj

      sir,

      very good document . nice to learn the concepts.

      Thanks for sharing.

      Thanks & Regards

      Sandeep Kumar Praharaj

      Author's profile photo Jogeswara Rao K
      Jogeswara Rao K
      Blog Post Author

      Thank you Sandeep 🙂

      You were the reason behind this explore.

      Regards

      KJogeswaraRao

      Author's profile photo Bharath Padmanabhan
      Bharath Padmanabhan

      Dear Sir,

      Thanks a million for capturing your great efforts as a blog post. Extremely helpful. Narration is very clear.

      Cheers,

      Aspire

      Author's profile photo DIVYA SINGH
      DIVYA SINGH

      Hi Sir,

      Thankyou so much for your document. I implemented the same in one of my requirements to make document entry mandatory in notification creation, only that instead of user exit,  implementation of BADI NOTIF_EVENT_SAVE is called. However, In IW22, I am getting error in adding document for the below scenario :

      1. For an existing notification with document, I deleted the document and clicked on SAVE button. Function module CV140_LINKS_SAVE got triggered which fetches data from DMS screen to standard tables gt_drad and gt_drad_change .The BADI implementation NOTIF_EVENT_SAVE got triggered and threw the error message 'Document is Mandatory', which got generated by filling ev_subrc values.

      Again in the same screen, if I try to add the document and then click on SAVE button, the standard FM CV140_LINKS_SAVE which takes the document number from screen is not triggered. Again the BADI implementation is triggered, and since the tables gt_drad and gt_drad_change are not filled, I am getting the custom error 'Document is Mandatory',.

      I am thinking that because of the error message being triggered from BADI implementaion, standard program is not getting called, on pressing SAVE button 2nd time, However I need that error message, to prevent notification being saved without DMS document. Can you help me here to resolve the issue.

      Thanks and regards

      Divya Singh