Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sort Ztable

Hi All,

Currently i have a z-table with records.

How do i perform a sort with one of the fields before i do a Loop through all the records?

If i were to do a SORT <ZTABLE> BY <FIELD>, en error will occur indicating that this is not an internal table - the "OCCURS n" specification is missing.

Can some experts advise on how to solve this?




Former Member
Former Member replied

Hi, do u know what is the problem to sort an ztable created in SE11??

Actually it is a database table and we cannot sort a database table directly ,but we can bring all data in the ztable in an interbnal table and then we can perform the sort technique on any of the field.

you declare an internal table like the structure of ztable and select all data from database table to the internal table.

Data : i_table type standard table of ztable.


*select * from ztable into table i_table.*

Now apply sorting on the internal table.

Then modify the ztable from the internal table.

Please have a look in the answer. hope this will help.



0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question