Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Default Notification Long text is not saved if changes are not made to editor

former_member193464
Contributor
0 Kudos
1,637

Hi All,

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

Manoj

1 ACCEPTED SOLUTION

former_member193464
Contributor
310

Hi ,

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>.

and

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...

3 REPLIES 3

Former Member
0 Kudos
310

Is it not behaving logically? If there are no changes made, there should be no log.

Do you want it to be logged whenever the editor is opened in change mode?

0 Kudos
310

Well depends... You can always have a check on the changed text.(Blank to defaulted text)
If we are defaulting a long text, that means editor has something logged. So it should be saved.

The same happens in case of a reference notification that has some text. The text is defaulted in the new notification and without any changes if you save it would automatically save the default text too.

Anyway I did found a workaround to this, I will be replying on the main post for people who faced the same problem and would want to know a work around for this.


former_member193464
Contributor
311

Hi ,

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>.

and

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...