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