SAP RETRIEVAL_TEXT Function Module for SAPscript: Text retrieval with or without user dialog









RETRIEVAL_TEXT is a standard retrieval text SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for SAPscript: Text retrieval with or without user dialog processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for retrieval text FM, simply by entering the name RETRIEVAL_TEXT into the relevant SAP transaction such as SE37 or SE38.

Function Group: STXD
Program Name: SAPLSTXD
Main Program: SAPLSTXD
Appliation area:
Release date: 15-Apr-1999
Mode(Normal, Remote etc): Normal Function Module
Update:



Function RETRIEVAL_TEXT pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'RETRIEVAL_TEXT'"SAPscript: Text retrieval with or without user dialog
EXPORTING
* NAME = ' ' "
* ID = 'ST' "Text ID; not generic!
* LANGUAGE = SY-LANGU "Text language, generic entry with '*' possible
* SELECTION_SCREEN = 'X' "'X' with user dialog, ' ' without user dialog
* TEXTTYPE = '*' "Text type (*=all, space=ITF, RTF=RTF,...)
* SHORT_SELECTION = ' ' "

IMPORTING
HEADER = "Text header when selecting a text

EXCEPTIONS
CANCELED = 1 RETRIEVAL_ERROR = 2 INVALID_ID = 3 INVALID_LANGUAGE = 4
.



IMPORTING Parameters details for RETRIEVAL_TEXT

NAME -

Data type: THEAD-TDNAME
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

ID - Text ID; not generic!

Data type: THEAD-TDID
Default: 'ST'
Optional: Yes
Call by Reference: No ( called with pass by value option)

LANGUAGE - Text language, generic entry with '*' possible

Data type: THEAD-TDSPRAS
Default: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)

SELECTION_SCREEN - 'X' with user dialog, ' ' without user dialog

Data type:
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

TEXTTYPE - Text type (*=all, space=ITF, RTF=RTF,...)

Data type: THEAD-TDTEXTTYPE
Default: '*'
Optional: Yes
Call by Reference: No ( called with pass by value option)

SHORT_SELECTION -

Data type:
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for RETRIEVAL_TEXT

HEADER - Text header when selecting a text

Data type: THEAD
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

CANCELED - No selection made

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

RETRIEVAL_ERROR -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

INVALID_ID - No text ID available for name entered

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

INVALID_LANGUAGE - Language: initial or not available

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for RETRIEVAL_TEXT Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lv_name  TYPE THEAD-TDNAME, "   SPACE
lv_header  TYPE THEAD, "   
lv_canceled  TYPE THEAD, "   
lv_id  TYPE THEAD-TDID, "   'ST'
lv_retrieval_error  TYPE THEAD, "   
lv_language  TYPE THEAD-TDSPRAS, "   SY-LANGU
lv_invalid_id  TYPE THEAD, "   
lv_invalid_language  TYPE THEAD, "   
lv_selection_screen  TYPE THEAD, "   'X'
lv_texttype  TYPE THEAD-TDTEXTTYPE, "   '*'
lv_short_selection  TYPE THEAD. "   SPACE

  CALL FUNCTION 'RETRIEVAL_TEXT'  "SAPscript: Text retrieval with or without user dialog
    EXPORTING
         NAME = lv_name
         ID = lv_id
         LANGUAGE = lv_language
         SELECTION_SCREEN = lv_selection_screen
         TEXTTYPE = lv_texttype
         SHORT_SELECTION = lv_short_selection
    IMPORTING
         HEADER = lv_header
    EXCEPTIONS
        CANCELED = 1
        RETRIEVAL_ERROR = 2
        INVALID_ID = 3
        INVALID_LANGUAGE = 4
. " RETRIEVAL_TEXT




ABAP code using 7.40 inline data declarations to call FM RETRIEVAL_TEXT

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

"SELECT single TDNAME FROM THEAD INTO @DATA(ld_name).
DATA(ld_name) = ' '.
 
 
 
"SELECT single TDID FROM THEAD INTO @DATA(ld_id).
DATA(ld_id) = 'ST'.
 
 
"SELECT single TDSPRAS FROM THEAD INTO @DATA(ld_language).
DATA(ld_language) = SY-LANGU.
 
 
 
DATA(ld_selection_screen) = 'X'.
 
"SELECT single TDTEXTTYPE FROM THEAD INTO @DATA(ld_texttype).
DATA(ld_texttype) = '*'.
 
DATA(ld_short_selection) = ' '.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!