Sample ABAP program to show how to search in Layout sets for a given string.
REPORT Ysearchl LINE-SIZE 132.
************************************************************************
*
* Program : Ysearchl
* Authors : Chris Harrop (chris.harrop@bigfoot.com)
* Date : March 1999
* Purpose : Searches all Y and Z layout sets for a given string
*
************************************************************************
*
* maintenance history
*
* date author purpose
*
************************************************************************
TABLES: STXL.
PARAMETERS:
STRING(128).
DATA: BEGIN OF TLINETAB OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF TLINETAB,
SUBRC LIKE SY-SUBRC.
SELECT TDNAME FROM STXL INTO (STXL-TDNAME)
WHERE TDOBJECT = ‘FORM’ AND ( TDNAME LIKE ‘Y%’ OR TDNAME LIKE ‘Z%’ )
AND TDID = ‘TXT’.
PERFORM DISPLAY_STATUS_TEXT USING STXL-TDNAME.
REFRESH TLINETAB.
PERFORM GET_TEXT_TABLE
TABLES TLINETAB
USING ‘FORM’ ‘TXT’ STXL-TDNAME
CHANGING SUBRC.
LOOP AT TLINETAB.
IF TLINETAB-TDLINE CS STRING.
WRITE : / STXL-TDNAME, TLINETAB-TDLINE.
ENDIF.
ENDLOOP.
ENDSELECT.
* Display a message on the status bar
FORM DISPLAY_STATUS_TEXT USING VALUE(TEXT) TYPE C.
CALL FUNCTION ‘SAPGUI_PROGRESS_INDICATOR’
EXPORTING
TEXT = TEXT.
ENDFORM.
*
* Get the long texts for the object
*
FORM GET_TEXT_TABLE TABLES TLINETAB
USING VALUE(TDOBJECT) LIKE THEAD-TDOBJECT
VALUE(ID) LIKE THEAD-TDID
VALUE(TDNAME) LIKE THEAD-TDNAME
CHANGING SUBRC LIKE SY-SUBRC.
DATA: BEGIN OF XTHEAD OCCURS 0.
INCLUDE STRUCTURE THEAD.
DATA: END OF XTHEAD.
DATA: EINTRAEGE LIKE SY-TFILL.
DATA XTDNAME LIKE THEAD-TDNAME.
REFRESH XTHEAD.
CLEAR XTDNAME.
XTDNAME = TDNAME.
CALL FUNCTION ‘SELECT_TEXT’
EXPORTING
ID = ID
LANGUAGE = SY-LANGU
NAME = TDNAME
OBJECT = TDOBJECT
IMPORTING
ENTRIES = EINTRAEGE
TABLES
SELECTIONS = XTHEAD.
REFRESH TLINETAB.
CALL FUNCTION ‘READ_TEXT’
EXPORTING
ID = ID
LANGUAGE = SY-LANGU
NAME = TDNAME
OBJECT = TDOBJECT
IMPORTING
HEADER = XTHEAD
TABLES
LINES = TLINETAB
EXCEPTIONS
ID = 01
LANGUAGE = 02
NAME = 03
NOT_FOUND = 04
OBJECT = 05
REFERENCE_CHECK = 06.
SUBRC = SY-SUBRC.
ENDFORM. ” FILL_ITEM_TEXT