Skip to Content
0
Former Member
Aug 30, 2005 at 12:16 PM

Concatenating text for htmlb:textEdit - trailing spaces issue

124 Views

Hi,

I have a htmlb:textEdit that takes string input from the user and saves the input to R/3 in long text char format. The user can update or view this data.

The string input from the htmlb:textEdit is split into to chars of 132 length (and also at CR/LF) so I can save as long text on the backend R/3 system (using tline structure). I cannot (am not allowed) write the text as string to the WAS. it must live on R/3.

This works fine but my issue comes when I try to read the long text back into WAS from R/3 for display in the htmlb:textEdit. The idea is that I read in each 132 char line from R/3 and concatenate into a string and point the string to the htmlb:textEdit for display.... but when I concatenate I lose the trailing space. This is not good. I will also have words that spill from one line over to another so I cannot use separated by space.

My example does not use 132 chars but should show the issue:

 123456789012345678901123456789012345678
'Here are some words with lots of white '
'space to see if the system removes the '
'white space or leaves it alone. This is'
' more text with a word spread over a li'
'ne.                                    '
(the last line has no trailing space)

So if I concatenate line 1 & 2 I will get 'Here are some words with lots of whitespace to see if the system removes the'. The word 'whitespace' is not separated. but I cannot separate everything by space as the last two lines would concatenate to ' more text with a word spread over a li ne.'

I have tried to replace the space with a char such as tab then concatenate and then replace tab with space but this does not seem to work as lines that previously had no spaces (e.g. last line in example above) will now be full of them.

I have also tried replace using an x data type (from this sdn link - Concatenating strings with trailing spaces but this does not work for me either as WAS complains about using a non char-like data type.

In summary, I need a way to concatenate a string and a char into a string where I keep the trailing spaces. But if a char line from is less than 132 chars (e.g. last line in example above) then the system should not pad out with loads of spaces.

Any ideas? Am I missing something easy here? Should I save the char data to R/3 in another manner?

Thanks,

Niall