Skip to Content
avatar image
-2
Former Member

Multiline String

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.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks,

      It worked for me

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

  • May 08, 2017 at 11:10 AM

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

    https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abenstring_templates_separators.htm

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

      1.

      Unable to find Method CONVERT_TO for class CL_ABAP_CODEPAGE

      and this:

      2.

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