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: 

How to read text of 255 chracters long using FM Read_TEXT

Former Member
0 Kudos

Hi Friends,

Iam reading a text from the sales order,the text is of lenght 260 characters long.

i used FM READ_TEXT, But the FM is only reading upto 132 charcters only( because tline-tdline is of only 132 characters long)

MY Code is

DATA: l_comment TYPE STANDARD TABLE OF tline.

DATA: wa_comment TYPE tline.

l_vbeln = wa_vbak-vbeln.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = 'Z150'

language = sy-langu

name = l_vbeln

object = 'VBBK'

TABLES

lines = l_comment

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

DATA : l_text(900) TYPE c,

l_len TYPE i.

LOOP AT l_comment INTO wa_comment

WHERE NOT tdline IS initial.

CONCATENATE l_text wa_comment-tdline INTO l_text SEPARATED BY ' '.

ENDLOOP.

Please help me regarding this.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Srinivas,

<b>All the long text can be retrieve using this method.</b>

You have to used the<b> READ_TEXT</b> 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.

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

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

<b>Reward pts if found usefull :)</b>

Regards

Sathish

1 REPLY 1

Former Member
0 Kudos

Hi Srinivas,

<b>All the long text can be retrieve using this method.</b>

You have to used the<b> READ_TEXT</b> 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.

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

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

<b>Reward pts if found usefull :)</b>

Regards

Sathish