‎2007 Apr 17 2:46 PM
Hello All,
I have EBELN and EBELP with me.
WIth this I want to select only one record from EKEK where the field ABRUF has the max. value.
I don't want to select all the records and then sort it and the n delete the records with index gt 1.
Instead I want to Select from the EKEK Table only one record at once using Select single .
But I'm not able to get an Idea of how-to ?
Can any one tell me how to fetch this single record ?
Regards,
Deepu.K
‎2007 Apr 17 2:52 PM
‎2007 Apr 17 2:52 PM
‎2007 Apr 17 2:52 PM
SELECT ebeln ebelp max( abruf ) from EKEK
into itab
where .....
Hope this helps.
Sudha
Message was edited by:
Sudha Mohan
‎2007 Apr 17 2:55 PM
Hi,
Please try this.
DATA: V_ABRUF LIKE EKEK-ABRUF.
SELECT MAX( ABRUF )
INTO V_ABRUF
FROM EKEK
WHERE EBELN = P_EBELN
AND EBELP = P_EBELP.
WRITE: / V_ABRUF.
Regards,
Ferry Lianto
‎2007 Apr 17 3:00 PM
Hi,
MAX( [DISTINCT] col ) Determines the maximum value of the value in the column col in the resulting set or in the current group
Select MAX( ABRUF )
from EKEK
into Itab
where EBELN eq ______
and EBELP eq ______ .
with regards,
jay.
‎2007 Apr 17 3:09 PM
Hello All,
Thanks for ur reply.
But I was getting an error when I used ur Statements as it is.
SO I used like this:-
LOOP AT gt_temp_data INTO gwa_temp_data.
SELECT ebeln ebelp MAX( abruf ) FROM ekek
INTO CORRESPONDING FIELDS OF TABLE gt_ekek
WHERE ebeln = gwa_temp_data-ebeln
AND ebelp = gwa_temp_data-ebelp
GROUP BY ebeln ebelp abruf.
ENDLOOP.
This solved my problem .
But I want to use for-all-entries.
Can u guys tell me how to use this bcoz I'm getting an error once again saying :-
"The addition for-all-entries excludes all aggregate functions with the exceptionof count(*) as the single element of the select clause ".
Regards,
Deepu.K
null
null
‎2007 Apr 17 3:35 PM
‎2007 Apr 17 3:33 PM
Hi Deepu,
If you use FOR ALL ENTRIES, you can not have aggregate functions other than COUNT(*).
Regards,
Ferry Lianto