Application Development and Automation 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: 
Read only

Concatenate statement

Former Member
0 Likes
4,664

Hi,

I my coding have written as

concatenate gv_mtext gv_text5 gv_text6 into gv_mtext separated by space.

gv_mtext ,gv_text 5 gv_text 6 has some text fields.Now my problem the contents of gv_mtext should be in the first line in the next line the contents of gv_text5 and gv_text6 should be there.How to do this.

Edited by: saranya srithar on Feb 5, 2009 9:38 AM

12 REPLIES 12
Read only

faisalatsap
Active Contributor
0 Likes
1,608

Hi,

Test the following code may help you in this way i think you can't do using single CONCATENATE.

DATA: s1 TYPE string,
      s2 TYPE string,
      s3 TYPE string,
      string TYPE string.

s1 = 'aaaa'.
s2 = 'bbbb'.
s3 = 'cccc'.
WRITE: s1.
CONCATENATE s2 s3 INTO string SEPARATED BY space.
WRITE: / string.

Kind Regards,

Faisal

Read only

former_member222860
Active Contributor
0 Likes
1,608

Hi,,

u want the output like this:

gv_mtext

gv_mtext gv_text 5

gv_mtext gv_text 5 gv_text6

pl.clarify

thanks\

Mahesh

Read only

former_member195698
Active Contributor
0 Likes
1,608

If you want the data of text 5 and text 6 in next line why are you concatenating it with gv_mtext.

concetenate text 5 and text 6 into some temporary variable (gv_temptext) then write gv_mtext and in the next line write gv_temptext

Read only

Former Member
0 Likes
1,608

Hi,,

Below is the code ..

DATA:
  gv_mtext(50) TYPE c VALUE 'Hi',
  gv_text5(10) TYPE c VALUE 'Heloo',
  gv_text6(10) TYPE c VALUE 'Welcome'.

CONCATENATE gv_mtext gv_text5 gv_text6 INTO gv_mtext SEPARATED BY space.

DO 2 TIMES.
  WRITE:
    /  gv_mtext.
ENDDO.

This is working Fine......

Thanks

Kalyan B

Read only

former_member404244
Active Contributor
0 Likes
1,608

Hi,

Try like this

write 😕 gv_mtext.

concatenate gv_mtext gv_text5 gv_text6 into gv_mtext separated by space.

write 😕 gv_mtext.

Regards,

Nagaraj

Read only

Former Member
0 Likes
1,608

Hi,

You problem is not clear can you please eloborate this.

Read only

faisalatsap
Active Contributor
0 Likes
1,608

Hi,

and if you want to do like the following you must be very clear about the length of the all strings, other wise you will face dumps

data: s1 type string,
      s2 type string,
      s3 type string,
      string type string.

s1 = 'aaaa'.
s2 = 'bbbb'.
s3 = 'cccc'.
*WRITE: s1.
concatenate s1 s2 s3 into string separated by space.

write: string+0(3),
       / string+5(8).

Kind Regards,

Faisal

Read only

viquar_iqbal
Active Contributor
0 Likes
1,608

Hi,

I think you need to use SPLIT <c> AT <del> INTO <c1> ... <cn>.

example

data

DEL(1) VALUE ' '.

SPLIT STRING AT DEL INTO P1 P2 P3 P4.

WRITE / P1.

WRITE / P2.

WRITE / P3.

WRITE / P4.

Hope this helps!

Thanks

Viquar Iqbal

Read only

Former Member
0 Likes
1,608

Hi,

Check out this may work.

DATA: gv_mtext TYPE string,

gv_text5 TYPE string,

gv_text6 TYPE string.

gv_mtext = 'sap'.

gv_text5 = 'abap'.

gv_text6 = 'basics'.

WRITE: / gv_mtext.

CONCATENATE gv_text5 gv_text6 into gv_mtext SEPARATED BY space.

WRITE: / gv_mtext.

Read only

Former Member
0 Likes
1,608

Hi saranya srithar,

CONCATENATE GV_MTEXT GV_TEXT5 GV_TEXT6 INTO GV_MTEXT SAPARTATED BY SPACE.

WRITE: GV_MTEXT.

Regards,

N.Neelima.

Read only

Former Member
0 Likes
1,608

Hi saranya,

Please provide the brief details about requirement and the structure you want as the output so that it will be easy for the team to give you the proper solution. All the solutions provided to your thread will be wel enough to resolve your issue.

Once clarified please close the thread.

Regards,

Read only

Former Member
0 Likes
1,608

Hi Saranya,

try it this way:

Data:
  gv_mtext type string,
  gv_text5 type string,
  gv_text6 type string.

gv_mtext = 'textbcd efscd'.
gv_text5 = 'text5abc defscd'.
gv_text6 = 'text6abc defscd'.

condense gv_mtext no-gaps.
condense gv_text5 no-gaps.
condense gv_text6 no-gaps.

concatenate gv_mtext gv_text5 gv_text6 into gv_mtext separated by space.

split gv_mtext at space into gv_mtext  gv_text5 gv_text6.

write:
  / gv_mtext,
  / gv_text5,
    gv_text6.

With luck,

Pritam.