Skip to Content

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

Concat 4 source fields in new line to a single field in IDoc segment-field?


My requirement is below: Need to concar 4 sources fields in a file and map them to a single target field (In IDoc) with each source field in new line.

Lets say if I have a source file with

f1, f2, f3, f4

I need to send to single target field as follow:





It is basically concat in newline. Can I use any delimiter string in std concat funtion or help me to provide sample code for UDF.



Former Member

Sample UDF for your case.

public String concatStrings(String var1, String var2, String var3, String var4, Container container) throws StreamTransformationException{

String newLine = System.getProperty("line.separator");

//String newLine="\r\n";

String concatString =var1 + newLine + var2 + newLine + var3 + newLine +var4;

return concatString;


Note: Use System.getProperty that would take care for all Operating systems when deploy this code.

you might not able to test in test mapping tool

If you run in eclipse or nwds you will see output as follows

var1 value

var2 value

var3 value

var3 value

Hope this helps. Let me know further.

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