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 question?

vsubbakrishna
Participant
0 Kudos
131

existing data:

i_input_name( with only one field) contains 4 records

name1

name2

name3

name4

desired output should be a single line separated by ',' into another <b>itab2-result_line</b>

ie <b>itab2-result_line</b> = <b>name1,name2,name3,name4</b>

thanks,

subba

1 ACCEPTED SOLUTION

Former Member
0 Kudos
98

CONCATENATE NAME1 NAME2 NAME3 NAME4 INTO ITAB2-RESULT SEPARATED BY ','.

Max

10 REPLIES 10

Former Member
0 Kudos
99

CONCATENATE NAME1 NAME2 NAME3 NAME4 INTO ITAB2-RESULT SEPARATED BY ','.

Max

Former Member
0 Kudos
98

Hello,

data: lv_text type string.

LOOP AT ITAB.

CONATENATE LV_TEXT ITAB-FIELD1 into LV_TEXT separeted by ','.

ENDLOOP:

If useful reward.

Vasanth

Former Member
0 Kudos
98

hi,

Try this...........

DATA : BEGIN OF itab OCCURS 0,

name TYPE string,

END OF itab.

DATA result TYPE string.

itab-name = '1'.

APPEND itab.

itab-name = '2'.

APPEND itab.

itab-name = '3'.

APPEND itab.

itab-name = '4'.

APPEND itab.

LOOP AT itab.

IF sy-tabix = 1.

CONCATENATE result itab-name INTO result.

ELSE.

CONCATENATE result itab-name INTO result SEPARATED BY ','.

ENDIF.

ENDLOOP.

WRITE result.

Regards

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
98

Loop at your internal table and check if the first record, if so, then simply move the value to RESULT, if not then concatenate the value with RESULT and seperate it with ','. See below.

Loop at i_input_name.

   if sy-tabix = 1.
      result = i_input_name-field.
  else.

 concatenate result i_input_name-field into result seperated by ','.
endif.

endloop.

write:/ result.

Regards,

Rich Heilman

Message was edited by:

Rich Heilman

Former Member
0 Kudos
98

Please try this,


DATA: v_string TYPE string.
CONCATENATE LINES OF i_scarr INTO v_string SEPARATED BY ','.
WRITE:/ v_string.
* you can replace the v_string with your required internal table field

Regards

Kathirvel

Former Member
0 Kudos
98

loop at i_input_name.

concatenate v_str i_input_name-<field> into v_str separated by ','.

endloop.

to remove ',' at the end.

v_strlen = strlen(v_str).

v_str = v_str+0(v_strlen).

Former Member
0 Kudos
98
data : V_name type string.

loop at i_input_name.
 concatenate v_name i_input_name. separated by ','.
endloop.

v_len = strlen( v_name ). :  "to remove last comma
v_len = v_len - 1.
v_name = v_name+0(v_len).

vsubbakrishna
Participant
0 Kudos
98

problem solved........pts assigned...

subba

vsubbakrishna
Participant
0 Kudos
98

answered

Former Member
0 Kudos
98

assign a variable name type string

concatenate name1 name2 name3 name4 into name.

bye