SAP Function Modules

READ_TEXT SAP Function module - SAPscript: Read text







READ_TEXT is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name READ_TEXT into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: STXD
Released Date: 16.01.1995
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM READ_TEXT - READ TEXT





CALL FUNCTION 'READ_TEXT' "SAPscript: Read text
  EXPORTING
*   client = SY-MANDT           " sy-mandt      Client
    id =                        " thead-tdid    Text ID of text to be read
    id =                        " thead-tdid    Text ID invalid
    language =                  " thead-tdspras  Language of text to be read
    language =                  " thead-tdspras  Invalid language
    name =                      " thead-tdname  Name of text to be read
    name =                      " thead-tdname  Invalid text name
    object =                    " thead-tdobject  Object of text to be read
    object =                    " thead-tdobject  Invalid text object
*   archive_handle = 0          " sy-tabix      Archive Handle
*   local_cat = SPACE           "               Text catalog local
  IMPORTING
    header =                    " thead         Text header of text read
    old_line_counter =          " thead-tdtxtlines  Original Number of Text Lines
  TABLES
    lines =                     " tline         Lines of text read
  EXCEPTIONS
    ID = 1                      "               Text ID of text to be read
    ID = 1                      "               Text ID invalid
    LANGUAGE = 2                "               Language of text to be read
    LANGUAGE = 2                "               Invalid language
    NAME = 3                    "               Invalid text name
    NAME = 3                    "               Name of text to be read
    NOT_FOUND = 4               "               Text not found
    OBJECT = 5                  "               Invalid text object
    OBJECT = 5                  "               Object of text to be read
    REFERENCE_CHECK = 6         "               Reference chain interrupted
    WRONG_ACCESS_TO_ARCHIVE = 7  "              Archive handle invalid for access
    .  "  READ_TEXT

ABAP code example for Function Module READ_TEXT





The ABAP code below is a full code listing to execute function module READ_TEXT including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_header  TYPE THEAD ,
ld_old_line_counter  TYPE THEAD-TDTXTLINES ,
it_lines  TYPE STANDARD TABLE OF TLINE,"TABLES PARAM
wa_lines  LIKE LINE OF it_lines .

DATA(ld_client) = 'Check type of data required'.

DATA(ld_id) = some text here

DATA(ld_id) = some text here

DATA(ld_language) = Check type of data required

DATA(ld_language) = Check type of data required

DATA(ld_name) = some text here

DATA(ld_name) = some text here

DATA(ld_object) = some text here

DATA(ld_object) = some text here
DATA(ld_archive_handle) = '123 '.
DATA(ld_local_cat) = 'some text here'.

"populate fields of struture and append to itab
append wa_lines to it_lines. . CALL FUNCTION 'READ_TEXT' EXPORTING * client = ld_client id = ld_id id = ld_id language = ld_language language = ld_language name = ld_name name = ld_name object = ld_object object = ld_object * archive_handle = ld_archive_handle * local_cat = ld_local_cat IMPORTING header = ld_header old_line_counter = ld_old_line_counter TABLES lines = it_lines EXCEPTIONS ID = 1 ID = 1 LANGUAGE = 2 LANGUAGE = 2 NAME = 3 NAME = 3 NOT_FOUND = 4 OBJECT = 5 OBJECT = 5 REFERENCE_CHECK = 6 WRONG_ACCESS_TO_ARCHIVE = 7 . " READ_TEXT
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_header  TYPE THEAD ,
ld_client  TYPE SY-MANDT ,
it_lines  TYPE STANDARD TABLE OF TLINE ,
wa_lines  LIKE LINE OF it_lines,
ld_old_line_counter  TYPE THEAD-TDTXTLINES ,
ld_id  TYPE THEAD-TDID ,
ld_id  TYPE THEAD-TDID ,
ld_language  TYPE THEAD-TDSPRAS ,
ld_language  TYPE THEAD-TDSPRAS ,
ld_name  TYPE THEAD-TDNAME ,
ld_name  TYPE THEAD-TDNAME ,
ld_object  TYPE THEAD-TDOBJECT ,
ld_object  TYPE THEAD-TDOBJECT ,
ld_archive_handle  TYPE SY-TABIX ,
ld_local_cat  TYPE STRING .

ld_client = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_lines to it_lines.

ld_id = some text here

ld_id = some text here

ld_language = Check type of data required

ld_language = Check type of data required

ld_name = some text here

ld_name = some text here

ld_object = some text here

ld_object = some text here
ld_archive_handle = '123 '.
ld_local_cat = 'some text here'.

SAP Documentation for FM READ_TEXT


INCLUDE STXD_PF_READ_TEXT OBJECT DOKU ID TX
















Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name READ_TEXT or its description.