2014 Aug 25 5:52 PM
Experts,
From SAP Help,
If no explicit sort key is entered using the BY addition, the internal table itab is sorted according to the table key.
I have code as below,
data: lt_vkonto type table of VKONT_KK. "Cont Acc No
"Fetch Cont Acc no against Contract
select vkonto from ever into table lt_vkonto where vertrag = wa_data-vertrag.
if sy-subrc eq 0.
sort lt_vkonto.
endif.
As seen above, I have sort statement without BY addition for internal table lt_vkonto which does not have a UNIQUE or NON UNIQUE key.
Will adding BY addition --> SORT lt_vkonto by vkonto imrpove the performance of sort statement.
Please share your valuable inputs.
BR,
Aspire
2014 Aug 25 6:00 PM
Hi
I don't know if you'll imporve the performace in your case, you should do some measurement, the problem should be the table key for a standard internal table (like yours) is the set of all CHAR fields.
In you situation you've only one fields, but probably if the table has several char fields the performance can be improved
Anyway I suppose it's always better to explicit an option else the system will have to deduct it by itself, so the system will do an additional step: in your case without BY, the system has to deduct the key to be used for the sorting.
Max
Hi
I don't know if you'll imporve the performace in your case, you should do some measurement, the problem should be the table key for a standard internal table (like yours) is the set of all CHAR fields.
In you situation you've only one fields, but probably if the table has several char fields the performance can be improved
Anyway I suppose it's always better to explicit an option else the system will have to deduct it by itself, so the system will do an additional step: in your case without BY, the system has to deduct the key to be used for the sorting.
Max
2014 Aug 25 6:00 PM
Hi
I don't know if you'll imporve the performace in your case, you should do some measurement, the problem should be the table key for a standard internal table (like yours) is the set of all CHAR fields.
In you situation you've only one fields, but probably if the table has several char fields the performance can be improved
Anyway I suppose it's always better to explicit an option else the system will have to deduct it by itself, so the system will do an additional step: in your case without BY, the system has to deduct the key to be used for the sorting.
Max
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |