Skip to Content
0
Former Member
Apr 22, 2009 at 07:14 AM

MAX( ) function in 2 columns... Wrong Data

2379 Views

Hi Folks,

I have A DDIC Table with

mandt, Destination, Date, Time, KUNNR and some other columns.

Now I want to determine the LATEST entry for a KUNNR.

Now I did:

SELECT

mandt desti kunnr MAX( erdat )

MAX( ertim ) [..other nonkey fields.]

FROM MYTABLE INTO wa

WHERE desti = '10010'

AND kunnr = '0000000005'

AND not_checked = 'X'

GROUP BY mandt desti kunnr [..other nonkey fields.].

WRITE [ALL FIELDS]

ENDSELECT.

Now I get 5(!) results:

001 RE3_001 5 11.03.2009 12:59:55

001 RE3_001 5 12.03.2009 15:29:01

001 RE3_001 5 11.03.2009 19:27:50

001 RE3_001 5 11.03.2009 13:23:30

001 RE3_001 5 30.06.2008 16:45:26

what is that?

I only needed the 12.03.2009 at 15:29:01 .....

what do I do wrong?

what about the MAX() ?

THX