Default Notification Long text is not saved if changes are not made to editor
Request your suggestions for the below problem. There are many thread for population of default long text, however i can not find a solution to the below problem (atleast not a good one).
I am able to set the default long text in notification in IW21 when user changes something in the long text and presses save it works.However if the user does not changes anything in the editor the long text is not copied.
Debugging it i found out that Standard SAP calls a FM on commit through a subroutine, TEXT_UPDATE to change the initial name to the new number that has been assigned to the notification.
The problem comes in the cl_gui_text_editor the read in text stream is set only for modified(harcoded in standard sap when calling the method to read text stream)(and as in this case we did not touched the editor/changed anything so it showed blank). (So modified status is 0)
Curious thing is text_update is not called if we save the notification without changing anything on the editor, thus the new name object is not updated .
Did someone faced this issue before ? any suggestions are welcome.
Thanks in advance
Maverick Manoj replied
For someone who had the same problem he can do as following.
Use exit ZXMCIU01 (triggers at save of notification and WO)
Here you have two structures n_viqmel and o_viqmel.
I checked if n_viqmel-qmnum NE o_viqmel-qmnum (just to make sure that notification was being created and not changed (In our scenario default text is only at time of creation))
For a single notification creation you can directly import data from memory id SAPLSTXD000001
IMPORT thead TO theader "
tline TO tlines "
FROM MEMORY ID lv_memory_id.
and then SAVE_TEXT, or RENAME_TEXT(you would not need the data then just the theader) passing the new notification number and COMMIT_TEXT.
The only issue now was at mass creation of notification , such in our case is from IW32 , you can create more than one notification in buffer, so the above memory id will be different (o_viqmel does not store the temporary notification number so the solution becomes a little different)
You now import catalog from F.G. STXD , this stores all the buffer notification ID that is appended in fromt of SAPLSTXD for every notification.CATALOG table still has the temporary notification no. in it , so now you have to find a relation between the new notification number that we have in the exit and the old notification no. (like %000000002).
For this we use field symbols to get the table that stores this relation new number to old number.
here the table is
field_name = '(SAPLIQS1)IQMNUM'.
ASSIGN (field_name) TO <fs_table>.
IMPORT catalog FROM MEMORY ID 'SAPLSTXD'.
Now you have a relation and hence can import the desired text and update ( or just rename the text )
Hope this helps...