ABAP READ_TEXT functions to read the SAP Long Text

All the long text can be retrieve using this method.

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 'READ_TEXT'
       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.
 

What is the purpose of READ_TEXT functuion module and how to get text id value in this scenario(TDID)?

In business process, there are so many transactions that take place in every day, like purchase orders, sales orders, delivery, gooodsmovement etc...  SAP provided a feature to maintain some text descriptions.

Read_Text Function module is used to retrieve the text for a particular objects. 
To find the Text id these are the following steps.  Let us take an example of Billing document Header text. 
1. goto VF03, enter Billing doc Number 
2. from menu--select Goto-->Header-->header Text..... New window will be displayed 
3. select the Header Text. here you can see all the text. 
4. click on the TEXT (which you want to know the Text id) , then press log ICON (you can find in bottom right of the text window) it looks like a rolled paper. 
5. in the Next window you will find Text Name. Text ID, Language. etc...

More Function Module
Functions / SAP Script / ALV

Tables
Database Table

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.