Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

sap translates \n\r wrong

Dear Experts,

the problem what I am having is

that an input which is entered on the WebDynpro side within

a TextEdit Field like

aaaa

bbbb

ccccc

internally as "Ltxt"= "aaaa\r\nbbbb\r\nccccc\r\n"

will be translated on the SAP

Side as -> aaaa##bbbb##ccccc##.

This is what I am seing inside the field on the Sap side

What is wrong here ?

Regards

erdem

Former Member replied

Hi Erdem,

Try like this:

StringBuffer buffer = new StringBuffer(wdContext.currentContextElement().get<TextEditAttrib>());

for (int i = 0,index=buffer.indexOf("\n"); i < buffer.length(); i++) {

if(i==index){

buffer.replace(i-1, i+1,"\r\n");

index = buffer.indexOf("\n");

if (index == -1)

break;

}

}

wdContext.currentContextElement().set<attribName>(buffer.toString());

Now attribName value is "aaaa\r\nbbbb\r\nccccc\r\n"

regards,

Siva

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question