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 output.reg

sarath1988
Explorer
0 Likes
1,391

Hi all,

i am using the function module READ_TEXT, to fetch the long text for my program, when i am fetching the same, into the internal table from the tables column in the function to a internal table tlinetab which has a include type of the structure tline.

i am able to get the values through the function module into the table tline tab, where the long text is of 325 characters. i am also aplying a loop on the table tlinetab in order to concatenate the tdline component into a variable of length 350 characters, but, i am not able to do so, the output of the function module shows 325 characters, but after concatenating the same i am able to see and show only 255 characters, on checking upon the debugger i am seeing that there is a index of the output of the function module as 6, also there is the full text available, on debugging the same step by step along the loop when it reaches sy-tabix = 5, and sy-tabix = 6 the text fails to get concatenated to the character that i defined to be of 350 characters, instead only 255 characters are visible. What do i do for it...as i am not able to find a suitable answer, please help me out for the same.

waiting for a positive reply.

sriram.

13 REPLIES 13
Read only

Former Member
0 Likes
1,346

if you are concerned about the length, don't rely on visible length.... declare a variable of type i and check the length.

data: lv_len type i.

loop....
.....concatenate.....
endloop.

lv_len = strlen( 350-char-variable ).
write: / lv_len.

Read only

0 Likes
1,346

Hi thanks for the quick response, but my query was.....i am not able to get the full text of the 325 characters into my final variable which can hold 350 characters....it only holding 255 whereas i defined the variable as

data: lv_specs(350) type c.

i am getting the values in tlinetab which is a type of tline from the read text. the tdformat has a index value of 6 and the tdline has a text of 325 characters

but when i am doing this:

loop at tlinetab.

concatenate lv_specs tlinetab-tdline into lv_specs separated by space.

condense lv_specs.

clear tlinetab.

endloop.

here in the variable lv_specs i am having the text as only 255 characters.

my doubt is when i am having the table tlinetab with the complete value but why does it not concatenate all of it while i run the loop....

Read only

0 Likes
1,346

HI,

DECLARE IT OF TYPE STRING.

data: lv_specs type STRING.

REGARDS,

GAURAV.

Read only

0 Likes
1,346

Hi,

here in the variable lv_specs i am having the text as only 255 characters.

Where do you actually check this? are you using write statement? Is it displayed in a ALV? are you only checking the value in debugger?

There shouldn't be any issue with your code, wether you use a string or char type ... the problem is probably on some other part...

Kr,

Manu.

Read only

0 Likes
1,346

It will concatenate it all...the problem is the tool that you're viewing the 350-byte variable with!... In fact, people routinely do:

data: my_string type string.
field-symbols <lfs_t> type tline.

loop at tlinetab assigning <lfs_t>.
  if <lfs_t> is assigned.
  if sy-tabix eq 1. 
      my_String = <lfs_t>-tdline.
else.
concatenate my_string <lfs_t>-tdline
   into my_String separated by space.
endif.
endif.
endloop.

...

to do this, we don't care how many rows are in tlinetab! ALL will be concatenated, whether we can view them with some limited capability desktop tool or not...

Did you do the step to look at the "real" length with the code I gave you? What is in LV_LEN?

Read only

Former Member
0 Likes
1,346

HI,

THE CHARACTER YOU DEFINED IS OF WHAT TYPE?

REGARDS,

GAURAV.

Read only

0 Likes
1,346

i have mentioned it above....it is of type 'C' with length 350

Read only

0 Likes
1,346

Hi gaurav,

i tried using it, but in vain, i am obtaining the same result.

Read only

0 Likes
1,346

HI,

TYPE C CAN HOLD ONLY 255 CHARACTERS, THATS WHY THE VARIABLE SHOWS ONLY 255 CHARACTERS.

REGARDS,

GAURAV.

Read only

0 Likes
1,346

but even we can define the variables like

DATA : lv_spec(350) type C.

right....i tried this after i tried string......

Read only

0 Likes
1,346

Hi,

I created a test program something like this:

i appended the values into table during debugging and its working fine.


data: ITAB1 type STANDARD TABLE OF TLINE.
data: WA_ITAB1 type TLINE.

LOOP AT itab1 INTO wa_itab1.

  CONCATENATE lv_var wa_itab1-TDLINE INTO lv_var SEPARATED BY SPACE.
  condense LV_VAR.

ENDLOOP.

var2 = strlen( lv_var ).
write VAR2.

Regards,

Gaurav.

Read only

0 Likes
1,346

NOT true...the widest type c is 65535. try it....data: lv_c(65535) type c.

Read only

Former Member
0 Likes
1,346

Hi ,

Try this data element CHAR339

Hope will work .

Thanks,

Pradeep.

Edited by: Pradeep Mohandass on Mar 8, 2012 2:12 PM