Application Development and Automation 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 only

READ_TEXT

Former Member
0 Likes
832

can anyone guide me whether the coding tht i have specified below s correct because im getting error like Text ID 0002 language EN not found

DATA: OLINO TYPE THEAD-TDNAME.

OLINO = IT_ITEMS-AUFNR + it_items-buzei.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = '0002'

LANGUAGE = SY-LANGU

NAME = OLINO

OBJECT = 'VBBP'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = IT_ITEMS

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

8 REPLIES 8
Read only

Former Member
0 Likes
784

Refer this 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.

<a href="http://www.sapdevelopment.co.uk/sapscript/sapscript_texts.htm" TARGET="test_blank">http://www.sapdevelopment.co.uk/sapscript/sapscript_texts.htm</a>
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.

Read only

Former Member
0 Likes
784

Hello,

U need to concatenate the OLINO value like.

<b>COncatenate IT_ITEMS-AUFNR it_tems-buzei into OLINO.</b>

Hope this will solve ur problem,

If useful reward.

Vasanth

Read only

Former Member
0 Likes
784

<b>go to header text , double click on the text

and select goto---> header there u can see textid , name , language.

check whether the language for '0002' is en or not</b>

check this,

DATA: IT_TEXTS like T_LINE occurs o with header line.

DATA: BEGIN OF thead.

INCLUDE STRUCTURE thead.

DATA: END OF thead.

DATA: lv_objname(14).

CONCATENATE itab-belnr itab-gjahr INTO v_objname.

thead-tdid = '0001'.

thead-tdspras = 'TR'. <b>" Language , keep sy-langu </b>

thead-tdname = v_objname.

thead-tdobject = 'RBKP'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

id = thead-tdid

language = thead-tdspras

name = thead-tdname

object = thead-tdobject

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

Read only

0 Likes
784

hi sreekhant

how do i go to header text

Read only

0 Likes
784

<b>can u tell Transaction code , because going to header text is different for different tcodes</b>

Read only

0 Likes
784

fbl5n

Read only

Former Member
0 Likes
784

Hi,

First u should check the Long text exist or not in the Table <b>STXH.</b>. Then

Check the SY-SUBRC. If sy-subrc = 0.

<b>Concatenate IT_ITEMS-AUFNR it_items-buzei into OLINO</b> instead of <b>OLINO = IT_ITEMS-AUFNR + it_items-buzei..</b>.

Regards,

Balavardhan.K

Read only

Former Member
0 Likes
784

HI ALL I GOT THE SOLUTION FOR THAT

NOW S N THT FUNCITON MODULE I HAVE PASSED IT_LINES AS A PARAMETER TO TABLES(LINES)

HOW THS VALUE WILL BE DISPLAYED IN THE ALV REPORT