2009 Oct 07 6:01 AM
Hi all,
I am Fresher to ABAP.I have a Requirement .
For a Invoice No , i want to COLLECT its Material no , Material Description , Invoice value , Invoice Quantity .
I Used COLLECT Statement FOR this . The Code is Given Below.
LOOP AT IT_DESP.
MOVE-CORRESPONDING IT_DESP TO IT_DESP1.
COLLECT IT_DESP1.
CLEAR: IT_DESP1.
ENDLOOP.
Here i am Populating Invoice No,Material no , Material Description , Invoice value , Invoice Quantity in Internal Table IT_DESP.
The COLLECT statement is not Working Here. Is the above code is Correct are not.
Regards
Sankar
Hi all,
I am Fresher to ABAP.I have a Requirement .
For a Invoice No , i want to COLLECT its Material no , Material Description , Invoice value , Invoice Quantity .
I Used COLLECT Statement FOR this . The Code is Given Below.
LOOP AT IT_DESP.
MOVE-CORRESPONDING IT_DESP TO IT_DESP1.
COLLECT IT_DESP1.
CLEAR: IT_DESP1.
ENDLOOP.
Here i am Populating Invoice No,Material no , Material Description , Invoice value , Invoice Quantity in Internal Table IT_DESP.
The COLLECT statement is not Working Here. Is the above code is Correct are not.
Regards
Sankar
2009 Oct 07 6:16 AM
Hi,
I dont see anything worng with your code. Just ensure that all the fields other than those which you want to sum are of char type while using COLLECT.
Vikranth
2009 Oct 07 6:50 AM
2009 Oct 07 6:54 AM
i dont think this code is wrong..
how have you declared the fields of itab1 and itab2?
can you show the definition of these internal tables?
2009 Oct 07 7:07 AM
Dear Sankara,
To provide you an answer why COLLECT is not working we need to have insight on how you have defined the table IT_DESP1.
And for the record, please make it a point of doing an F1 & reading the SAP documentation whenever you are faced with this kind of situation.
BR,
Suhas
2009 Oct 07 8:51 AM
Hi Sankara ,
Collect statement is used to add all the numeric components to the corresponding values of all the existing rows in an internal table , with the same key . The data type can be I , P , F .
Please ensure that there is a comman value in all the rows .
check this out and let me know if any issues
Regards,
Kavitha
2009 Oct 07 9:36 AM
hi
why do you need to use collect statement inside the loop. Move statement is already appending the records in the table .
use collect statement after the loop. This will serve the same purpose.
Hope it helps.
Regards
Geeta Gupta
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |