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

Former Member
0 Kudos

Hi guys,

Pls explain me the use of 'read_text' function module & also tell how to use it?

Its urgent

Regards,

Rohan

7 REPLIES 7

Former Member
0 Kudos

Hi,

You can use READ_TEXT function module to read the texts like standard texts, i.e. multiple lines stored in SO10 transaction.

You need to pass the SO10 key to the function module.

You can do a where used and find a number of programs using this. Check program RSTXSITF.

Example code:

CALL FUNCTION 'READ_TEXT'
  EXPORTING ID       = ID
            LANGUAGE = SPRAS
            NAME     = NAME
            OBJECT   = OBJECT
  IMPORTING HEADER   = TXHEAD
  TABLES    LINES    = TXLINES
  EXCEPTIONS ID = 1
             LANGUAGE = 2
             NAME = 3
             OBJECT = 4
             NOT_FOUND = 5
             OTHERS = 6.

Cheers.

Former Member
0 Kudos

Rohan,

Read_Text FM will be useful to read the Long texts stored in the system, for example if you take Sales Order Text or Prod Order Text, in some cases you need to dispaly in SAP Script / send to some other systems, in such cases we will use READ_TEXT FM to read this based on object number.

Check this also.

http://help.sap.com/saphelp_nw04/helpdata/en/d6/0db764494511d182b70000e829fbfe/frameset.htm

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).

Former Member
0 Kudos

hi,

Use FM READ_TEXT to Read the Various Text

not only in sale order, any document in SAP.

See the following sample code.

data xname like THEAD-TDNAME.

data i_xtline like tline.

clear i_xtline.

refresh i_xtline.

move i_vbak-vbeln to XNAME.

  • The NAME & OBJECT differ from object to object. The composition of NAME and OBJECT can be found out in the text screen in the document.

Double click into the Text field

At the Top Menu - Click - Goto - Header

  • XNAME refers to Text name

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = '0001'

LANGUAGE = 'E'

NAME = XNAME

OBJECT = 'VBBP'

TABLES

LINES = i_XTLINE

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6.

If it is smartform or script you can include the text object directly with out using READ_TEXT FM.

reward points if usefull.

regards,

pavan t

Former Member
0 Kudos

Hi,

The READ_TEXT fuction module is used to read data from the text file and move it to the work area/ internal table.. You can pass the filename, language, id , object and the destination table to the FM.

Hope this helps.

Regards,

Ramya

Former Member
0 Kudos

Hi,

The Fm 'READ_TEXT' is used to get the details about a Purchase document number.

For example, the Details like the Employee's( to whom the PO number is assigned) nationality, the Organization code, the base salary, the work location, the job grade code, job title will be returned ny this FM.

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.

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

See the following code...

Data : wf_oldpo type THEAD-TDNAME,

fs_readhead type THEAD,

int_line1 type table of TLINE with header line,

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = sy-mandt

id = 'F01'

language = sy-langu

name = wf_oldpo " 6360003191

object = 'EKKO'

ARCHIVE_HANDLE = 0

IMPORTING

HEADER = fs_readhead

tables

lines = int_line1

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

All the details will be there in int_line1 and u can this for copying to new PO number.

Hope this helps u..

Reward points if useful

Regards,

Shanthi.

Former Member
0 Kudos

HI,

this fm is to get the standard text or system text or application text which are stored in the memory area by tcode.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'RMEL'

language = 'E'

name = tdname

object = 'AUFK'

TABLES

lines = line1

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

Former Member
0 Kudos

hi

hope it will help you

Reward if help.

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).