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

problem in read_text function

Former Member
0 Likes
881

Hi all,

I want to read multiple rows by read_text functions but it shows me single row only.

Plz help me how to read multiple rows ..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
831

I have used read_text to read multiple lines without any issues, what problem u r facing, wud be better if u show the code.

I did like this used the FM then loop at the itab ahving the text.



data: v_str type char255. "or even more as u want.
loop at it_tline into wa.

concatenate v_str wa-tdline into v_str.
endloop.

кu03B1ятu03B9к

7 REPLIES 7
Read only

Former Member
0 Likes
832

I have used read_text to read multiple lines without any issues, what problem u r facing, wud be better if u show the code.

I did like this used the FM then loop at the itab ahving the text.



data: v_str type char255. "or even more as u want.
loop at it_tline into wa.

concatenate v_str wa-tdline into v_str.
endloop.

кu03B1ятu03B9к

Read only

0 Likes
831

Hi kartik,

my code is like :

data : begin of itab occurs 0,

NO_OF_BOX TYPE TLINE-TDLINE,

end of itab.

data: name type THEAD-TDNAME.

DATA lt_text TYPE tline occurs 0 with header line.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = 'B01'

language = sy-langu

name = name

object = 'EBAN'

TABLES

lines = lt_text.

loop at lt_text.

MOVE lt_text-TDLINE TO i_TAB-NO_OF_BOX.

IF NOT I_TAB-NO_OF_BOX IS INITIAL.

exit.

ENDIF.

endloop.

MODIFY I_TAB.

ENDLOOP.

Please Help me

Read only

0 Likes
831

hi ankita please clarify the following points.


data : begin of itab occurs 0,
NO_OF_BOX TYPE TLINE-TDLINE,
end of itab.

data: name type THEAD-TDNAME.

DATA lt_text TYPE tline occurs 0 with header line.

CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'B01'
language = sy-langu
name = name
object = 'EBAN'
TABLES
lines = lt_text.

loop at lt_text.
MOVE lt_text-TDLINE TO i_TAB-NO_OF_BOX.

IF NOT I_TAB-NO_OF_BOX IS INITIAL. " i think problem lies in this condition as soon as first line is read the condition becomes true and exits the loop. so re-think about this condtion

exit.
ENDIF.
endloop.


MODIFY I_TAB.  "why these two lines
ENDLOOP.         " which loop is it

Why are u putting the condition inside the loop at lt_text since ur exiting at condition u r not able to read all lines of text.

кu03B1ятu03B9к

Edited by: kartik tarla on Jan 24, 2009 2:53 PM

Read only

0 Likes
831

Hi kartik...

I am using this code because I want to modify my internal table field..

If i am not using it , only blank value store in internal table.

IF NOT I_TAB-NO_OF_BOX IS INITIAL.

exit.

ENDIF.

Read only

0 Likes
831

>

> Hi kartik...

> I am using this code because I want to modify my internal table field..

>

> If i am not using it , only blank value store in internal table.

>

>

> IF NOT I_TAB-NO_OF_BOX IS INITIAL.

>

> exit.

> ENDIF.

Hi ankita,

See.

What ur code is currently doing is reading one line then

checking this condition

IF NOT I_TAB-NO_OF_BOX IS INITIAL.

exit.

ENDIF.

Condition is true so it exits.

So its not reading other lines.

do like this


CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'B01'
language = sy-langu
name = name
object = 'EBAN'
TABLES
lines = lt_text.
if sy-subrc = 0. "  This is important
loop at lt_text.
concatenate  i_TAB-NO_OF_BOX  lt_text-TDLINE to  i_TAB-NO_OF_BOX.
endloop.
endif.

MODIFY I_TAB. "here if u want u can put this check IF NOT I_TAB-NO_OF_BOX IS INITIAL. but i think its not required as now we are looping at lt_text only if sy-subrc is 0

кu03B1ятu03B9к

Read only

0 Likes
831

Thanks kartik...

It works but last some text is missed..

is there any limit for character...

because it shows only 130 characters...

Read only

0 Likes
831

size limit depends on data type of this i_TAB-NO_OF_BOX

just check it, probably u wud require to change its data typeto extend it.

кu03B1ятu03B9к