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

Internal Table

We sort values in the internal table according to dept(for eg).But when we display values it is displayed randomly(by eno...) inside that grouped values.What is the reason for this?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 12:19 PM

    sort itab by dept.

    Ensure that there is no other sort statement before displaying output.

    Regards

    vasu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 12:20 PM

    Hi Mani,

    Sort command is working with resprct to ky field only.

    So based on key fields only it makes the process.

    Thanks,

    Reward If Helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 19, 2007 at 12:22 PM

    hi,

    try this :

    sort <internal table > by <fieldname>.

    if u did the same plz paste the coding

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 12:22 PM

    Hello,

    Your key field may be eno.

    Regards,

    LIJO

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Your dept field should be at the first, second or third row of your internal table for it to become a key.

      If you issue a sort command with your dept field located on those rows. It should be sorted now.

      sort table by dept ascending/descending.
      

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 12:24 PM

    if u r using sorting with non primary keys u need to create secondary index with that use read statement with binary search ...

    hope this will help u....

    reward points if helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 12:25 PM

    They are using aggregate functions on dept wise (sum,avg,no of entries) and displaying the employee to the concern department.

    For e.g.

    EMPID EMPNAME SAL DEPT

    100 RAGHUVANAN 1000 10

    101 RAGHUVANAN 1000 20

    102 RAGHUVANAN 1000 10

    103 RAGHUVANAN 1000 30

    10 -


    > 2000

    100 RAGHUVANAN 1000 10

    102 RAGHUVANAN 1000 10

    20 -


    > 1000

    101 RAGHUVANAN 1000 20

    30 -


    > 1000

    103 RAGHUVANAN 1000 30

    Sorting done Department wise ---> Tries to retrieve the sum

    Displaying the employee id -


    > Keyfiedl to retrieve the data

    Regards

    Bhupal Reddy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 01:27 PM

    Just try sort <table> by <field1> ascending (or descending)

    <field2> ascending (or descending)

    .....

    You could also try

    sort <table>

    without the field addition, than it will sort on all fields, ascending, in the order they are defined in the internal table.

    Please reward points if helpful.

    Kind regards,

    Bart

    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.