Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenate separated by new-line

Former Member
0 Kudos

Hi Friends,

How do I concatenate two strings separated by a new-line.

I mean I want a variable having two strings that are concatenated by next line.

Regards,

Raju.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

AFAIK there is not special character like '\n' in ABAP. perhaps this a solution:


CONCATENATE string1
            string2
  INTO string3
  SEPARATED BY special_string.

SPLIT string3
  AT special_string
  INTO TABLE itab.

LOOP AT itab INTO line.
  WRITE: / line.
ENDLOOP.

4 REPLIES 4

Former Member
0 Kudos

AFAIK there is not special character like '\n' in ABAP. perhaps this a solution:


CONCATENATE string1
            string2
  INTO string3
  SEPARATED BY special_string.

SPLIT string3
  AT special_string
  INTO TABLE itab.

LOOP AT itab INTO line.
  WRITE: / line.
ENDLOOP.

0 Kudos

Thanks for the reply.

But I have a different problem.

Iam using ALV Grid. And I want to display the title with multiple lines.

For Example:

<b>BOM Changes

Change Number: 500000.

Board Number : Board1.

Plant : Plant1.</b>

And Iam using classes. I mean Iam using set_table_for_first_table to display the ALV Grid.

0 Kudos

AFAIK the ALV grid is not able to display a multi-line title ...

Former Member
0 Kudos

HI Raju

Please check class: CL_ABAP_CHAR_UTILITIES.

data: l_cr(1) type c value cl_abap_char_utilites=>cr_lf,
      l_lf(1) type c value cl_abap_char_utilities=>linefeed.

One of the above will certainly help you. Am not on SAP now to check the same. Use this for concatenating.

CONCATENATE str1 str2 INTO out SEPARATED BY l_cr.

Kind Regards

Eswar