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

join table SUM using for all entries

muhammad_sohail
Participant
0 Likes
721

Dear All,

Will anyone pls. tell me what is the problem in this query, it is not working.

SELECT aufnr SUM( menge )

INTO CORRESPONDING FIELDS OF TABLE itab_aufnr

FROM mkpf

INNER JOIN mseg ON msegmblnr EQ mkpfmblnr AND mkpfmjahr EQ msegmjahr

FOR ALL ENTRIES IN itab_rework

WHERE mseg~aufnr = itab_rework-aufnr

GROUP BY aufnr.

Regards,

Moderator message: please search for available information before asking, "it's not working" is not a proper error description.

Edited by: Thomas Zloch on Dec 6, 2010 9:41 AM

Dear All,

Will anyone pls. tell me what is the problem in this query, it is not working.

SELECT aufnr SUM( menge )

INTO CORRESPONDING FIELDS OF TABLE itab_aufnr

FROM mkpf

INNER JOIN mseg ON msegmblnr EQ mkpfmblnr AND mkpfmjahr EQ msegmjahr

FOR ALL ENTRIES IN itab_rework

WHERE mseg~aufnr = itab_rework-aufnr

GROUP BY aufnr.

Regards,

Moderator message: please search for available information before asking, "it's not working" is not a proper error description.

Edited by: Thomas Zloch on Dec 6, 2010 9:41 AM

3 REPLIES 3
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
664

Your syntax check will clearly explain the problem. Aggregate functions are not allowed with for all entries.

Please check yourself before posting because the syntax message itself explains thats.

Read only

0 Likes
664

It's means that I cannot use aggregate functions with for all entries, but I want to take the sum() on the basis of aufnr. When I have used it in loop it is taking so much time to execute.

How I should solve this problem.

Thanks.

Read only

0 Likes
664

When I have used it in loop it is taking so much time to execute.

That depends upon the amount of data you are processing and the set of codes written inside the loop. For sum you have to use collect statement or a SUM statement inside a control break statement.