cancel
Showing results for 
Search instead for 
Did you mean: 

Smartforms Text field display || Why whole word is not printed instead of being truncated

Former Member
0 Kudos

Hi Experts,

Might be a simple solution but I am not aware, I am using Few Line types in Template in SAP Smart-form.

One of the line type is divided in 2 columns, suppose length 3 cm each, suppose with my font each cell can accommodate 20 char text.

Now issue is -- if my text is "hello hello sapworlds" (exact 20) it is printed successfully, no issue.

But if my text is "hello hello sapworlds" (len 21), last word is not printed at all. It is printing "hello hello". But, my requirement is to print first 20 characters even if the last word is truncated.

Why it is not printing complete word if length not enough ?


Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Private_Member_7726
Active Contributor
0 Kudos

Hi,

The composer is not truncating, it simply wraps the whole word into the next text line, which will not be displayed, because the template cell height is insufficient (which is why I prefer tables over templates - the flexible cell height in tables). Just increase the template row height to illustrate the effect.

I have not found a way to affect the word wrapping in SAP form processing works - so it breaks in the middle of the word, for example.

cheers

Jānis

Former Member
0 Kudos

Right, it will wrap to next line, but is there any way to truncate and show whatever possible in same line and rest of the text shifts to next line.

Otherwise, if I have cell which can fit 20, I can never show a word which is more than 20 character even though my cell width is very high.

Private_Member_7726
Active Contributor
0 Kudos

If it fits your needs, you can specify the output length in characters directly in the text field: &textfield(20)& - then it will "truncate" the output (output only the first 20 characters). But bear in mind that the real output length for 20 characters will wary depending on the field contents when using proportional font... It will stay constant only for monospaced (non-proportional) font.

Smartforms support all the Sapscript field formatting options.

cheers

Jānis

Answers (1)

Answers (1)

peng_wen
Active Participant
0 Kudos

Hello,

It might be caused by a line break in case there has no enough length for the last word,
this is working as designed, you may add additional lines for the text filed and see if it works.

Regards,
Wen Peng