cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with generated Tline-Object

Former Member
0 Kudos

Hello,

I have a WD app which has a generated model from a bapi. This model includes a Tline-Object with tdformat and tdline (string with lenght 132).

On my ui I have a textEdit-Component with soft wrapping.

If the user saves the content of the textedit I cut the content in parts of 132 length and fill each string in a Tline-Object.

Now my problem: if I have to cut a line right after a blank the Tline-Object cuts off the blank. I add a string of 132 lenght and the tline got in its attribute TDLine a string of length 131. If the line ends with two blanks both are cut off. If I read now from the backend again then the blank is missing and two words are wrote together which shouldn't.

e.g. the text

10) There is no option in the new call report version to be able to differentiate people who only attended part of the meeting. <u>Is this</u> possible ?

becomes:

10) There is no option in the new call report version to be able to differentiate people who only attended part of the meeting. <u>Isthis</u> possible ?

Any ideas to solve this?

Thanks and best regards

Iris Deuring

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I solved it like you suggested. Though I'm not happy with that...I wonder why it's cut off at all...

Thank you all!

Best regards.

Iris Deuring

Former Member
0 Kudos

Hi Iris Deuring,

This was a standard problem which we faced during development also. ABAP doesn't store blanks at the end. So it trims off.

What we did was:

In WD Application we looped thru each line and if the length was less then 131 (say eg, 100) we add difference number of blank spaces while reading(here it will be 31).

This mechanism was done except for the last line

This was the only solution we had to overcome this problem.

Thanks and regards

RK

Former Member
0 Kudos

possible solution:


final int LINE_LENGTH = 132;
String s = "There is no option in the new call report version to be able to differentiate people who only attended part of the meeting. Is this possible ?";
ArrayList parts = new ArrayList();
		
while(s.length() > LINE_LENGTH) {
			
	String p = s.substring(0, LINE_LENGTH);
	String temp = s.substring(p.length(), s.length());

	while(p.endsWith(" ") || temp.startsWith(" ")) {
		p = p.substring(0, p.length() - 1);
		temp = s.substring(p.length(), s.length());
	}
			
	s = temp;
	parts.add(p);
			
}
		
if(s.length() > 0) {
	parts.add(s);
}
		
Iterator i = parts.iterator();
while(i.hasNext()) {
			
	String x = (String) i.next();
	System.out.println("'" + x + "' " + x.length());
						
}

Former Member
0 Kudos

Hi,

just ensure that none of your strings end with a blank character. You can check this i.e. with String.endsWith(" "). If your string ends with <b>x</b> blanks, cut of <b>x + 1</b> character from the end of this string and take these chars to the next string.

Regards

Sebastian