Long Texts (also referred as SapScript texts or text objects) are the containers for containing long texts in SAP systems, and they are usually attached to business objects, that users can enter free comments.
Long Texts were initially created for SapScript tool because old database systems had text columns limited around 255 characters. The "new" database systems do not have this restriction any more, but Long Texts remain.
Long Texts can only be maintained via maintenance transactions of business objects to which they are attached, except "standard texts" that may be maintained through SO10 transaction.
They can be also read and written by a custom program, using standard function modules. See Programming Interface link below.
A long text is uniquely identified by the combination of these 4 fields:
- Id: 4 characters
- Name: 70 characters
- Object: 10 characters
Id and Object codes can be created through SE75 Transaction code. One text object can contain multiple text ids. Each text id contains multiple Text Names.
For example, this logic can be understood through the following scenario:
- Tracker Tool which contains Developments Objects & their status information along with Developers & Testers comments.
- Comments can be multiline so can't not be kept in a table that's why text objects come into scenario.
- Therefore, each development object should contain two text containers, one is for Developer comments and another one is for Testers Comments.
Standard Texts are texts with Object field equal to "TEXT". They can only be accessed via transaction SO10.
They can be manually transported, see note SO10 Transport of standard texts. For example, to transport standard text "ZREST-ENT1ALL" and id "ST" in French language, enter manually this line in a transport request: PGMID="R3TR", OBJECT="TEXT", OBJ_NAME="TEXT,ZREST-ENT1ALL,ST,F" (F = internal language representation of "FR", see table T002).
- sap library - BC - Word-Processing in the SAPscript Editor
- sap library - SapScript - The Programming Interface (list of SapScript function modules, among which those to process Long Texts)
Now in this scenario, one long text can be created named as Z_DEVOBJ through SE 75 as shown below:
- Step 1 : Go to SE75 Transaction. Click on change button, Now create Text Object zchd_obj.
Enter the name & Description of Text object. Here in this case, save mode is selected as update because comments data is need to be updated against each development objects table entry In editor ,Editor application is of type Standard Text(TX) and line width is 72 which can be selected as per requirement.
Style and Form can also be selected from this window, which will decide the display style of text.
Once the object is being created, double click on the text object.
- Step 2 : Create Text ids .In this scenario, 2 text Ids will be created as dev comments and testers comments will belong to unique text ids.
- Step 3 : Once the text ids will be created, front end work is done.
Now the question is that how can you store these comments data against each Text ID.
For storing & retrieving text objects, following function modules exist in sap.
- READ_TEXT - To retrieve Long Text from Text Objects.
- SAVE_TEXT - To save Long Text into Text Objects.
Now have a look on below code snippet to know how to use them:
Along with the text object id and its language, Text Name also needs to be passed.
Basically this Text Name is uniquely identifies dev comments against each dev objects.
For e.g. - Two Dev object id 1 and 2 have their unique dev comments. But having same Text Object ZCHD_OBJ and same Text ID -Y0B1.
That's why to uniquely identifies the dev comments for dev obj 1 and 2, Text names are dynamically created .For e.g. in above code snippet objid & Text id combine together to identify comments for Dev comments for each Object.
Now let's see how these long texts can be retrieved through save_text function module.