Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

select problem

Former Member
0 Kudos

this work

SELECT SINGLE SUM( mzubb )

SUM( magbb )

FROM s033

INTO (z_mzubb , z_magbb )

WHERE werks = <ls_mard>-werks

AND lgort = <ls_mard>-lgort

AND matnr = <ls_mard>-matnr

AND sptag BETWEEN date and date_e.

<b>and this dont work in the same prog

i mean i dont have data in is033 (in se16 i get value)</b>

SELECT mblnr

sptag

matnr

lgort

werks

mzubb

magbb

FROM s033

INTO CORRESPONDING FIELDS OF TABLE is033

WHERE werks = <ls_mard>-werks

AND lgort = <ls_mard>-lgort

AND matnr = <ls_mard>-matnr

AND sptag BETWEEN date and date_e.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try the GROUP BY CLAUSE addition

SELECT SINGLE SUM( mzubb )

SUM( magbb )

FROM s033

INTO (z_mzubb , z_magbb )

WHERE werks = <ls_mard>-werks

AND lgort = <ls_mard>-lgort

AND matnr = <ls_mard>-matnr

AND sptag BETWEEN date and date_e

<b>GROUP BY WERKS LGORT MATNR </b>.

Regards,

Ravi

4 REPLIES 4

Manohar2u
Active Contributor
0 Kudos

Use second select statement to have <b>sptag</b> in internal table for your further processing.

Regds

Manohar

Former Member
0 Kudos

Try the GROUP BY CLAUSE addition

SELECT SINGLE SUM( mzubb )

SUM( magbb )

FROM s033

INTO (z_mzubb , z_magbb )

WHERE werks = <ls_mard>-werks

AND lgort = <ls_mard>-lgort

AND matnr = <ls_mard>-matnr

AND sptag BETWEEN date and date_e

<b>GROUP BY WERKS LGORT MATNR </b>.

Regards,

Ravi

0 Kudos

Ah but in order to use the group by you would need to have those fields in the select.... (SQL 1/1) and using select single would then still limit you to the first row...

Former Member
0 Kudos

You should remove select single. and should added by group clause of the fields you have added in your select query.