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

Strings in Smart Form

Former Member
0 Likes
710

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
661

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

4 REPLIES 4
Read only

Former Member
0 Likes
662

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

Read only

0 Likes
661

Thanks manikandan R!

That was a perfect solution to my problem.

Many thanks and best regards,

/Niklas

Read only

0 Likes
661

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

Read only

Former Member
0 Likes
661

Hi Niklas,

You can use FM <b>IQAPI_WORD_WRAP</b> to split your text across multiple lines.

Regards,

Raj