‎2006 Sep 25 7:45 AM
Hi all,
Iam using a collect statement with all fields which belong to char type. All the values differ in each record. Can i use a collect statement here. If yes! then how it is possible.
for example.
loop at itab.
matnr like mard-matnr, "Material Number
werks like mard-werks, "Plant
lgort like mard-lgort, "Storage Location
mtart like mara-mtart, "Material type
abcin like marc-abcin, "Physical inv ind for cycle
endloop.
material and plant will be the same, but others differ for each record.
Please give your suggestions,
Thanks,.
Rajesh.
‎2006 Sep 25 7:47 AM
HI,
why you are using collect when all fields are character type. there is no usage of this. collect sum of the numeric fields where all character fields match.
So use append.
Regards,
‎2006 Sep 25 7:48 AM
‎2006 Sep 25 7:53 AM
Hi rajesh,
1. Can i use a collect statement here
We can use collect statement in all internal tables.
2. The only MAIN CONCEPT is
3. that it will SUM up the Quantity fields,
based upon
the COMBINATION of all Character Fields.
regards,
amit m.
‎2006 Sep 25 8:03 AM
hi
good
you can use the collect statement in this way.
Collect:
When the line is inserted, the system checks whether there is already a table entry that matches the key. If there is no corresponding entry already in the table, the COLLECT statement has the same effect as inserting the new line. If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.
You should only use the COLLECT statement if you want to create summarized tables. If you use other statements to insert table entries, you may end up with duplicate entries.
GO THROUGH THIS LINK
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
thanks
mrutyun^
‎2006 Sep 25 8:03 AM
hi
good
you can use the collect statement in this way.
Collect:
When the line is inserted, the system checks whether there is already a table entry that matches the key. If there is no corresponding entry already in the table, the COLLECT statement has the same effect as inserting the new line. If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.
You should only use the COLLECT statement if you want to create summarized tables. If you use other statements to insert table entries, you may end up with duplicate entries.
GO THROUGH THIS LINK
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
thanks
mrutyun^
‎2006 Sep 25 8:29 AM
Hi,
Mrutyunjaya Tripathy is answer is very useful u can follow his answer.
Regards
Justin