‎2008 Jan 31 9:49 AM
Hi when I writing the following select statement
SELECT SUM( menge )
INTO sumgood
FROM aufm
WHERE ( bwart EQ '101' or bwart EQ 'X01' )
AND matnr EQ it_afpo-matnr
AND aufnr EQ t_prodbom-aufnr.
It gives me a error message the statement is not accesible,
Pls send the modified statement, give u full points.
regards
Sasi
‎2008 Jan 31 9:53 AM
If you are written it in a REPORT program,
try to insert 'START-OF-SELECTION' before the query.
ie,
START-OF-SELECTION.
QUERY.
‎2008 Jan 31 9:53 AM
sumgood should be the same type of menge
u need to use for all entries
‎2008 Jan 31 9:53 AM
If you are written it in a REPORT program,
try to insert 'START-OF-SELECTION' before the query.
ie,
START-OF-SELECTION.
QUERY.
‎2008 Jan 31 9:55 AM
Hi,
SELECT SINGLE SUM( menge )
INTO sumgood
FROM aufm
WHERE ( bwart EQ '101' or bwart EQ 'X01' )
AND matnr EQ it_afpo-matnr
AND aufnr EQ t_prodbom-aufnr.
Cheers,
Will.
‎2008 Jan 31 9:55 AM
Hi,
can u give me u r entire code so that i can try to coreect it.
Regards
sunil
‎2008 Jan 31 9:56 AM
If i remove the two following lines,
AND matnr EQ it_afpo-matnr
AND aufnr EQ t_prodbom-aufnr.and define
sumgood LIKE aufm-mengethe program works well. so, the question is :
Are it_afpo and t_prodbom internal table with header line?
, if not use explicit work area, or use a SELECT FOR ALL ENTRIES syntax.
Regards
‎2008 Jan 31 9:57 AM
sashi,
Use GROUP BY caluse in your select statement.
Ex:
SELECT SUM( menge )
INTO sumgood
FROM aufm
WHERE ( bwart EQ '101' or bwart EQ 'X01' )
AND matnr EQ it_afpo-matnr
AND aufnr EQ t_prodbom-aufnr
GROUP BY matnr." Here on which field base you are summing the merge"
Don't forget to reward if useful....
‎2008 Jan 31 10:01 AM
Sashi,
TRY like this also.
WHERE bwart IN ( '101' , 'X01' ).
SELECT SUM( menge )
INTO sumgood
FROM aufm
WHERE bwart IN ( '101' , 'X01' )
AND matnr EQ it_afpo-matnr
AND aufnr EQ t_prodbom-aufnr.
Don't forget to reward if useful....
‎2008 Jan 31 10:09 AM
Hi,
Check the syntax of SUM:
SUM( [DISTINCT] col ) Determines the sum of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
Regards,
Bhaskar