2007 Sep 27 3:53 PM
hi ABAP Gurus,
i have one table where we store material number , customer number ,date and price.
for example:
CUSTOMER-1 MATERIAL-1 01/01/2007 20.00
CUSTOMER-1 MATERIAL-1 02/01/2007 15.00
CUSTOMER-1 MATERIAL-1 01/04/2007 25.00.
I have table like above and i want minimum price here 15.00.
how do i write select query . i am passing customer number and material number.
Thanks,
Neo
hi ABAP Gurus,
i have one table where we store material number , customer number ,date and price.
for example:
CUSTOMER-1 MATERIAL-1 01/01/2007 20.00
CUSTOMER-1 MATERIAL-1 02/01/2007 15.00
CUSTOMER-1 MATERIAL-1 01/04/2007 25.00.
I have table like above and i want minimum price here 15.00.
how do i write select query . i am passing customer number and material number.
Thanks,
Neo
2007 Sep 27 3:56 PM
Use SELECT max ( price ) from tab into xxx
where ur conditions.
or select entires into a table and sort descending by price and read the frst entry.
Sri
2007 Sep 27 3:56 PM
You can write simple logic as like below :
tables : ztable.
data wa_ztable type ztable.
select * from ztable up to 1 rows into wa_ztable
order by price descending .
endselect.
Thanks
Seshu
2007 Sep 27 3:57 PM
Hello Neo,
Do like this.
<b>
Select * from ztable into table itab where kunnr in s_kunnr
and matnr in s_matnr.
sort itab by price descending.
read table itab index 1.
write: itab-price.</b>
Hope this will solve ur problem.
Cheers,
Vasanth
2007 Sep 27 3:59 PM
Hi,
Use this below in ur select query,
MIN( [DISTINCT] col ) Determines the minimum value of the content of the column col in the resulting set or in the current group.
e.g
select min(field1) from ztable where field2 = 'XYZ'.