‎2007 Oct 06 8:54 AM
hi can any one tell how can we read the text elements in functionmodules,dataelements,functiongroups etc., as we have a query
to read the text elements in the program
Read textpool program into itab language sy-langu.
thnks,
Vaasu.
‎2007 Oct 06 9:26 AM
Hi Vaasu,
1. In SE37 give your FM Name ---> Display.
2. Goto -
> Text Elements.
Text elements allow you to store texts without hard-coding them in your program. You can maintain text elements outside the program in which they are used (choose Goto → Text elements in the Editor). They are particularly important for texts in applications that will be translated into other languages.
All programs (including include program) have a title. Other text elemen are assigned to the associated main program.
ABAP has the following kinds of text element:
Program title
List heading
Column heading
Selection texts (for texts belonging to selection criteria and program parameters)
Text symbols (constant texts)
The construction of text elements is defined by the structure TEXTPOOL. It contains the following fields:
ID:
A single character, representing the text element type. You can use the following values:
R - Program title
T - List heading
H - Column heading
S - Selection text
I - Text symbol
KEY:
Key field, which may contain the following values, depending on the type of the text element:
H - Number of a row with columns
-headings (001 - 004)
S - max. 8 character name of a selection
criterion or program parameter
I - 3 character number for a text symbol
The field is empty for program titles and list headings.
ENTRY:
Text of the text element (maximum 255 characters)
LENGTH:
Length of the text
Example
The following table displays some typical values for text elements:
ID KEY ENTRY LENGTH
H 001 Name Age 10
I 100 Tax 10
R , Test program 12
S CUST Customer 8
T , Sales 10
Notes
LENGTH determines the total available length for the text. If the text is to be translated into other languages, you should choose a value of LENGTH that is greater than the length required in the original language, to allow for translations that are longer than the original language version.
You can address text elements in two ways, either using TEXT-xxx or using '...'(xxx). Here, xxx stands for the number, and ... for the text of the text symbol.
The first form requires that there is already a text for number xxx. If there is not, the output is empty.
The second form improves the readability of the program. The text in inverted commas should correspond to the text stored under the text symbol. If it does not, the system uses the text stored for the text symbol. Exception: If there is no text saved under number xxx, the text in inverted commas is used.
Example: Text symbol number 001 has the text 'Please enter your name'. The following commands:
WRITE: / TEXT-001,
/ 'Please enter your name'(001),
/ 'What is your name?'(001).
all have the same output: "Please enter your name".
You can compare the texts used in the program with the texts stored as text symbols by choosing "Goto → Text elements → Compare text symbols" in the Editor.
If you set a LENGTH for the text element that is longer than the text itself, this is interpreted as though the text had trailing spaces up to the specified LENGTH. This means that if you use the notation '...'(xxx), the text between the inverted commas must have trailing zeros up to the length LENGTH. Otherwise, the text stored under the text symbol will not correspond with the text in inverted commas (see note 2).
Example: Suppose text symbol number 036 has the contents 'Name', and length 10. The following statement: folgende Befehl
WRITE: / SY-VLINE, TEXT-036, SY-VLINE,
/ SY-VLINE, 'Tax '(036), SY-VLINE,
/ SY-VLINE, 'Tax'(036), SY-VLINE.
would then output "| Tax |" three times. In particular, in the third line, the text symbol number 036 is output in length 10, and not the three-character text "Tax". If you compare the text elements (see note 2), the text symbols in the second and third lines are flagged as being different.
You should not use text symbols in subroutines that have more than one main program, since this leads to redundant text and unnecessary translation.
Instead, you should store these portions of code in subroutine pools
Thanks,
Reward If Helpful.
‎2007 Oct 06 10:55 AM
Hi vassu,
in a simple word, if u want to read the text element from FM , then go to SE37, open the FM then menu Goto-> Text element,
for report / include program.... go to the SE38, open that report.-- GOTO -> text element.
with in the code. we will put values in goto-> text element-> text symbol...
put the no in the first row 001and text.
get with the program like : write 'this is ', text-001
or prefix the "SAPL" after then the name of program/ f group and open it in SE38
give point if helpful
‎2007 Oct 06 11:50 AM
thanks for u r answer but i didn't get the stuff i wanted my question is how to read those text elements from function module when writing a program in abap editor.
regards
Vaasu.
‎2007 Oct 06 11:58 AM
Hi,
It is used to fetch the Long Text details or
Header and Items texts of a application document
READ_TEXT
READ_TEXT provides a text for the application program in the specified work areas.
The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.
After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.
If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.
Function call:
CALL FUNCTION 'READ_TEXT'
EXPORTING CLIENT = SY-MANDT
OBJECT = ?...
NAME = ?...
ID = ?...
LANGUAGE = ?...
ARCHIVE_HANDLE = 0
IMPORTING HEADER =
TABLES LINES = ?...
EXCEPTIONS ID =
LANGUAGE =
NAME =
NOT_FOUND =
OBJECT =
REFERENCE_CHECK =
WRONG_ACCESS_TO_ARCHIVE =
Export parameters:
CLIENT
Specify the client under which the text is stored. If you omit this parameter, the system uses the current client as default.
Reference field: SY-MANDT
Default value: SY-MANDT
OBJECT
Enter the name of the text object to which the text is allocated. Table TTXOB contains the valid objects.
Reference field: THEAD-TDOBJECT
NAME
Enter the name of the text module. The name may be up to 70 characters long. Its internal structure depends on the text object used.
Reference field: THEAD-TDNAME
ID
Enter the text ID of the text module. Table TTXID contains the valid text IDs, depending on the text object.
Reference field: THEAD-TDID
LANGUAGE
Enter the language key of the text module. The system accepts only languages that are defined in table T002.
Reference field: THEAD-TDSPRAS
ARCHIVE_HANDLE
If you want to read the text from the archive, you must enter a handle here. The system uses it to access the archive. You can create the handle using the function module ACHIVE_OPEN_FOR_READ.
The value '0' indicates that you do not want to read the text from the archive.
Reference field: SY-TABIX
Default value: 0
Import parameters:
HEADER
If the system finds the desired text, it returns the text header in this parameter.
Structure: THEAD
Table parameters:
LINES
The table contains all text lines that belong to the text read.
Structure: TLINE
Exceptions:
ID
The text ID specified in the parameter ID does not exist in table TTXID. It must be defined there together with the object of the text module.
LANGUAGE
The parameter LANGUAGE contains a language key that does not exist in table T002.
NAME
The parameter NAME contains the name of a text module that does not correspond to the SAPscript conventions.
Possible errors:
The field contains only blanks.
The field contains the invalid characters * or ,.
OBJECT
The parameter OBJECT contains the name of a text object that does not exist in table TTXOB.
NOT_FOUND
The system did not find the specified text module.
REFERENCE_CHECK
The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists.
WRONG_ACCESS_ TO_ARCHIVE
The exception WRONG_ACCESS_TO_ARCHIVE is triggered if an archive is accessed using an incorrect or non-existing archive handle or an incorrect mode (that is, read if the archive is open for writing or vice versa).
Thanks,
Reward If Helpful.