2007 Oct 23 3:16 PM
Hi All,
The following code is using ABAP OO and I get the following error
E:The addition "FOR ALL ENTRIES" excludes all aggregate functions with
the exception of "COUNT( * )", as the single element of the SELECT
clause.
Here is the Code:
select a/bic/ZEDM_ENTP amaterial a~/bic/zedm_stid
a/bic/ZEDM_SDT a/bic/ZEDM_MINH a~/bic/ZEDM_EHD
SUM( b~/bic/ZEDM_QPLN )
c~/bic/ZDEMQTY
from /bic/azdrp_1900 as a inner join /bic/azdrp_0400 as b
on
a/bic/ZEDM_ENTP = b/bic/ZEDM_ENTP and
amaterial = bmaterial and
a/bic/zedm_stid = bplant and
a/bic/ZEDM_SDT = b/bic/zedm_pshp
inner join /bic/azrp_0800 as C
on
amaterial = cmaterial and
a/bic/zedm_stid = c/bic/zedm_stid and
a/bic/ZEDM_SDT = c/bic/ZEDM_ESDT
into table z_it_inv for all entries in
RESULT_PACKAGE where
a~/bic/ZEDM_ENTP = RESULT_PACKAGE-/bic/ZEDM_ENTP
and a~material = RESULT_PACKAGE-material
and a~/bic/ZEDM_SDT = RESULT_PACKAGE-/BIC/OIZEDM_EDT
and a~/bic/zedm_stid = RESULT_PACKAGE-/BIC/OIZEDM_TOST
group by b/bic/ZEDM_ENTP bmaterial b~plant
b~/bic/zedm_pshp
Can you please tell me how to correct this?
Thanks
2007 Oct 23 3:25 PM
When you are using for 'all entries' you can not use SUM because it is an aggregate function.
Hi,
You can get all records first and then LOOP AT Internal table and use COLLECT statement to sum up required column.
This will be a better idea than trying to use SUM in SELECT with JOINS.
ashish
2007 Oct 23 3:25 PM
When you are using for 'all entries' you can not use SUM because it is an aggregate function.
2007 Oct 23 3:50 PM
Krishna,
Is there a workaround for this? I need to use for all entries and want to do the summation of a particular colum.
Thanks
Deepa
2007 Oct 23 3:52 PM
Aggregate functions are not very efficient. Try doing the SUM after the data is selected.
Rob
2007 Oct 23 3:53 PM
Hi,
You can get all records first and then LOOP AT Internal table and use COLLECT statement to sum up required column.
This will be a better idea than trying to use SUM in SELECT with JOINS.
ashish
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |