cancel
Showing results for 
Search instead for 
Did you mean: 

to find a largest number

Former Member
0 Kudos

Hello all ,

I had field in ztable name is doc_id.

and it has the data like

Doc_id

121

122

123

124

125

122

like this .i want to pic the largest number in that fields .

Could u please help in this .

thanking you,

urs,

suman

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Suman,

Use the below code.

SELECT * From ztable INTO gt_table.

SORT gt_table doc_no descending.

READ gt_table index 1.

You ll have the larggest no. now in gt_table-doc_no.

Br/Manas

Answers (1)

Answers (1)

former_member226519
Active Contributor
0 Kudos

use simple select statement:

SELECT MAX( your_field_in_z_table ) FROM ztabel INTO your_variable.

Attention: no space between MAX and bracket but spaces between bracket and fieldname.