‎2007 Mar 01 7:36 AM
Hii guyz...
Need lill help ..got some prob with the codes below..
LOOP AT i_delivery INTO w_delivery.
SELECT SINGLE knumv FROM vbak
INTO (w_delivery-knumv)
WHERE vbeln = w_delivery-vgbel.
MODIFY i_delivery FROM w_delivery.
ENDLOOP.
IF i_delivery[] IS NOT INITIAL.
REFRESH i_konv.
--->> SELECT knumv SUM ( kbetr ) INTO TABLE i_konv FROM konv
FOR ALL ENTRIES IN i_delivery
WHERE knumv = w_delivery-knumv
AND kposn = w_delivery-vgpos
AND kschl = c_condtype4.
GROUP BY knumv.
ENDIF.
In the 2nd SELECT statment , it gives a syntax error saying SUM is unidentified,
its the SUM as col , i dont know ..
the same code i hv written in other programs ,thats workin fine ..
please help
thanks ...Jahan
‎2007 Mar 01 8:19 AM
Hey guyz look here ...
if i write code like this ..down here ..
*// Get VBELN from VBRP
CLEAR : l_knumv, l_vbeln.
SELECT SINGLE vbeln
INTO (l_vbeln)
FROM vbrp
WHERE vgbel = w_delivery-vbeln
AND vgpos = w_delivery-posnr.
IF sy-subrc = 0.
IF l_vbeln IS NOT INITIAL.
*// Get KNUMV from BVRK
CLEAR :a_knumv.
SELECT SINGLE knumv
INTO (a_knumv)
FROM vbrk
WHERE vbeln = l_vbeln.
w_delivery-knumv = a_knumv.
IF sy-subrc = 0.
SELECT SUM( kbetr ) FROM konv INTO w_delivery-frval
WHERE knumv = w_delivery-knumv
AND kposn = w_delivery-vgpos
AND kschl = c_condtype4.
IF sy-subrc = 0.
w_delivery-frval = l_kbetr.
pfrval = w_delivery-frval.
ENDIF.
ENDIF.
ELSE.
See here i m putting the SUM into a variable ,
n i hv deletd the space in betwn ..
now it says ..SUM is not supported for fields of pooled or cluster table
where as my KONV is transprnt table ..
pleeeeZZ help ...
my A** is on the line ...
thnx..
jahan
‎2007 Mar 01 7:37 AM
HI,
y cannt u move that sum(...) to some variable and specify the same here.
‎2007 Mar 01 7:38 AM
Hi Jahan,
SQL Statement syntax should look like this and it wored fine for me.
SELECT SUM( ANTPROZ ) INTO LV_PER1 from table.
Hope that helps.
Regards
Kapadia
‎2007 Mar 01 7:38 AM
Remove gaps after sum
SELECT knumv SUM( kbetr ) INTO TABLE i_konv FROM konv
FOR ALL ENTRIES IN i_delivery
WHERE knumv = w_delivery-knumv
AND kposn = w_delivery-vgpos
AND kschl = c_condtype4.
GROUP BY knumv.
‎2007 Mar 01 7:40 AM
You must select SUM only in variables.
And then apeend to your table.
Why do you need add sum into table?
‎2007 Mar 01 7:54 AM
Hi
Example to find the number of passengers, the total luggage weight, and the average weight of the luggage for all Lufthansa flights on 02/28/2001:
DATA: count TYPE I, sum TYPE P DECIMALS 2, avg TYPE F,
connid LIKE sbook-connid.
SELECT connid COUNT( * ) SUM( luggweight ) AVG( luggweight )
INTO (connid, count, sum, avg)
FROM sbook
WHERE
carrid = 'LH ' AND
fldate = '20010228'
GROUP BY connid.
WRITE: / connid, count, sum, avg.
ENDSELECT.
I think this code snipet will help
Regards,
Harsha
*Reward points if helpful...
‎2007 Mar 01 8:19 AM
Hey guyz look here ...
if i write code like this ..down here ..
*// Get VBELN from VBRP
CLEAR : l_knumv, l_vbeln.
SELECT SINGLE vbeln
INTO (l_vbeln)
FROM vbrp
WHERE vgbel = w_delivery-vbeln
AND vgpos = w_delivery-posnr.
IF sy-subrc = 0.
IF l_vbeln IS NOT INITIAL.
*// Get KNUMV from BVRK
CLEAR :a_knumv.
SELECT SINGLE knumv
INTO (a_knumv)
FROM vbrk
WHERE vbeln = l_vbeln.
w_delivery-knumv = a_knumv.
IF sy-subrc = 0.
SELECT SUM( kbetr ) FROM konv INTO w_delivery-frval
WHERE knumv = w_delivery-knumv
AND kposn = w_delivery-vgpos
AND kschl = c_condtype4.
IF sy-subrc = 0.
w_delivery-frval = l_kbetr.
pfrval = w_delivery-frval.
ENDIF.
ENDIF.
ELSE.
See here i m putting the SUM into a variable ,
n i hv deletd the space in betwn ..
now it says ..SUM is not supported for fields of pooled or cluster table
where as my KONV is transprnt table ..
pleeeeZZ help ...
my A** is on the line ...
thnx..
jahan
‎2007 Mar 01 8:24 AM
‎2007 Mar 01 8:41 AM
ohh ...yaa thanx ...
yes sir KONV is clustr table..
thank u very much Ravi..
‎2007 Mar 01 8:23 AM
Hi ,
here again u r using sum as:
SELECT SUM( kbetr ) FROM konv INTO w_delivery-frval
so try to move into some variable and try