Application Development and Automation 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: 
Read only

select problem

Former Member
0 Likes
753

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
Read only

Former Member
0 Likes
718

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
Read only

Manohar2u
Active Contributor
0 Likes
718

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

Regds

Manohar

Read only

Former Member
0 Likes
719

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

Read only

0 Likes
718

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...

Read only

Former Member
0 Likes
718

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