cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynpro - Tracking Carriage Return in TextEdit

Former Member
0 Kudos

Hello All,

I am using a TextEdit and I need to track the text entered in the UI separated by Carriage Return. I have mapped a context attribute to this TextEdit field.

Basically if user enters

Line 1

Line 2

in 2 separate lines by enter space, I must be able to read the text with the carriage return demarcation so that it can be saved in R/3 as separate text lines.

Any idea how to track the carriage returns in the text entered by the User in the UI? When I print the context value which holds the text, I cant see any carriage return encoding separated by special characters.

Any hints are most welcome!

Thanks,

Dhanz

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Set wrapping=WDTextWrapping.HARD. This should insert line break characters.

Armin

Answers (2)

Answers (2)

monalisa_biswal
Contributor
0 Kudos

Hi Dhanya,

You can also use following method.

StringTokenizer st=new StringTokenizer(var,"\n",false);

while(st.hasMoreTokens())

{

wdComponentAPI.getMessageManager().reportSuccess(st.nextToken());

}

StringTokenizer constructor has three parameters.Omit second parameter if u r not sure of the delimeter type.

Third parameter is required if you also want to return delimeter character.

Hope it helps!

roberto_tagliento
Active Contributor
0 Kudos


    String tokens[] = null;

    String splitPattern = "n";

    tokens = YOUR_TEXT.split(splitPattern);

    for (int i = 0; i < tokens.length; i++) {
      System.out.println(tokens<i>);
    }


Message was edited by:

Roberto Tagliento