cancel
Showing results for 
Search instead for 
Did you mean: 

FM READ_TEXT

Former Member
0 Kudos

Hi frenz,

I want to know the use of function module 'READ_TEXT' and way to use that.

Prompt answers will be rewared with points.

With regards,

praveen.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

See this sample code

ABAP READ_TEXT functions to read the SAP Long Text

You have to used the READ_TEXT functions to read the SAP long text. e.g. Sales Order, Purchase Order Item text etc.

To check your long text header, go into the long text. Click Goto -> Header

Example of READ_TEXT functions reading tables PBIM - Independent requirements for material.


REPORT ZTEXT . 

TABLES: PBIM. 

* stxh, stxl, stxb - trans tables for text 
* ttxit - text on text-ids 
* ttxot - Short texts on text objects 
* Transaction MD63 
SELECT-OPTIONS: S_MATNR FOR PBIM-MATNR, 
                S_WERKS FOR PBIM-WERKS. 

DATA: BEGIN OF HTEXT. 
        INCLUDE STRUCTURE THEAD. 
DATA: END OF HTEXT. 

DATA: BEGIN OF LTEXT OCCURS 50. 
        INCLUDE STRUCTURE TLINE. 
DATA: END OF LTEXT. 

DATA: BEGIN OF DTEXT OCCURS 50. 
DATA:   MATNR LIKE PBIM-MATNR. 
        INCLUDE STRUCTURE TLINE. 
DATA: END OF DTEXT. 

DATA: TNAME LIKE THEAD-TDNAME. 

SELECT * FROM PBIM WHERE WERKS IN S_WERKS. 
  MOVE PBIM-BDZEI TO TNAME. 
  CALL FUNCTION <b>'READ_TEXT'</b> 
       EXPORTING 
*           CLIENT                  = SY-MANDT 
          ID                      = 'PB' 
          LANGUAGE                = 'E' 
          NAME                    = TNAME 
          OBJECT                  = 'PBPT' 
*         ARCHIVE_HANDLE          = 0 
     IMPORTING 
          HEADER                  = HTEXT 
     TABLES 
          LINES                   = LTEXT 
     EXCEPTIONS 
          ID                      = 1 
          LANGUAGE                = 2 
          NAME                    = 3 
          NOT_FOUND               = 4 
          OBJECT                  = 5 
          REFERENCE_CHECK         = 6 
          WRONG_ACCESS_TO_ARCHIVE = 7 
          OTHERS                  = 8. 
  LOOP AT LTEXT. 
    IF LTEXT-TDLINE NE ''. 
      MOVE LTEXT-TDLINE TO DTEXT-TDLINE. 
      MOVE PBIM-MATNR TO DTEXT-MATNR. 
      APPEND DTEXT. 
    ENDIF. 
  ENDLOOP. 
ENDSELECT. 
LOOP AT DTEXT. 
  WRITE:/ DTEXT-MATNR, DTEXT-TDLINE. 
ENDLOOP.

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

Also

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

Hope this helps.

Answers (2)

Answers (2)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

READ_TEXT is used to read the "sapscript" text which is stored in transaction SE75 and SO10. You have standard text which is in SO10 and Text objects which is configured via SE75. For example, everywhere you see "long text" in a text editor on a screen, chances are that it is stored as a text object and can be pulled into your programs via the READ_TEXT function module.

Regards,

Rich Heilman

Former Member
0 Kudos

Hello,

FU READ_TEXT

____________________________________________________

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.

Parameter

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

This is from teh function module documentation. The rest people have explained in detail.

Regards,

Shekhar

Former Member
0 Kudos

useful for read any SAP long text.

To get the input parameters :

Go to the long text in plain page mode and then : GoTo --> Header.

A pop up opens with paramters :

Text ID

Language

Text name

Text object

Hope it helps,

Regards,

Erwan.