Skip to Content

Update Long text for Notification

Hi all

I have a problem updating the “long text” for a PM/SM notification.

Scenario:

When the service notification is created (transaction IW51) the long text should have an additional row added upon saving the notification.

We really want this added information in the long text and not in some Z-field because the information is to be passed to a PDA running SAP MAM (Mobile Asset Management) and a customer defined field is not the first option.

I have so far used user-exit defined by transaction SMOD like QQMA0014, QM/PM/SM: Checks before saving a notification.

In the customer implementation (transaction CMOD) of QQMA0014 the following code is used:

*----------------------------------------------------------------------*
*   INCLUDE ZXQQMU20                                                   *
*----------------------------------------------------------------------*
DATA:
  ltxttab TYPE standard table of tline,
  line    TYPE tline,
  lines   TYPE sy-tabix.

---

*   Read long text for Notification from memory
    import tline to ltxttab from memory id 'SAPLSTXD000001'.
    if sy-subrc eq 0.
      describe table ltxttab lines lines.
      line-tdformat = '*'.
      line-tdline   = 'X1234567Y1234567'.
      append line to ltxttab.
      export tline = ltxttab to memory id 'SAPLSTXD000001'.
    endif.

---

This does work so far. I get the long text in table ltxttab and can add a line to this table. I can see that perfectly when debugging. I then hit F8 to continue the save processing of the new notification.

Now to the problem:

R/3 does not save the notification but issues an error message TD062, Text object is not available. Hm. I have a feeling that the update of the SAP defined memory id does not like to be changed at all.

As the notification number is not known in the user exit (as far as I understand it) then a direct update of the long text using function module SAVE_TEXT can not be done because the necessary key is not known.

Has anyone faced something similar and found a solution?

Any input is highly appreciated!

Yes, I have scanned OSS and the Internet and SDN etc. No luck so far.

Regards, Johan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Mar 07, 2005 at 06:39 PM

    Hi,

    All long texts have a header and text lines. The header contains the text object, text id and a couple of other values(structure THEAD). On this structure there is also a field for the number lines in the line table.

    Could it be that your text header area is not filled in, but you are trying to add lines to it?

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Srinivas,

      I am still facing the issue when the when the long text is Initially EMPTY and I am try to add my string. It is not adding the same.

      The solution provided by you is working fine when the long text is NOT EMPTY. i.e it is having at least one line.

      However if the long text is empty(As per my requirement, the below statement fails

      * Read long text for Notification from memory

      IMPORT thead TO headltx

      tline TO ltxttab

      FROM MEMORY ID 'SAPLSTXD000001'.

      Here SY-subrc becomes 4.

      after this I am unable to export my string in the long text.

      Whether the SAP can use the memory ID ''SAPLSTXD000001' only? Is it fixed for notification long text. I tried to change the name also and also manually filled the structure headltx...but still it is not saving my string.

      My code is as below

      * Read long text for Notification from memory

      IMPORT thead TO ls_headltx

      tline TO lt_ltxttab

      FROM MEMORY ID 'SAPLSTXD000001'.

      IF sy-subrc EQ 0.

      *Lines

      ls_line-tdformat = '*'.

      ls_line-tdline = 'ABC'.

      APPEND ls_line TO lt_ltxttab.

      *Header

      DESCRIBE TABLE lt_ltxttab LINES lv_lines.

      ls_headltx-tdtxtlines = lv_lines.

      EXPORT tline = lt_ltxttab

      thead = ls_headltx TO MEMORY ID 'SAPLSTXD000001'.

      ELSE.

      *Lines

      ls_line-tdformat = '*'.

      ls_line-tdline = 'ABC'.

      APPEND ls_line TO lt_ltxttab.

      *Header

      CLEAR lv_tdname.

      LV_TDNAME = I_VIQMEL-QMNUM. "At run time it is returning %00000000001

      ls_headltx-TDID = 'LTXT'.

      ls_headltx-TDSPRAS = 'E'.

      ls_headltx-TDNAME = LV_TDNAME. "%00000000001

      ls_headltx-TDOBJECT = 'QMEL'.

      ls_headltx-TDFORM = 'PM_QMEL'.

      ls_headltx-TDFUSER = 'NSAQIB'.

      ls_headltx-TDFRELES = '620'.

      ls_headltx-TDFDATE = '20100513'.

      ls_headltx-TDFTIME = '131921'.

      ls_headltx-TDLINESIZE = '072'.

      DESCRIBE TABLE lt_ltxttab LINES lv_lines.

      ls_headltx-tdtxtlines = lv_lines.

      EXPORT tline = lt_ltxttab

      thead = ls_headltx TO MEMORY ID 'SAPLSTXD000001'.

      ENDIF.

      Could you please help in this.

      Regards

      Krishan

  • Posted on Mar 07, 2005 at 05:24 PM

    >I have a feeling that the update of the SAP

    > defined memory id does not like to be changed at all.

    I have tested your code in some test programs, there is no problem in updating the table and exporting thru standard SAP memory ids.

    There's gotton be another reason for your error.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 14, 2015 at 12:06 PM

    Hi Krsihan,

    How did you resolved your issue?

    Even Iam facing the same problem.

    regards,

    Anbu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.