cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a new line character in SAP CPI Content Modifier

0 Kudos

Hi Experts,

I am trying to populate a list of employee ids in Content Modifier as follows and then writing it to a file on SFTP server,

11111
22222
33333

However, in the output file, it's displayed as,

111112222233333

Could you please help me understand how can we add a new line character in content modifier so that it's added in the file as well and every employee number appears on a new line?

Thanks in advance,

Netrey

Accepted Solutions (0)

Answers (3)

Answers (3)

gsmohanbabu
Explorer

You can handle this via groovy script

import com.sap.gateway.ip.core.customdev.util.Message;

import java.util.HashMap;

def Message processData(Message message)

{

def body = message.getBody(java.lang.String) as String;

body = body + "\n" ;

message.setBody(body );

return message;

}

former_member190736
Participant
0 Kudos

Netrey Powdwal

How did you solve this problem?

Thanks,

CP

NareshDasika18
Participant
0 Kudos

Hello Netrey Powdwal,

If the employee ID's are mentioned as above in Content Modifier body then the output file should contain in the same way as of Content Modifier body. I just tried the same and printed in the same. Please find attached screenshots.

Regards,

Naresh

0 Kudos

Hi Naresh,

Thanks for your response. The employee IDs here are not hardcoded text but an expression like ${property.emp_id}

Moreover, I am adding one employee at a time to the file. For example, every execution of iFlow appends an employee id in the same file. Hence, for each employee id to appear on the next line, I tried to add a new line by <enter> key, added '\n', added a space after employee id on a new line. But it seems that content modifier treats these characters as a white space and trims those. I hope the issue is more clear now.

Regards,

Netrey