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: 

Import and Export Parameters READ_TEXT

Former Member
0 Kudos

Hi ALL

I have to read Standard Text through this Function Module and populate that Standard Text into an Internal Table. Kindly let me know about the Import and Export parameterto do this. Also pls let me know a way to accomplish this

Thanks

7 REPLIES 7

Former Member
0 Kudos

Check out this one

  CALL FUNCTION 'READ_TEXT'
       EXPORTING
            CLIENT                  = SY-MANDT
            ID                      = ITAB_THEAD-TDID
            LANGUAGE                = CNS_SPRAS
            NAME                    = ITAB_THEAD-TDNAME
            OBJECT                  = ITAB_THEAD-TDOBJECT
            ARCHIVE_HANDLE          = 0
*           LOCAL_CAT               = ' '
*      IMPORTING
*           HEADER                  =
       TABLES
            LINES                   = ITAB_TLINE
       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.

Former Member
0 Kudos

chk this thread

0 Kudos

HI Thanks for all the Ideas

But pricesly What I want to know is this

what will be the parameter values and how do we pass it.

0 Kudos

Hi Harsh,

i'm not quite sure what you want?

Is it this?:

Look in my short example. I comment to look at STXH

with 'TEXT'. Than you get the parameters you need.

Regards, Dieter

Former Member
0 Kudos

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.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Former Member
0 Kudos

Hi,

try this example:

REPORT ZGRO_TEST.

*

DATA: BEGIN OF TEXT OCCURS 10.

INCLUDE STRUCTURE TLINE.

DATA: END OF TEXT.

*

START-OF-SELECTION.

*

  • Look at table STXH to the Parameters!!

  • Standard-Text (SO10) have the OBJECT 'TEXT'

CALL FUNCTION 'READ_TEXT'

EXPORTING

ID = 'PALT'

LANGUAGE = SY-LANGU

NAME = 'INVITATION'

OBJECT = 'TEXT'

TABLES

LINES = TEXT

EXCEPTIONS

NOT_FOUND = 1.

*

IF SY-SUBRC = 0.

LOOP AT TEXT. WRITE: / TEXT-TDLINE. ENDLOOP.

ELSE.

WRITE: / SY-SUBRC.

ENDIF.

*

END-OF-SELECTION.

Regards, Dieter

Former Member
0 Kudos

What text are u reading and from which transaction.

The following are the main parameters,

ID:

this is text id(U can find it in ur transaction,generally it will start with z)

LANGUAGE:

This depends on the language in which the text is maintained.For example En(english)

NAME:

No for which the text id is maintained,it may be deliver no or transport no.Depends on ur case.

OBJECT:

This represents mostly wether it is header data or item data respectively.so u can check this in ur transaction.

A short example as follows,

FORM read_text1 TABLES g_t_lines STRUCTURE tline

USING p_var TYPE c

p_obj TYPE c.

READ TABLE xvttp INDEX 1.

g_f_tdname1 = xvttp-vbeln.

g_f_obj1 = p_obj.

g_f_langu1 = 'DE'.

REFRESH g_t_lines.

CLEAR g_t_lines.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = p_var

language = g_f_langu1

name = g_f_tdname1

object = g_f_obj1

TABLES

lines = g_t_lines

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.

endform.

Check this and let me know if u face any problenm.

Regards