ABAPINSERT_TEXTPOOL - INSERT TEXTPOOL
CL_GUI_FRONTEND_SERVICES - Frontend Services BAL_S_LOG - Application Log: Log header dataThis documentation is copyright by SAP AG.
INSERT TEXTPOOL
Syntax
INSERT TEXTPOOL prog FROM itab LANGUAGE lang.
Effect
This statement places the contents of table itab into theRepository as atextpool of the language specified in lang for the ABAP program specified in prog. Ifa text pool for the specified language already exists, all of its text elements are overwritten. Otherwise, a new text pool is created for this language.
For prog, you must specify a flat character-type data object that contains the name of the program of the text elements to be read; it can be uppercase or lowercase.
For lang, you must specify a character-type, flat data object that contains a language key no longer than 1 character, whose value must be in the column SPRAS of database tableT002. If an invalid language is specified in lang, no text pool is created or overwritten. If lang contains a blank, the behavior is undefined.
The internal table itab can be any table type and its row type must correspond to theTEXTPOOL structure in the ABAP Dictionary. If a non-existent program is specified in prog, no text pool is created or overwritten.
In the internal table itab, the ENTRY column can contain the texts of the text symbols, the selection texts, thelist headers, and the title for theprogramattributes; in the LENGTH column, you can specify the corresponding lengths. The individual textelements are identified using the entries in the columns ID and KEY, whose valid values are shown inthe table for READ TEXTPOOL.
If the columns ID or KEY of the internal table contain invalid values or if duplicate entries exist,an inconsistent text pool is created. If the internal table is empty, all text elements of an existingtext pool are deleted or a text pool without text elements is created. If the length specified in LENGTH is shorter than the text length in ENTRY, it is automatically set to the text length in the text pool.
Return Values
The INSERT TEXTPOOL statement always sets sy-subrc to the value 0.
Notes
- The specification of the text length in LENGTH defines the maximum length of the text element that is available in theABAPWorkbench when translating the text pool into other languages and should be set sufficiently large.
- In the case of selection texts, there must be eight blanks before the actual text in ENTRY. If you want to use a selection text from the Dictionary, then the first character of ENTRY must be a "D".
- The INSERT TEXTPOOL statement should be used with caution, because it completely overwrites existing text pools.
Example
Attempt at a translation tool for text elements. The text pools of a source and a target language are imported into internal tables and, for each text element of the source language, aselectionscreen is displayed as a translation template. After the translation has been completed, the text pool of the target language is overwritten with the correspondingly changed internal table.
PARAMETERS: program TYPE sy-repid,
langu1 TYPE spras DEFAULT sy-langu,
langu2 TYPE spras.
SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.
SELECTION-SCREEN COMMENT /1(83) source.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS target TYPE textpool-entry.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF SCREEN 500.
DATA: text1 TYPE SORTED TABLE OF textpool
WITH UNIQUE KEY id KEY,
text2 TYPE SORTED TABLE OF textpool
WITH UNIQUE KEY id KEY,
wa1 TYPE textpool,
wa2 TYPE textpool.
READ TEXTPOOL program: INTO text1 LANGUAGE langu1,
INTO text2 LANGUAGE langu2.
LOOP AT text1 INTO wa1.
CLEAR wa2.
READ TABLE text2 INTO wa2
WITH TABLE KEY id = wa1-id
key = wa1-key.
source = wa1-entry.
target = wa2-entry.
CALL SELECTION-SCREEN 500 STARTING AT 1 1.
IF sy-subrc = 0.
IF target IS NOT INITIAL.
wa2-id = wa1-id.
wa2-key = wa1-key.
wa2-entry = target.
wa2-length = wa1-length.
DELETE TABLE text2
WITH TABLE KEY id = wa1-id
key = wa1-key.
INSERT wa2 INTO TABLE text2.
ENDIF.
ELSE.
EXIT.
ENDIF.
ENDLOOP.
INSERT TEXTPOOL program FROM text2 LANGUAGE langu2.
ABAP Short Reference CL_GUI_FRONTEND_SERVICES - Frontend Services
This documentation is copyright by SAP AG.
Length: 7374 Date: 20120522 Time: 233911 triton ( 174 ms )






