Application Development and Automation 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: 
Read only

Facing Problem in SORT statement

Former Member
0 Likes
731

Hi All,

I have Five fields in my internal table.

Say FIELD1, FIELD2, FIELD3, FIELD4, FIELD5.

I wan to display FIELD1 and FIELD3 in ascending order. Fields are Cobination of Text and Numerals.

Both should be displayed in ascending order. Is it possible? How can I achieve it.

Points Assured.

Regards,

Suresh

7 REPLIES 7
Read only

Former Member
0 Likes
713

hi,

use this

<b>sort itab ascending by field1 field3.</b>

With REgards,

S.BArani

Message was edited by:

S BHARANIDARAN

Read only

Former Member
0 Likes
713

Hi

Use SORT ITAB BY field1 field3

but this sort is done based on the first character (first letter) of the field.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
713

u have to use

SORT ITAB BY FIELD1 FIELD3.

Read only

0 Likes
713

Hi,

I wan to display Field1 and Field3 in ascending order. Based on the Field1, Field3 may get suffled.

How to avoid this.?

Regards,

Suresh

Read only

Former Member
0 Likes
713

Hi

try using Sort itab ascending by field1 field2

hope this works

Regards

Shiva

Read only

alex_m
Active Contributor
0 Likes
713

Its not possible in single SORT statement, you may need to copy into another table and do some manipulation to get the final one.

Read only

Former Member
0 Likes
713

hi,

U CAN WRITE THE LIKE THIS.

DATA: BEGIN OF ITAB occurs 0,

MATNR TYPE MARA-MATNR,

ERSDA TYPE MARA-ERSDA,

ERNAM TYPE MARA-ERNAM,

VPSTA TYPE MARA-VPSTA,

PSTAT TYPE MARA-PSTAT,

END OF ITAB.

select * from mara into CORRESPONDING FIELDS OF TABLE itab.

sort itab DESCENDING by VPSTA MATNR.

loop at itab.

write: / itab.

endloop.

RGDS,

bharat.