‎2008 Apr 22 7:11 AM
fOLLOWING SELECT STMT GIVING ERROR.cAN ANYONE TELL ME Y??
SELECT MATNR
WERKS
LGORT
ERSDA
SUM( LABST,SPEME,INSME,RETME,UMLME ) I
INTO TABLE T_MARD
FROM MARD
FOR ALL ENTRIES IN T_EKORG
WHERE WERKS = T_EKORG-WERKS AND
LGORT IN S_LGORT.
ERROR:COMMA WIDOUT PRECEDING COLON(AFTER SELECT?).
‎2008 Apr 22 7:19 AM
Hi,
Check whether the spaces of the bracket are provided or not.
It is the problem i think.
‎2008 Apr 22 7:20 AM
This might be because of the comma u have placed in between the field names whithin the sum clause of the select stmnt.
Try removing the comma and replace it with a space.
Reward if helpfull.
Jayadeep.
‎2008 Apr 22 7:21 AM
remove the spaces between ( and fieldnames .
eq
instead of ( f1 , f2 )
write (f1,f2)
‎2008 Apr 22 7:22 AM
hi
remove the spaces between the brackets and fields
use like this
SELECT MATNR
WERKS
LGORT
ERSDA
SUM ( LABST SPEME INSME RETME UMLME )
INTO TABLE T_MARD
FROM MARD
FOR ALL ENTRIES IN T_EKORG
WHERE WERKS = T_EKORG-WERKS AND
LGORT IN S_LGORT.
moreover
The statement SUM can only be specified within a loop starting with LOOP, and is only considered within a AT- ENDAT control structure. Prerequisites for using the statement SUM include using the addition INTO in the LOOP statement, and that the specified work area wa is compatible with the row type of the internal table. In addition, SUM cannot be used when the row type of the internal table itab contains components that are tables.
The statement SUM calculates the component total with the numeric data type (i, p, f) of all rows in the current control level and assigns these to the components of the work area wa. In the control levels FIRST, LAST, and outside of an AT-ENDAT control structure, the system calculates the sum of numeric components of all rows in the internal table.
reward if helpful
prasanth
‎2008 Apr 22 7:26 AM
Hi madan,
Don't give comas in fields whatever u used for SUM.
like this
SELECT MATNR
WERKS
LGORT
ERSDA
SUM( LABST SPEME INSME RETME UMLME ) I
INTO TABLE T_MARD
FROM MARD
FOR ALL ENTRIES IN T_EKORG
WHERE WERKS = T_EKORG-WERKS AND
LGORT IN S_LGORT.
If useful give reward,
Thanks ,
Narasimha
‎2008 Apr 22 7:30 AM
There is another option
Since you want to sum 4 fields, you can use 4 SUM clauses
and store result for each sum in another variable.
Finally you can add up these 4 variables to get the final sum.
eq
select f1 SUM(f2) sum(f3)
into (v_1,v_2,v_3)
from...
where...
v_f = v_1 + v_2 + v_3 .
Hope this solves the problem