Skip to Content
author's profile photo Former Member
Former Member

Choosing the biggest value of the given value..

Hi

Suppose, I have say following values in my internal table:-

1

8

90

60

40

50

70

And I want to pick the largest of the given numbers in only one command.

How can I do that?

Thank You

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2006 at 09:24 AM

    U can do that using two statement.

    SORT itab by F1 DESCENDING.

    READ TABLE itab index 1.

    The value of itab-F1 will give you the max value.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 25, 2006 at 09:25 AM

    Hi

    var is the highest number.

    Sort the internal table,

    describe int table lines Fill.

    read itab index fill.

    if sy-subrc = 0.

    var = itab-field.

    endif.

    Regards

    Gopi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2006 at 09:28 AM

    Hi,

    use below logic

    sort itab by val descending.

    read table itab index 1.

    Regards

    amole

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 25, 2006 at 09:35 AM

    hi,

    chk this.

    SORT ITAB BY VAL DESCENDING.

    READ TABLE ITAB INDEX 1.

    WRITE ITAB-VAL.

    rgds

    anver

    pls mark all hlpful answers

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 25, 2006 at 09:40 AM

    Hi,

    Well if you have data in internal table and then want to get the max. value then its not possible in single line.

    If you are selecting data from a table, then its possible :

    Select max ( amount )

    from ZTABLE

    into l_amount.

    Best regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.