Categories: ABAP TutorialsSAP PM

SAP PM Notifications get long Texts – Optimized

In order to get all Notification Text (QMEL, IFLOAT, … ), the standard way to do is to call the READ_TEXT which works fine.

But when we have to retrieve texts simultaneously of thousands of Notifications, the READ_TEXT in loop will be not for performance as it performs connection to database then FETCH data.

SAP Text Tables:
STXH – STXD SAPscript text file header
STXL – STXD SAPscript text file lines

Related Post

Thanks to this algorithm divises the runtime by at least twice.

PS: It can be very usefull to retrieve texts for other master data.
Material Description (MAKTX) can be a good sample for this.

Up to you to update this code snippets with you requirement.

* compressed text data with text name

    SELECT SINGLE tdobject tdname tdid tdspras tdtexttype
      INTO wa_stxh
       FROM stxh
       WHERE tdobject = 'TEXT'
         AND tdname   IN s_tdname
         AND tdid = 'ST'
         AND tdspras  IN s_spras.
    MOVE-CORRESPONDING wa_stxh TO wa_id.

    IF sy-subrc = 0.
      WRITE: / wa_stxh.
      SELECT SINGLE * FROM stxl
        INTO wa_stxl
        WHERE relid = 'TX'
          AND tdobject = 'TEXT'
          AND tdname IN s_tdname
          AND tdid = 'ST'
          AND tdspras IN s_spras
          AND srtf2 = '0'.
      IF sy-subrc = 0.
        WRITE: / wa_stxl-tdobject, wa_stxl-clustr, wa_stxl-clustd.
        "SAPscript format
        IF wa_stxh-tdtexttype IS INITIAL.
          IMPORT tline TO rt_lines
            FROM DATABASE stxl(tx)
                 CLIENT   sy-mandt
                 ID       wa_id
                  "important for Unicode->Nonunicode
                 ACCEPTING TRUNCATION
                 IGNORING CONVERSION ERRORS.
        ELSE.
          "non-SAPscript text
          IMPORT tline TO rt_lines
            FROM DATABASE stxb(tx)
                 CLIENT   sy-mandt
                 ID       wa_id
                 CODE PAGE INTO l_cp
                 ACCEPTING TRUNCATION
                 IGNORING CONVERSION ERRORS.

        ENDIF.
      ENDIF.
    ENDIF
Share
Published by
John

Recent Posts

The Most Important SAP ISU Tables

SAP ISU Tables for Technical master data, for Billing Master Data, Billing and invoicing Tables?…

December 22, 2020

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd Lecture

SAP Fiori 3 UX and Design of SAP Fiori Apps for SAP S/4HANA, SAP TechEd…

November 18, 2020

The Main SAP Dunning Transaction Codes

Dunning is the business practice of informing a customer of past due payment. Dunning letters…

November 28, 2019

SAP Accounts Payable Tcodes & Accounts Receivable Tcodes ( SAP AP Tcodes & SAP AR Tcodes)

SAP AP Tcodes & SAP AR Tcodes: House Banks Tcodes, Advance Payments or Down Payments,…

August 1, 2019

The Most Important SAP Payment Terms Tables (ZTERM, Text…)

What are the main SAP Payment Terms Tables ? What are the related Tables in…

October 21, 2018

The most Important SAP Work Center Tables in SAP PP

Work center consists of master data related to routing of products. It contains data related…

October 21, 2018