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

Former Member
0 Kudos

Hi all

here i have a funnny doubt. Is it possible to CONCATENATE values in column wise instead of row wise

example:i want to CONCATENATE 120, 121,122 like this

120

121

122

12 REPLIES 12

Former Member
0 Kudos

Why don't you append this to an internal table instead of concatenating?

0 Kudos

Hi

here my problem is i want to print payment order numbers in the last page in a script.last page do not contain Main window.if we pass all the values into an internal table we can't loop them as the last page do not contain any main window it will only once after completion of all windows and only last payment order is printing.if it is possibli to CONCATENATE in column wise that works for my case.

0 Kudos

then use the code i posted earlier..

regards,

srikanth

0 Kudos

Hi sreenivasa,

1. Last page can contain main window.

Then u can ofcourse loop and show.

regards,

amit m.

0 Kudos

hey,

is your problem solved ?? or still have it ??

let us know..

regards

srikanth

0 Kudos

Why don't you insert the MAIN to the last page?

You can write a code to manage to write the payment order numbers only at the end. Before writing them you can force a skip to next page, so you always make sure to print it in the last page.

Max

Former Member
0 Kudos

Define an internal table and append them.....

Regards,

Srikanth

suresh_datti
Active Contributor
0 Kudos

Hi,

No it is not possible.. CONCATENATE is only at FIELD level for CHAR type fields and not records.. It might be possible to get what you want using other techniques..

Regards,

Suresh Datti

Former Member
0 Kudos

Hi

?????

Do you mean you want to append these values to internal table?

If it so you can try to use SPLIT command:

DATA: STRING(20) VALUE '120 121 122'.

DATA ITAB(3) OCCURS 0 WITH HEADER LINE.

SPLIT STRINGH AT SPACE INTO TABLE ITAB.

Max

Former Member
0 Kudos

Hi Sreenivasa,

As we are storing the result of Concatenation in a field which is of String type and string always have only row there exist no column so if you wanna display your result column wise then the idea of using internal table is the best.

reward point if useful.

Regards,

Siddarth

Former Member
0 Kudos

assume you have 3 fields in the internal table

data :v_f1(1000) type c,

v_f2(1000) type c,

v_f3(1000) type c.

loop at itab.

concatenate v_f1

itab-f1

into v_f1."(use SEPARATED BY ,if you want)

concatenate v_f2

itab-f2

into v_f2."(use SEPARATED BY ,if you want)

concatenate v_f3

itab-f3

into v_f3."(use SEPARATED BY ,if you want)

endloop.

NOW V_F1,V_F2,V_F3 will have 1st 2nd 3rd columns concatentaed values.

regards

srikanth

Former Member
0 Kudos

hey,

here is the full code to work out.

data : begin of itab occurs 0,

f1(10),

f2(10),

f3(10),

end of itab.

data :v_f1(1000) type c,

v_f2(1000) type c,

v_f3(1000) type c.

itab-f1 = 1.

itab-f2 = 2.

itab-f3 = 3.

append itab.

itab-f1 = 2.

itab-f2 = 3.

itab-f3 = 4.

append itab.

itab-f1 = 5.

itab-f2 = 6.

itab-f3 = 7.

append itab.

break-point.

loop at itab.

condense : itab-f1, itab-f2, itab-f3.

*--this condense is to remove unnecessary blank spaces.

concatenate v_f1

itab-f1

into v_f1."(use SEPARATED BY ,if you want)

concatenate v_f2

itab-f2

into v_f2."(use SEPARATED BY ,if you want)

concatenate v_f3

itab-f3

into v_f3."(use SEPARATED BY ,if you want)

endloop.

<b>output :</b>

v_f1 125

v_f2 236

v_f3 347

printed output of the program

Message was edited by: Srikanth Kidambi Maruthi