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

Open sql sum up issue

Former Member
0 Likes
684

Hi,

I need to sum up the action message of MRP List, but in MDKP the action message is char type, Once i use select sum( AUSZ1, AUSZ2, AUSZ3... ), the complier not allow me to do that. Can I sum up in open sql? because i need to use internal table to export to ALV Format, if i cannot sum up at open sql, i need to loop the internal table and update it. The performance seems not good. Thanks.

4 REPLIES 4
Read only

Former Member
0 Likes
634

sorry i cant get your actual requirement. But one thing you can not sum for character field in open sql . and it seems to me you want to COUNT the occurances. If it is so then use count fn instead of sum. Pls rectify me if i am wrong.

regards

shiba dutta

Read only

0 Likes
634

Thanks for your help first.

Actually, I would like to get the total number of action message in MRP List by each material, Using MD06, we can see that which separate 1-8 group for each action message,

for example, there have 2 action message under group 1 and 3 action message under group 6. In data dictionary, the type is char, i want to get the result is 5 (2+3). So, can i using open sql to retrieve the result. Thanks

Read only

0 Likes
634

Use Count Function and group by Message type.

for example -

Output the number of passengers, the total weight and the average weight of luggage for all Lufthansa flights on 28.02.2001:

DATA: count TYPE I, sum TYPE P DECIMALS 2, avg TYPE F.

DATA: connid TYPE 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.

Message was edited by:

Amit Tyagi

Read only

Former Member
0 Likes
634

what can i understand ferom your qery that you want the total no of rows for diferent message type.

if it is so

use count fn instead and give group by message type .

regards

shiba dutta