09-25-2008 8:43 AM
Hi Experts,
I have a problem where by i'm trying to collect identical lines from an internal table.
What ive done in the past is to move the header line one by one and then collectther esults into a itab that has the same stucture as the contents being moved into it.
However, i'm trying to collect identical lines where by i have 4 columns usign the above steps but doesnt seem to be working. Any help would be greatly appreciated.
Thanks - DJ
DATA: BEGIN OF gt_data OCCURS 0,
material(13) TYPE C,
quantity TYPE i,
unique_no(18) TYPE C,
description(40) TYPE c,
END OF gt_data.
DATA: BEGIN OF gt_putput OCCURS 0,
material(13) TYPE C,
quantity TYPE i,
unique_no(18) TYPE C,
description(40) TYPE c,
END OF gt_output.
09-25-2008 8:52 AM
Hi
Qty should be last field
DATA: BEGIN OF gt_data OCCURS 0,
material(13) TYPE C,
unique_no(18) TYPE C,
description(40) TYPE c,
quantity TYPE i,
END OF gt_data.
DATA: BEGIN OF gt_putput OCCURS 0,
material(13) TYPE C,
unique_no(18) TYPE C,
description(40) TYPE c,
quantity TYPE i,
END OF gt_output
Regards
MD
09-25-2008 8:52 AM
Hi
Qty should be last field
DATA: BEGIN OF gt_data OCCURS 0,
material(13) TYPE C,
unique_no(18) TYPE C,
description(40) TYPE c,
quantity TYPE i,
END OF gt_data.
DATA: BEGIN OF gt_putput OCCURS 0,
material(13) TYPE C,
unique_no(18) TYPE C,
description(40) TYPE c,
quantity TYPE i,
END OF gt_output
Regards
MD
09-25-2008 8:59 AM
Hi MD,
Even if i move type i to be the last field in both itabs this still doesnt work.
Anyone further ideas?
Cheers - DJ
09-25-2008 9:08 AM
Hi
I hope you are looking unique combination of the following fields ?
material(13) TYPE C,
unique_no(18) TYPE C,
description(40) TYPE c,
If yes, than can you pls show the code written to collect
Regards
MD
09-25-2008 9:15 AM
Hi MD,
OK, think the problem is that the material is the same, can you advise how to count integer from these 3 rows and then merge into 1??
Many thanks
Material Unique No Qty
C_TBKO1 |230920081111111-1 | 1
C_TBKO1 |230920081111111-2 | 1
C_TBKO1 |230920081111111-5 | 1
09-25-2008 9:18 AM
Hi
Try the below code
DATA: BEGIN OF gt_data OCCURS 0,
material(13) TYPE C,
quantity TYPE i,
unique_no(18) TYPE C,
description(40) TYPE c,
END OF gt_data.
DATA: BEGIN OF gt_putput OCCURS 0,
material(13) TYPE C,
quantity TYPE i,
END OF gt_output.
sort gt_data.
loop at gt_data .
gt_putput-material = gt_data-material .
gt_putput-quantity = gt_data-quantity.
collect gt_putput.
endloop.
Let me know, if you need further help
Regards
MD
Edited by: Madhan Doraikannan on Sep 25, 2008 10:18 AM
09-25-2008 9:09 AM
Hi i hope description is not matching.
DATA: BEGIN OF gt_data OCCURS 0,
material(13) TYPE C,
quantity TYPE i,
unique_no(18) TYPE C,
description(40) TYPE c,
END OF gt_data.
DATA: BEGIN OF gt_putput OCCURS 0,
material(13) TYPE C,
quantity TYPE i,
unique_no(18) TYPE C,
description(40) TYPE c,
END OF gt_output.
loop at gt_data .
move : gt_data-material to gt_putput-material,
gt_data-quantity to gt_putput-quantity,
gt_data-unique_no to gt_putput-unique_no.
collect gt_putput.
endloop.
now fill the description by reading from first table looping through second table.