Skip to Content

Multiline String

May 08, 2017 at 10:40 AM


avatar image

Hi All,

I am using a third party software which need multiline input or (multiline String) in a single variable, input be like this:

abc = ABC

xzy = XYZ

MNO =mno

this input shoud be in a single variable, which variable i need to pass in third party software from SAP ABAP code.

I tried many things but the value finaly is going as a single line string like : 'abc=ABCxyz=XYZMNO=mno' which third party software not accepting.

Is there any possible solution or way to achive this.


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Matthew Billingham
May 08, 2017 at 02:30 PM

You are using a very old version of ABAP, since it doesn't recognise | as a string delimiter. What you should have done was applied the technique to your code, rather than just blindly using the example ABAP, which is explicitly set up as a demo. You don't need CL_DEMO_OUTPUT on your system.

But that's all by the by. I suspect this isn't an ABAP question. You're passing a string to a javascript parser. Therefore you should create your string in a format that javascript recognises as multiline. And you can get that by searching in a search engine for keywords multiline strings javascript.

Show 1 Share
10 |10000 characters needed characters left characters exceeded


It worked for me

I created Multiline string in javascript itself, after taking inputs from individual variables of ABAP.

Horst Keller
May 08, 2017 at 11:10 AM

Simply use string templates |\n| as linebreaks between the lines in your string?

Show 3 Share
10 |10000 characters needed characters left characters exceeded

When I am trying it is giving error type cl_abap_codepage is unknown, which is I think because of SAP version.

Can you explain it with example?

Thank you very much for your responce.


What exactly are you trying? How do you pass the string?


Actually I have to pass multiline string in a Javascrip through a variable suppose variable is 'data' like this

data = 'abc = ABC'    
       & 'xzy = XYZ'
& 'MNO =mno'. *------------------------------------------------------------------------------------------------- * which i am expecting will be passed in java script function(call myfunct(String data) like this. *------------------------------------------------------------------------------------------------- ABC = abc XYZ = xyz MNO = mno *----------------------------------------------------------------------- *but it is passing like this *----------------------------------------------------------------------- ABC = abcXYZ = xyzMNO = mno
javascript function
call myfunct(String data){
//function definition

before actually doing above things.

I tryied this


Unable to find Method CONVERT_TO for class CL_ABAP_CODEPAGE

and this:


cp1.png (5.5 kB)
cp2.png (20.6 kB)