Retrieving Longtext-lines for Reporting
For many of the Functional people longtexts is a sort of complicated thing for the fact that there are no straight tables which store these lines. So, whenever we think of making some report displaying long texts, we generally stuck at the very initial stage of finding the source of this information. This document is aimed at clearing these concepts.
We know the longtexts are very widely used within all SAP objects. For example in PM module, Longtexts associated with Notification Header, Order Header etc, also the Long texts associated with Catalog-Codes in Notifications, Operations in Orders, Measuring document related.
In this post, we try to understand these concepts, through the longtexts of PM Order operations.
So, let’s try and see how we reach the Long text lines of an Order operation.
Essence of this document is centered at using a Function Module named READ_TEXT. First let’s have a look at what this FM gives? For this, run Tcode SE37.
Give FM name in the Function Module field and Hit function key F8 or Click on Execute button shown above.
Now, here in the above screen, when we
- Enter the values for the fields marked Green
- Press Execute button
We get the long text lines into the table named LINES at the bottom (marked Red).
Now what are these fields we need to fill and where we will find these? The answer comes from the Order operation longtext page. In our example we have taken operation 0020 of an Order as shown below .
Here, we enter into the long text page upon clicking on the Longtext icon above. Now in the Longtext page click on GoTo –> Header in the menubar.
Now we get the pop-up below, showing these field values required for SE37.
Let’s see the relation between the SE37 screen and the Order Longtext screen fields through the following picture. (The value in ‘Client’ field of SE37 need not be filled. System identifies and fills it).
Here, we understand all the field values except for one i.e. the TEXTNAME. The understood fields are namely :
|LANGUAGE||EN||Constant as per your system|
|TEXTID||AVOT||Constant for Order Operation longtext|
|TEXTOBJECT||AUFK||Constant for Order related longtext|
What we need to understand is the value of TEXTNAME i.e., 400100140302700000002. Let’s see how this comes. Let’s see this number this way.
First 3 characters (400) is the client number of the SAP (on which you are working)
Next 10 characters (1001403027) form the AUFPL field value of the operation
Next 8 characters (00000002) indicate the Operation number APLZL
Client number we always are aware of. Other two field values we should take from table (view) VIAUF_AFVC by inputting the Order number. Means, run Tcode SE16, give value VIAUF_AFVC and hit function key F7 .
Enter the Order number and Execute (F8).
We get this results screen.
Here as per the operations tab of the Order we see 3 records one for each operation. Our operation in question is no.2. Let’s pick-up the corresponding values of AUFPL and APLZL from here.
So what I want to say is, the ABAPer passes the values of Orders from the Selection screen (of the ZTcode he develops) and extracts these values from the table and concatenates (joins) all the 3 vlaues together into TEXTNAME and executes the Function Module alongwith other values (Language, TextId, TextObject) to get the Longtext lines through the Table LINES of the Function Module.
Now let’s execute the FM READ_TEXT by filling these values.
See what we got
The FM READ_TEXT has given us all the 4 lines present in the Operation2 text . Now our ABAPer would use this info in his code for long text report.
Hope things are clear.
The values of TextId, TextObject vary as to which SAP object the Longtext belongs, so as the constituents of TextName field value also. Here I am attempting to tabulate few such examples of SAP-PM area for the benefit of members.
|Long Text Associated with||TEXTID||
|Notification Header Text||LTXT||QMEL||QMNUM (Notifn no )|
|Item Text in Catalogs&Codes||LTXT||QMFE||QMNUM + POSNR||POSNR from VIQMFE table|
|Cause Text in Catalogs&Codes||LTXT||QMUR||QMNUM + QURNUM||QURNUM from VIQMUR table|
|Task Text in Catalogs&Codes||LTXT||QMSM||QMNUM + QSMNUM||QSMNUM from VIQMSM table|
|Activity Text in Catalgs&Codes||LTXT||QMMA||QMNUM + QMANUM||QMANUM from VIQMSM table|
|PM order Header Text||KOPF||AUFK||ClientNo + AUFNR (Order)|
|Measuring Document||LTXT||IMRG||MDOCM (Document no)|
|Tasklist||PLPO||ROUTING||Client+TasklistType+Group+PLNKN+ZAEHL values (of PLPO table)||
Refer to my reply to the 1st comment of this Document
*The QMNUM, AUFNR values should be preceded by the leading zero’s (like 004300093626)
Easy retrieving of Longtexts in Smartforms
The information so far is more relevant to ALV reporting (though it works for smartforms also). In Smartforms, there is a convenient way of retrieving long texts, i.e., through include text. We declare the text type as Include text which gives us the provision of filling the TEXTNAME, LANGUAGE, TEXTID, TEXTOBJECT etc. As the the loop runs the TEXTNAME changes according to the SAP object number the respective longtext is retrieved. In the picture below an example for Notification Longtext in smartforms is given.
Related technical info
There is a table named STXH which stores the Text Header details. Here you get the number of text lines in the long text upon inputting the field values such as TDID, TDOBJECT, TDNAME etc. The following Selection screen (SE16) and the output are self explanatory .
So, that’s everything on this subject, which I had been thinking of documenting for the benefit of the forum, since sometime. Hope members find it useful.
PS: Members might now have understood that though PM Objects have been illustrated here, this post applies to the Longtexts of objects in other module too.