‎2008 May 23 3:43 PM
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
‎2008 May 23 3:45 PM
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,
‎2008 May 23 3:46 PM
loop at i_t.
concatenate i_t-value1
i_t-value2
into v_value.
endloop.
‎2008 May 23 3:48 PM
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.
‎2008 May 23 4:00 PM
Hi,
Loop at ty_tab into wa_tab.
concatenate wa_tab-posnr wa_tab-netwr into ly_field separated by ' and '.
Endloop.
Thanks,
Rajani.
‎2008 May 23 4:34 PM
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
‎2008 May 23 10:46 PM
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.