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

MAX VALUE

Former Member
0 Likes
1,268

Hi experts

I want to find the max value of a particular column in internal table and store in a variable.

tell me any methodes.

thanks in advance

Regards

Rajaram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,148
SORT ITAB BY FIELD1 DESCENDING.

READ TABLE ITAB INDEX 1.

MAX_VALUE = ITAB-FIELD1.
7 REPLIES 7
Read only

Former Member
0 Likes
1,149
SORT ITAB BY FIELD1 DESCENDING.

READ TABLE ITAB INDEX 1.

MAX_VALUE = ITAB-FIELD1.
Read only

0 Likes
1,148

BUT CAN WE IT WITHOUT SORTING.

Read only

0 Likes
1,148

Hi,

see my post to this thread.

rgds,

bharat.

Read only

Former Member
0 Likes
1,148

HI,

before filling the internal table we can get it.

data :max_lifnr type lfa1-lifnr.

select max( lifnr ) into max_lifnr from lfa1.

or else u can do like this.

<b>data :max_lifnr type lfa1-lifnr.

data:itab like lfa1 occurs 0 with header line.

select * into table itab from lfa1.

loop at itab.

if max_lifnr > itab-lifnr.

max_lifnr = itab-lifnr.

endif.

endloop.

write:/ max_lifnr.</b>

(or)

data :max_lifnr type lfa1-lifnr.

data:itab like lfa1 occurs 0 with header line.

select * into table itab from lfa1.

sort itab by lifnr descending.

read table itab index 1.

max_lifnr = itab-lifnr.

write:/ max_lifnr.

<b>please reward all helpful answers</b>

rgds,

bharat.

Read only

Former Member
0 Likes
1,148

Hi raja,

Data maxi like ztable-mark1.

select max(mark1) into maxi from ztable.

<b>Regards,

Azhar</b>

Read only

Former Member
0 Likes
1,148

HI,

sort itab by fldname DESCENDING.

DATA MAX TYPE C.

READ TABLE ITAB INDEX SY-INDEX.

MAX = ITB-FLDNAME.

WRITE:/10 MAX.

IF HELPFUL REWARD SOME POINTS.

WITH REGARDS,

SURESH ALURI.

Read only

Former Member
0 Likes
1,148

hi,

try this.

tables : zemployee.

data : sal like zemployee-salary.

select max( salary ) into sal from zemployee.

if sy-subrc = 0.

write 😕 sal.

endif.

Reward with points if useful.