READ TEXTPOOL, ABAP code to manipulate program textpools



From within ABAP you are able to manipulate a programs textpool(text elements). See code below to see how to read, delete and add new entries to a textpool.


*Data declaration for textpool manipulation
DATA: PROGRAM(30) VALUE 'ZTESTPROG',
      TAB LIKE TEXTPOOL OCCURS 50 WITH HEADER LINE.

*Read textpool
READ TEXTPOOL PROGRAM INTO TAB LANGUAGE SY-LANGU state 'A'.
*Delete textpool
DELETE TEXTPOOL program LANGUAGE 'E'.
*Add entry to text pool
READ TEXTPOOL PROGRAM INTO TAB LANGUAGE SY-LANGU state 'A'.
DELETE TEXTPOOL program LANGUAGE 'E'.
TAB-ID = 'S'. TAB-KEY = 'DATYP'.  TAB-ENTRY = 'Date Type'.
APPEND TAB.
SORT TAB BY ID KEY.
INSERT TEXTPOOL PROGRAM FROM TAB LANGUAGE SY-LANGU.

Related Articles

Create internal table structure dynamically
Dynamic Program Manipulation - Information on various ways to manipulate programs dynamically
Execute ABAP code from text file using ABAP READ INSERT to create program dynamically