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

get lowest value from ZTABLE.

Former Member
0 Likes
679

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

4 REPLIES 4
Read only

Former Member
0 Likes
654

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

Read only

Former Member
0 Likes
654

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

Read only

Former Member
0 Likes
654

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

Read only

Former Member
0 Likes
654

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'.