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 INTERNAL TABLE VALUES

Former Member
0 Likes
5,007

Hello All,

I want to concatenate the internal table values into a field.

for eg: the internal table contains two fields POSNR and NETWR

the values are 000010 250.00

000020 350.00

then i need the values in one field as 000010,250.00 and 000020,350.00

Please let me know how can i achieve this.

Thank You,

Suresh

6 REPLIES 6
Read only

Former Member
0 Likes
1,895

Hello,

Do this:


TYPES:
  lty_field TYPE C LENGTH 70.
DATA:
  lt_field TYPE TABLE OF lty_field,
  lv_field LIKE LINE OF lt_field.

LOOP AT itab INTO wa.
  CONCATENATE wa-field1 wa-field2 SEPARATED BY ',' INTO lv_field.
  APPEND lv_field TO lt_field.
ENDLOOP.

Regards,

Read only

Former Member
0 Likes
1,895

loop at i_t.

concatenate i_t-value1

i_t-value2

into v_value.

endloop.

Read only

Former Member
0 Likes
1,895

hi,

Try this.

Loop at itab.

concatenate itab-POSNR ' ,' itab-NETWR into var.

itab-newfield = var.

modify table itab index sy-tabix transporting newfield.

endloop.

Read only

Former Member
0 Likes
1,895

Hi,

Loop at ty_tab into wa_tab.

concatenate wa_tab-posnr wa_tab-netwr into ly_field separated by ' and '.

Endloop.

Thanks,

Rajani.

Read only

0 Likes
1,895

I dont think any of the above logics work, i have two line items 000010,250.00 and the second line item 000020,350.00.

then i have to get all the 4 values 000010,250.00 and 000020,350.00 in one line

Read only

0 Likes
1,895

if you want all of these fields in one line do like this:

data: lv_string type string.

data: lv_fields(50) type c. "or whatever length you need for these two fields. Don't the data types, so maybe you will have to convert to Char type.

loop at itab in wa.

clear lv_fields.

concatenate wa-fielda, wa-fieldb lv_fields separated by ','.

concatenate lv_string lv_fields into lv_string separated by ','.

endloop.