cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP string declaration gets truncated at 255 length

09-17-2026 6:05 AM
jeff_broodwar Active Participant
630 views 8 comments Go to solution
Subscribe

Hi Friends,

I searched online but couldn't find an answer to this problem. I want to fill a variable declared as string or text1000 but it gets truncated at 255 length. Hope you can help check, fix or even provide an explanation atleast.

Below is the code I'm using:

*&---------------------------------------------------------------------*
*& Report ZTEST1
*&---------------------------------------------------------------------*
*& 
*&---------------------------------------------------------------------*
report ztest1.
data: lt_lines type standard table of tline,
      lwa_lines type tline.
data: lv_complete_comment type text1000.
*Append information
lwa_lines-tdline = '************************************************************************'.
append lwa_lines to lt_lines.
lwa_lines-tdline = 'Changed By:   Aaron Di (7777777)'.
append lwa_lines to lt_lines.
lwa_lines-tdline = 'Changed On:   09/08/2026 21:21:21'.
append lwa_lines to lt_lines.
lwa_lines-tdline = '************************************************************************'.
append lwa_lines to lt_lines.
lwa_lines-tdline = 'This is a test case for the TIM reminder email update to increase the character restriction. The comments need to show'.
append lwa_lines to lt_lines.
lv_complete_comment = reduce string(
  init text = conv string( '' )
  for line in lt_lines
  next text = text && '' && line-tdline && cl_abap_char_utilities=>newline ).
write lv_complete_comment.

Below is the debug screen showing the character length saved inside lv_complete_comment.

lv_complete_comment.jpg

Appreciate your time and hope you can share your thoughts.

Geoff

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert

What do you mean by truncated at 255 length? I do not see it in your screenshot.

When I try code I do not see problem either - LV_COMPLETE_COMMENT contains all the texts including the "The comments need to show".

Tomas_Buryanek_0-1789627070103.png

Maybe you are asking about WRITE? For that I recommend reading WRITE | ABAP Keyword Documentation

jeff_broodwar
Active Participant
0 Likes

Appreciate your time Tomas. please see comments below:

Mine gets cut out at "(include preceding comments)....This is a test case for the TIM reminder e" (continuation of -> "mail update to increase..." - and the rest are cut out (please see debug screenshot)). I wonder why mine is limited to only 255? is there a setting for this?

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
@jeff_broodwar I think that what you are referring to is just "preview" of variable value in debugger. The one where you hover with mouse over the variable. But to properly inspect the variable value you should doubleclick on it or open it in one of the debugger view tools (like on my screenshot).
jeff_broodwar
Active Participant
0 Likes

How did you get to that view? My variable when I try to pass to another string gets only until letter e. Not the complete text you are showing.

Here's my debugger view:

lv_complete_comment D1.jpg

lv_complete_comment D2.jpg

If it's just showing a preview then I suppose it should get all the text when I pass it to another variable... It only gets until "e" as shown above.

Appreciate your help.

Geoff

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
@jeff_broodwar your screenshot is unfortunately too small. But notice that you can change views in debugger. In my screenshot I used "Tabular" view (it is visible on screenshot). You can experiment and try others too. Some views/previews are limited and preview only fixed amount of characters (very often 128 or 255 maximum).
jeff_broodwar
Active Participant

I see it now, the tabular view shows the complete text same as yours 🙂

Then the issue is not the variable, once I pass it to SOST it gets truncated shorter, only until "for the TIM remind" - compare to the fast display view showing "for the TIM reminder e". Once you changed to tabular it shows the whole text...

It appears SOST preview comment box has limitation as well?

Thank you for your help.

 

Geoff

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
SOST preview might have some character limitation too. Or you have some bug in your e-mail code. Best to let e-mail message reach the inbox and check final e-mail (if possible).

Answers (1)

Answers (1)

sravan_aleshwaram
Contributor
0 Likes

Hello @jeff_broodwar 

TRING in ABAP is not limited to 255 characters. The truncation is usually caused by an intermediate field (such as TDLINE) or by how the value is being displayed/debugged

Thanks,
Sravan