‎2006 Jan 11 1:16 PM
Hi,
I am having trouble printing strings that contain alot of text in Smart Form. It seems that only the first 255 characters or so of the string is printed.
Does anyone have a solution to this problem? or perhaps an idea of a work-around?
Thanks in advance and best regards
/Niklas
‎2006 Jan 11 1:41 PM
Hi Niklas,
Break the string down into an internal table of smaller elements. The following is some code from class CL_APL_ECATT_SCRIPT->SPLIT_STRING_255, that should break this down (even with word wrap).
*@78\QImporting@ VALUE( INSTRING ) TYPE STRING
*@78\QImporting@ VALUE( LINE_LENGTH ) TYPE INT4 DEFAULT 255 Natural Number
*@79\QExporting@ OUTSTRINGTAB TYPE ETXML_LINE_TABTYPE XML Lines
*@78\QImporting@ WORD_WRAP TYPE ETONOFF DEFAULT SPACE eCATT Switch On/Off
...
data actlen type i value 1.
data linlen type i value 1.
data line type etxml_line.
data onechar.
clear outstringtab.
if line_length > 255.
line_length = 255.
endif.
if line_length = 0.
line_length = 1.
endif.
while actlen > 0.
actlen = strlen( instring ).
linlen = line_length.
if actlen > line_length.
if word_wrap <> space.
onechar = instring+linlen(1).
while onechar is not initial.
linlen = linlen - 1.
if linlen <= 1.
exit.
endif.
onechar = instring+linlen(1).
endwhile.
endif.
line = instring(linlen).
append line to outstringtab.
shift instring left by linlen places.
else.
line = instring.
append line to outstringtab.
clear actlen.
endif.
endwhile.
reward points if it helps..
with regards,
manikandan R
‎2006 Jan 11 1:41 PM
Hi Niklas,
Break the string down into an internal table of smaller elements. The following is some code from class CL_APL_ECATT_SCRIPT->SPLIT_STRING_255, that should break this down (even with word wrap).
*@78\QImporting@ VALUE( INSTRING ) TYPE STRING
*@78\QImporting@ VALUE( LINE_LENGTH ) TYPE INT4 DEFAULT 255 Natural Number
*@79\QExporting@ OUTSTRINGTAB TYPE ETXML_LINE_TABTYPE XML Lines
*@78\QImporting@ WORD_WRAP TYPE ETONOFF DEFAULT SPACE eCATT Switch On/Off
...
data actlen type i value 1.
data linlen type i value 1.
data line type etxml_line.
data onechar.
clear outstringtab.
if line_length > 255.
line_length = 255.
endif.
if line_length = 0.
line_length = 1.
endif.
while actlen > 0.
actlen = strlen( instring ).
linlen = line_length.
if actlen > line_length.
if word_wrap <> space.
onechar = instring+linlen(1).
while onechar is not initial.
linlen = linlen - 1.
if linlen <= 1.
exit.
endif.
onechar = instring+linlen(1).
endwhile.
endif.
line = instring(linlen).
append line to outstringtab.
shift instring left by linlen places.
else.
line = instring.
append line to outstringtab.
clear actlen.
endif.
endwhile.
reward points if it helps..
with regards,
manikandan R
‎2006 Jan 11 3:09 PM
Thanks manikandan R!
That was a perfect solution to my problem.
Many thanks and best regards,
/Niklas
‎2006 May 03 11:12 AM
Hi Niklas,
Can you please let me know how did you manage to print the string in the smart form? how did you loop through the internal table to display the data?
Thanks and Regards,
Piyush
‎2006 Jan 11 1:44 PM
Hi Niklas,
You can use FM <b>IQAPI_WORD_WRAP</b> to split your text across multiple lines.
Regards,
Raj