Default Notification Header Text
Introduction
Various posts over the years have expressed similar requirements: Loosely quoted they read:
“How can I default a (standard) text into the notification header text? I want my end users to be prompted to complete a set of questions”
The following document provides sufficient detail for this requirement to be achieved.
Realization Approach
Many posts have suggested the use of standard texts and the SAP supplied enhancement QQMA0025 – PM/SM Default values when adding a notification. The solution outlined in this document utilizes standard texts and the SAP supplied enhancement.
Standard Text
It is assumed that the text to be defaulted into the notification header text is defined as a standard text. Standard texts are maintained with the transaction SO10 in an SAP ECC system and can be read with the function READ_TEXT.
SAP Enhancement QQMA0025
The SAP enhancement is designed to allow the setting of default values in the notification, and dependent objects like activities, items and tasks. The interface provides the notification header, notification type configuration and the notification dependent objects.
Solution 1: Default Standard Text in the notification long text
Step 1: Read the standard text
the standard text can be read with the function module READ_TEXT; In this case reading a text with the name ZPMWOCMN_01.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'ST'
LANGUAGE = SY-LANGU
NAME = 'ZPMWOCMN_01'
OBJECT = 'TEXT'
TABLES
LINES = LT_LINES_STD
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
Step 2: Initiate the notification long text processing
CALL FUNCTION 'INIT_TEXT'
EXPORTING
ID = 'LTXT'
LANGUAGE = I_VIQMEL-KZMLA
NAME = wa_notification_text_name
OBJECT = 'QMEL'
IMPORTING
HEADER = WA_HEADER
TABLES
LINES = LT_LINES_NOT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
Step 3: Merge the standard text lines with the notification lines and save
APPEND LINES OF LT_LINES_STD TO LT_LINES_NOT.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = WA_HEADER
TABLES
LINES = LT_LINES_NOT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5.
Step 4: Update indicator in header that long text exists
E_VIQMEL-INDTX = 'X'.
Solution 2: Default Standard Text in the notification long text and branch to long text editor
similar to above, except after Step 1, the following steps:
Step 2: Merge standard text text and count lines
APPEND LINES OF LT_LINES_STD TO LT_LINES_NOT.
L_CNT_LINES = LINES( LT_LINES_NOT ).
Step 3: Call long text editor
CALL FUNCTION 'LANGTEXT_ONLY'
EXPORTING
OBJECT = 'QMEL'
OBJECT_NR = wa_notification_text_name
SPRAS = SY-LANGU
TXTID = 'TEXT'
X_XAKTYP = 'H' "Creation mode
SAVE_MODE = 'X'
TEXT_HISTORY = I_TQ80-QMLTXT01
TEXT_PROPERTY = I_TQ80-QMLTXT02
COUNT_INLINE = L_CNT_LINES
IV_SUPPRESS_END_SPACE = SPACE
TABLES
T_INLINES = LT_LINES_NOT.
Hints and Tips
You can review the subroutine TEXT_ANLEGEN_F50 in the function group IQS0 or the function module IQS0_ADD_NOTIFICATION_LONGTEXT for more details of notification text processing. There you will see how to protect lines of text and to create history lines.
Limitations
The SAP enhancement isn’t ideally suited to the generation of long text, because the interface does not allow the maintenance of the indicator ( WVIQMEL–INDTXTUPD ) used in the function group IQS0 to indicate text processing changes. Without the user processing the long text, the defaulted long text will not be saved.
Other Frequently Asked Questions
Is there a possibility using configuration?
In short – no. There is no possibility using configuration.
Hello Andrew,
One doubt:
Step1 (fm READ_TEXT) + Step4 (E_VIQMEL-INDTX = 'X'. ) alone bring the standard text to Notification. Why to have long code? means why to have other Steps2,3 etc.
KJogeswaraRao
Hello.
I got it working perfectly using Solution 2. Thank you very much, great blog.
Just one thing about it is the parameter
TXTID = 'TEXT'
It is incorrect. The correct is
TXTID = 'LTXT'
Gabby
Thanks for the blog.
In terms of the limitation you mentioned, you can now use BADI NOTIF_EVENT_SAVE to set parameter CV_WVIQMEL_INDTXTUPD indicating that there is long text to save.
Regards
Nicole