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

Appropriate select querry needed

Former Member
0 Likes
649

Hi Experts,

f lt_/bic/qzcdcy[] is not initial.

SELECT /bic/zcdcy MIN( act_due )

FROM /bi0/mcdcy_act

INTO TABLE lt_zdrgsrnrr

FOR ALL ENTRIES IN lt_/bic/qzcdcy

WHERE /bic/zcdcy eq lt_/bic/qzcdcy-/bic/zcdcy

AND act_type = '9055'

AND act_end NE '00000000'

AND act_stat = 1

GROUP BY /bic/zcdcy.

Endif.

I am using above query but what i got the error write bellow

The addition "FOR ALL ENTRIES" excludes all aggregate functions with

the exception of "COUNT( * )" as the single element of the SELECT clause.

Regards,

dhanu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
517

Hi,

replace MIN( act_due ) with act_due and you will get duplicates.

Sort your result table lt_zdrgsrnrr by /bic/zcdcy and act_due ascending and use

DELETE ADJACENT DUPLICATES FROM lt_zdrgsrnrr COMPARING /bic/zcdcy.

to get your wanted results.

Regards,

Klaus

3 REPLIES 3
Read only

Former Member
0 Likes
518

Hi,

replace MIN( act_due ) with act_due and you will get duplicates.

Sort your result table lt_zdrgsrnrr by /bic/zcdcy and act_due ascending and use

DELETE ADJACENT DUPLICATES FROM lt_zdrgsrnrr COMPARING /bic/zcdcy.

to get your wanted results.

Regards,

Klaus

Read only

Former Member
0 Likes
517

you can not combine aggregates with FOR ALL ENTRIES (the COUNT(*) expample is a dummy problem).

So do the SELECT and then calculate the MIN.

You don't need the DELETE ADJACENT DUPLICATES, as this is anyway done by the FAE.

Read only

0 Likes
517

Sorry Siegfried, you're wrong, the DELETE is for calculation of the MIN() and it is necessary! Duplicates from FAE only will be deleted for duplicate combinations of both fields. Here DELETE is needed to find the one and only right combination of both fields after the SORT!

Regards,

Klaus