Application Development 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: 

RFC_READ_TABLE results sorting

Monsores
Active Participant
0 Kudos

Hi all.

Does anyone know the sort criteria used by RFC_READ_TABLE?

I have a table with 5 fields and about 18000 records. The only column that i want is SITE_DESCRIPTION, and the table was generated sorted by this field. When I use RFC_READ table the results come in a illogical order. It's neither sorted by SITE_DESCRIPTION (like the table) nor by any of the other fields, like SITE_CODE. I thought that, without the "ORDER BY" clause, RFC_READ_TABLE was going to give me the results in the same order of the database table. But, although random, the result sorting is always exactly the same.

How can I get these results sorted (or at least in the same order of the table)? I cannot sort the results later on the software which is receiving them cause I don't have access to its source code. This software is SAP GRC-AC/ERM, where the results set is used as a custom attribute. It's being a big headache to the user to find what he wants in an unordered list containing 18K items.

Sorry if it's an easy question, but I'm new to SAP.

Thanks in advance.

Marcelo

2 REPLIES 2

Former Member
0 Kudos

How about a quick check in the ABAP online help on the [select|http://help.sap.com/abapdocu_70/en/ABAPSELECT.htm] statement, where we find the [order by|http://help.sap.com/abapdocu_70/en/ABAPORDERBY_CLAUSE.htm] reference:

The order of the rows in the result set refers to all columns that are not listed after ORDER BY, are undefined, and can be different in repeated executions of the same SELECT statement.

If you want to ensure that your rows are returned in a specific order, you have to use the order by clause. Note that there is no database order, because the way the database returns the data depends on how the data is read and returned. E.g. when a specific index is used data is returned in the order of that particular index, but if you have a non-unique index it is still not clear, which order the rows have for non-unique values.

RFC_READ_TABLE doesn't allow you to specify any order by clause as far as I remember...

Monsores
Active Participant
0 Kudos

Thanks for the help, Harald.

We are gonna ask SAP to solve the sorting problem on the GRC-AC/ERM side or to permit us to use our own RFC instead of RFC_READ_TABLE, so we can add the "order by" clause.