cancel
Showing results for 
Search instead for 
Did you mean: 

Line break in Text string

Former Member
0 Kudos

Hi,

I have a RFC to SOAP scenario.

RFC has an internal table for long text and the Webservice expects all the lines in a single field. So I concatenate all the lines using UDF and pass it to that field.

I want to add a line break between each line in the internal tableso that it displays exactly the same way the long text is formatted in CRM. Can you please suggest a way to achieve this?

Thanks,

Venkat.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Venkat,

Create a Value user defined function add. Have two arguments u2018au2019 and u2018bu2019.

Imports: java.*;

Add this code to the UDF:

String lines;

lines = "";

lines = lines.concat(a + '\n' + b + '\n' );

return lines;

Then it puts the u2018au2019 value and adds the new line and then puts the u2018bu2019 value. If my input of u2018au2019 and u2018bu2019 is Satish and hi then the output would be:

Satish

hi

You can modify to your requirement.

Regards,

---Satish

Former Member
0 Kudos

Hi Sathish,

Thanks for the quick response.

I already tried using \n in my UDF but it shows up as \n in the message and appears as it is in the target application.

it looks like the target application is not recognizing this "\n" as line break and shows it as text.

Any other ideas?

Thanks,

Venkat.

Former Member
0 Kudos

Venkat,

It should not show /n in your target payload. I see you put double quotes for /n. Instead it should be put only single quote. First if you see a new line in your target payload in xi then we will think of target application. First we will fix ours and then we will see target application later venkat.

Give a try and let us know.

Regards,

---Satish

Former Member
0 Kudos

Hi Sathish,

I tried but it is giving the following error

Source code has syntax error: MMCreatePrimaryItem_.java:229:

unclosed character literal

result1 += tdline[j] + ' \n ' ;

Here is my source code

String result1=new String();

for(int j=0; j<tdline.length; j++)

result1 += tdline[j] + ' \n ' ;

{

result.addValue(result1);

}

Thanks,

Venkat.

Former Member
0 Kudos

Hi Venkat,

I see there is a space before and after \n, can you please remove it and give a try.

Regards,

---Satish

Former Member
0 Kudos

Hi,

You must use "\n" instead of '\n'

Regards

Ivan

Former Member
0 Kudos

Hi Sathish,

It worked

Many Thanks,

Venkat.

Answers (0)