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

Help require in Internal table condition

Former Member
0 Likes
858

Hi Experts,

i have Internal table(itab) while debuging i am getting fellowing type of records.

KSCHL KBETR WAERS

ZZ10 | 200.00 |EUR

ZPNL | 117.00 |EUR

ZPRA | 115.00 |EUR

ZZ10 | 300.00 |EUR

ZZ10 | 200.00 |EUR

ZZ10 | 350.00 |EUR.

i want to compare the ZZ10 values, I need the lowest value, how to compare?

in the above i need zz10 with the value of 200 only.

How to compare, and how to select the lowest value only.

Any one help this,

Point will be sure.

Mohana

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
833

Help require in Internal table condition

Posted: Apr 3, 2008 8:49 AM E-mail this message Reply

Hi Experts,

i have Internal table(itab) while debuging i am getting fellowing type of records.

KSCHL KBETR WAERS

ZZ10 | 200.00 |EUR

ZPNL | 117.00 |EUR

ZPRA | 115.00 |EUR

ZZ10 | 300.00 |EUR

ZZ10 | 200.00 |EUR

ZZ10 | 350.00 |EUR.

i want to compare the ZZ10 values, I need the lowest value, how to compare?

in the above i need zz10 with the value of 200 only.

How to compare, and how to select the lowest value only.

Any one help this,

Point will be sure.

Mohana

sort table by kscl kbetr.

loop at itab where kschl = 'ZZ10'.

AT FIRST.

" you have your lowest value

ENDAT.

endloop.

6 REPLIES 6
Read only

Sm1tje
Active Contributor
0 Likes
833

sort the table KSCHL KBETR and take for every new KSCHL take the first entry using

for example ON CHANGE OF, or AT NEW.

Read only

Former Member
0 Likes
834

Help require in Internal table condition

Posted: Apr 3, 2008 8:49 AM E-mail this message Reply

Hi Experts,

i have Internal table(itab) while debuging i am getting fellowing type of records.

KSCHL KBETR WAERS

ZZ10 | 200.00 |EUR

ZPNL | 117.00 |EUR

ZPRA | 115.00 |EUR

ZZ10 | 300.00 |EUR

ZZ10 | 200.00 |EUR

ZZ10 | 350.00 |EUR.

i want to compare the ZZ10 values, I need the lowest value, how to compare?

in the above i need zz10 with the value of 200 only.

How to compare, and how to select the lowest value only.

Any one help this,

Point will be sure.

Mohana

sort table by kscl kbetr.

loop at itab where kschl = 'ZZ10'.

AT FIRST.

" you have your lowest value

ENDAT.

endloop.

Read only

Former Member
0 Likes
833

sort ur itab and use select single * from itab where kschl = 'zz10'



U never close ur thread ?


Read only

Former Member
0 Likes
833

Better SORT internal T with kschl,kbetr..

else

use some Aritmetic fun:-MIN

Read only

Former Member
0 Likes
833

sort i_tab by kschl kbetr.

select single * from i_tab where kschl = 'ZZ10'.

reward if useful.

Read only

Former Member
0 Likes
833

declare another internal table jtab of same structre as itab.

for all KSCHL with same name as ZZ10. append the row with least value to jtab.

SORT itab BY KSCHL KBETR WAERS.

LOOP AT itab.

ON CHANGE OF KSCHL.

APPEND itab TO jtab.

CLEAR itab.

ENDON.

ENDLOOP.

All the other records that have KSCHL in common are sorted and the lowest value record is appended to the jtab int tab.

READ TABLE jtab with key KSCHL = 'ZZ10'.

if sy-subrc = 0.

(DO WHAT EVER U WANT WITH THE RECORD & VALUE YOU WANT)

endif.

Regards,

Srinivas