Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

READ_TEXT - Function module

Former Member
0 Kudos

Hi experts,

What is the purpose of READ_TEXT function module and give me import and export information.

Thank u.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

This FM is used to read the text of the standard text.

Check this sample.



      L_OBJECT = 'TEXT'.
      L_ID     = 'ST'.
      L_LANGU  = G_T_EKKO-SPRAS.
      CALL FUNCTION 'READ_TEXT'
           EXPORTING
                CLIENT   = SY-MANDT
                ID       = L_ID
                LANGUAGE = L_LANGU
                NAME     = L_NAME
                OBJECT   = L_OBJECT
           TABLES
                LINES    = L_TLINE.
Loop at L_TLINe.
write: l_tline.
endloop.

Vasanth

8 REPLIES 8

Former Member
0 Kudos

Short Text

SAPscript: Read text

In order to process text modules in application programs, all information about a text module must be transferred to internal work areas.

A text is read from the text file or text memory with this function module. It must be described fully by specifying OBJECT, NAME, ID, and LANGUAGE. Generic entries in these parameters are not valid.

When header information and text lines have been read successfully, they are transferred to the work areas HEADER and LINES.

Parameters

CLIENT

ID

LANGUAGE

NAME

OBJECT

ARCHIVE_HANDLE

LOCAL_CAT

HEADER

LINES

Exceptions

ID

LANGUAGE

NAME

NOT_FOUND

OBJECT

REFERENCE_CHECK

WRONG_ACCESS_TO_ARCHIVE

Function Group

STXD

Regards,

Pavan

0 Kudos

hi Pavan Pachimatla / Anji ,

can i read text information of a delivery line item using this function module.

If it is possible pls tell me the procedure ....?

Thanks.

Message was edited by:

Murugan Arumugam

Former Member
0 Kudos

Hi

It is used to fetch the Long Text details or

Header and Items texts of a application document

READ_TEXT

READ_TEXT provides a text for the application program in the specified work areas.

The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.

After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.

If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.

Function call:

CALL FUNCTION 'READ_TEXT'

EXPORTING CLIENT = SY-MANDT

OBJECT = ?...

NAME = ?...

ID = ?...

LANGUAGE = ?...

ARCHIVE_HANDLE = 0

IMPORTING HEADER =

TABLES LINES = ?...

EXCEPTIONS ID =

LANGUAGE =

NAME =

NOT_FOUND =

OBJECT =

REFERENCE_CHECK =

WRONG_ACCESS_TO_ARCHIVE =

Export parameters:

CLIENT

Specify the client under which the text is stored. If you omit this parameter, the system uses the current client as default.

Reference field: SY-MANDT

Default value: SY-MANDT

OBJECT

Enter the name of the text object to which the text is allocated. Table TTXOB contains the valid objects.

Reference field: THEAD-TDOBJECT

NAME

Enter the name of the text module. The name may be up to 70 characters long. Its internal structure depends on the text object used.

Reference field: THEAD-TDNAME

ID

Enter the text ID of the text module. Table TTXID contains the valid text IDs, depending on the text object.

Reference field: THEAD-TDID

LANGUAGE

Enter the language key of the text module. The system accepts only languages that are defined in table T002.

Reference field: THEAD-TDSPRAS

ARCHIVE_HANDLE

If you want to read the text from the archive, you must enter a handle here. The system uses it to access the archive. You can create the handle using the function module ACHIVE_OPEN_FOR_READ.

The value '0' indicates that you do not want to read the text from the archive.

Reference field: SY-TABIX

Default value: 0

Import parameters:

HEADER

If the system finds the desired text, it returns the text header in this parameter.

Structure: THEAD

Table parameters:

LINES

The table contains all text lines that belong to the text read.

Structure: TLINE

Exceptions:

ID

The text ID specified in the parameter ID does not exist in table TTXID. It must be defined there together with the object of the text module.

LANGUAGE

The parameter LANGUAGE contains a language key that does not exist in table T002.

NAME

The parameter NAME contains the name of a text module that does not correspond to the SAPscript conventions.

Possible errors:

The field contains only blanks.

The field contains the invalid characters ‘*’ or ‘,’.

OBJECT

The parameter OBJECT contains the name of a text object that does not exist in table TTXOB.

NOT_FOUND

The system did not find the specified text module.

REFERENCE_CHECK

The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists.

WRONG_ACCESS_ TO_ARCHIVE

The exception WRONG_ACCESS_TO_ARCHIVE is triggered if an archive is accessed using an incorrect or non-existing archive handle or an incorrect mode (that is, read if the archive is open for writing or vice versa).

<b>Reward points for useful Answers</b>

Regards

Anji

former_member196280
Active Contributor
0 Kudos

It is used mainly to read the header texts & long texts..

Ex:

DATA BEGIN OF i_tlines_r OCCURS 0.

INCLUDE STRUCTURE tline.

DATA END OF i_tlines_r.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'Z040'

LANGUAGE = 'E'

NAME = '0000003243' "For ex, Billing document number ,

OBJECT = 'VBBK'

TABLES

LINES = i_tlines_r

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

Reward points to all useful answers.

Regards,

SaIRam

Former Member
0 Kudos

Hello,

This FM is used to read the text of the standard text.

Check this sample.



      L_OBJECT = 'TEXT'.
      L_ID     = 'ST'.
      L_LANGU  = G_T_EKKO-SPRAS.
      CALL FUNCTION 'READ_TEXT'
           EXPORTING
                CLIENT   = SY-MANDT
                ID       = L_ID
                LANGUAGE = L_LANGU
                NAME     = L_NAME
                OBJECT   = L_OBJECT
           TABLES
                LINES    = L_TLINE.
Loop at L_TLINe.
write: l_tline.
endloop.

Vasanth

Former Member
0 Kudos

for any documentation on FM's go through.

http://www.se37.com/

regards,

srinivas

<b>*reward for useful answers*</b>

jaideeps
Advisor
Advisor
0 Kudos

hi,

The following code shows the syntax of the FM 'READ_TEXT'. You pass it the Text Identification Details

and it will retrieve the texts into the internal table (IT_TEXTS).

*Internal table to store standard texts

DATA: IT_TEXTS like T_LINE occurs o with header line.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = "Text ID

language = "Laguage

name = "Text name

object = "text object

  • ARCHIVE_HANDLE = 0

  • IMPORTING

  • HEADER =

tables

lines = IT_TEXTS "Internal table

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

http://www.sapdevelopment.co.uk/fmodules/fms_readtext.htm

http://www.sapdevelopment.co.uk/sapscript/sapscript_texts.htm

thanks

jaideep

*reward points if useful..

Former Member
0 Kudos

Thank u all. I got solution.