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: 

problem in read_text fm

Former Member
0 Kudos

Hi,

iam having one problem if i call read_text fm

only one line is coming in the output.

eg: material(Text)

plant (Text)

my progaram write only one line ie. material i want to consider f all the line in single line.

opt should be: materialplant.

please correct this code

loop at t_mara.

*CONCATENATE t_mara-matnr t_mara-dwerks INTO TeMP IN CHARACTER MODE.

temp = t_mara-matnr .

temp+19(4) = t_mara-dwerks .

WRK_NAME = temp.

*WRITE: / temp..

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = 'LTXT'

LANGUAGE = SY-LANGU

NAME = WRK_NAME

OBJECT = 'MDTXT'

  • IMPORTING

  • HEADER =

TABLES

LINES = IT_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS .

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

else.

READ TABLE IT_LINES INDEX 1.

TXT_TD03 = IT_LINES-TDLINE.

MOVE TXT_TD03 TO T_MARA-TEXT.

MODIFY T_MARA.

ENDIF.

1 REPLY 1

Former Member
0 Kudos

see the logic for below program and concatenate within loop.

REPORT zread_test.

DATA: it_lines LIKE TABLE OF tline WITH HEADER LINE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = 'LTXT'

language = sy-langu

name = '000001100184'

object ='AUFK'

  • IMPORTING

  • HEADER =

TABLES

lines = it_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.

Data: mystring type string.

LOOP AT it_lines.

concatenate mystring it_lines-tdline into mystring

separated by space.

ENDLOOP.

Reward Points if it is helpful

Thanks

seshu