SAP Help Information and source code of how to add, change and delete entries of a textpool for a specific ABAP program









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.