Application Development 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: 

SmartForm: Insert break line in string

Former Member
0 Kudos
2,580

Hi all,

I tried to search this question but found no deserved answer. Please help:

I have a requirement to display data to PDF format, the data is stored in a string. I want to insert a break line between data dynamically but can not.

For e.g.: I have a string:

'This is a test string. I want to break here'

And I expect the output in PDF as:

This is a test string.

I want to break here.

I try to use some constants in CL_ABAP_CHAR_UTILITIES class but it does not work.

Any help will be appreciated.

Thanks,

Khanh

8 REPLIES 8

former_member188827
Active Contributor
0 Kudos
422

use

split string at '.' into table itab.

see documentation for split.

StMou
Active Participant
0 Kudos
422

hi,

Try perhaps with code bold\nbold ( Not Sure)

Rgds

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Kudos
422

Hello,

If you are generating the PDF from your SmartForm it will look exactly the same as your SF.

If you use CL_ABAP_CHAR_UTILITIES=>NEWLINE in your SF does this split your text into 2 lines in the SF?

BR,

Suhas

Former Member
0 Kudos
422

Hi Suhas,

I tried to used CL_ABAP_CHAR_UTILITIES=>NEWLINE too, it displayed nothing.

@All: I use the string to display into SMARTFORM due to some specific requirement. I do not want to split the string. I would like to insert the line break symbol into that string.

Please suggest.

Thanks,

Khanh

Former Member
0 Kudos
422

Hi all,

I did meet the same problem with SAPScript form but can not resolve yet.

In addition, I'm on ECC6.

Thanks,

Khanh

Former Member
0 Kudos
422

Hi all,

I close this thread because the answer is CAN NOT.

Please refer to the explanation below: (source: [Expert exchange|http://www.experts-exchange.com/Web_Development/Document_Imaging/Adobe_Acrobat/Q_21149348.html])

OK, you are talking about PDF content. 
There is no line break in PDF. 
A line break is simulated by advancing the cursor's vertical position by the line distance.
 If you read the PDF spec, you will notice that  there are not even lines in a PDF file: 
All text is organized in "text runs". 
A text run can be one character, one word, part of one word, a collection of words, ... 
There is no requirement that a text run is one line either. 
How text is actually organized depends on the program you use to 
create the PDF content - in your case this would be EzPdf, 
something I'm not familiar with (not yet :-). 
So, you need to look in the EzPdf documentation for information about how to force a line 
break. 
There is nothing that you can put into the PDF content (that is, if the EzPdf environment is
 not filtering the string and forcing the text to a new line behind the scenes) that would 
be interpreted as a line break by Acrobat.

What if you put your individual lines (or paragraphs) into separate addTextWrap() calls?

Regards,

Khanh

0 Kudos
422

       Hi guys !

       I found the same situation here in a smartform and, I found a way to do that. If you define a table in the smartform, and fill the lines of this table with the text splitted you need, you can print each line of text separately in the Smartform, quite simple.

       Thank you for your attention,

       Wilson

Former Member
0 Kudos
422

Yes, As mentioned its not possible to Insert a Line Break in a String.

But I solved a similar situation by Populating the string in an internal Table, and Looping through the internal table to print the values. Loop was placed inside a table , to print the Item description which has more than one text lines, with Line break.