‎2008 Jun 20 4:56 AM
Hi experts,
I want to fetch records(PR PO bwart) against maximum movement type(bwart).
Is there max function in abap or tell me some alternative
Select PR PO max(bwart) from ekbe into i_ekbe
group by PR PO bwart.
Is this code correct.
Savita
‎2008 Jun 20 5:00 AM
Hi,
yes the code is right. the max fucntion u used is the right way to find the max value.
regards,
madhu
‎2008 Jun 20 5:22 AM
Hi madhu,
Can u tell me , the group by clause with left join & where caluse.
It is showing an error The field "AEBELP" from the SELECT list is missing in the GROUP BY clause. addition INTO wa or INTO (g1,...,gn) is required. fields of type "" or "BWERKS".
select abanfn aekgrp aafnam atxz01 amatnr awerks algort abednr
amenge ameins abadat afrgdt aebeln aebelp bebeln bebelp
bbelnr max( bbwart ) bbudat bmenge b~matnr
b~werks
from ( eban as a left outer join ekbe as b on
aebeln eq bebeln and
aebelp eq bebelp )
into corresponding fields of
table eban_ekbe
where a~ekgrp in s_ekgrp and
a~afnam in s_afnam and
a~matnr in s_matnr and
a~werks eq p_werks and
a~lgort in s_lgort and
a~badat in s_badat
group by bebeln bebelp bbelnr bbwart bbudat bmenge b~matnr
b~werks.
I have to put group by on my second table
Savita
‎2008 Jun 20 5:05 AM
Hi,
The movement types are defined as numbers like 561 etc.So if you use MAX then highest number is selected.If you wish to have the same thing then your code is correct.