‎2009 Jun 16 3:22 PM
Hi,
In my req I have to concatenate the header and item details, during concatenating I have to concatenate one header and one line item and push it as one line(Single Line), I am unable to concatenate the values into a single line they are coming in two lines, how to achive this.
‎2009 Jun 16 3:24 PM
how are u having those header and item details??? two internal tables or in same or how?
depending upon this i can suggest
‎2009 Jun 16 3:25 PM
Hi,
Both are in different tables.Any updates ?
Edited by: Varun on Jun 16, 2009 8:01 PM
‎2009 Jun 16 3:36 PM
Assuming header_data is table which holds header names as rows, whereas item_data is a table which stores one item value in each row, then the following would apply:
data: itab type string occurs 0.
loop at header_data.
read table item_data index sy-tabix. "read it by index if i.e first row in ITEM_DATA has value for first row in HEADER_DATA
if sy-subrc = 0.
concatenate header_data item_data into itab separeted by ';' ."line would look like MATNR;045678031
append itab.
endif.
endloop.
Regards
Marcin
‎2009 Jun 16 3:40 PM
clear : gv_concat_line, is_item.
loop at it_item into is_item.
concatenate gv_concat_line is_item-desc into gv_concat_line.
at end of key. "-------->key field separating records in header table which is in item table also
clear: is_header .
read table it_header into is_header with key key = is_item-key.
if sy-subrc = 0.
gs_final-line = gv_concat_line.
append gs_final to gt_final.
clear : gv_concat_line.
endif.
endat.
clear is_item.
endloop.hope this helps.. self explanatory,...
‎2009 Jun 16 3:38 PM
hi
check this
loop at header into wa_header
Read table lt_line into wa_line with key <COndition>
loop in lt_line ito wa_line
concatenate wa_head-field wa_line-field into temp.
'append temp
endloop.
Thanks
‎2009 Jun 16 7:02 PM
Hi,
Loop on the item table and read the header table by matching the key fields in both.
Then concatenate both into some variable and append it to a new internal table.
Regards,
Ankur Parab
‎2009 Jun 17 2:51 AM
Hi Varun,
First Lets sat Table A(header), Table B(Items), Table C(Final after concatineing,,)
Table A--- Contains 4 records,,,,
Table B--- Contains 4 records,,,,(Or more records based on line Items)
Loop at Table A.
Loop at Table B (based on Work Area of Table A--- Where clause)
Concatinate (Table A - Field) (Table B - Field) into (Table C- Field). "Gives you First header at the end available no of items, one by one...
Endloop.
Append Table C.
Endloop.
Thanks & regards,
Dileep .C