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

sorting a table

Former Member
0 Likes
765

Hi ,

i want to sort a table with reference of two fields.

one field with ascending and and one field with decending ,

so how can i write sort statement for this ,

can any one pls help

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
737

Hi use this,

Sort It_table by f1 ascending

f2 descending.

Reward points if useful.

5 REPLIES 5
Read only

Former Member
0 Likes
737

Hai ,

Sort it_tab by value1 descending by value2.

this may work.

Thanks

Swetha

Read only

Former Member
0 Likes
738

Hi use this,

Sort It_table by f1 ascending

f2 descending.

Reward points if useful.

Read only

Former Member
0 Likes
737

hi,

sort itab by field1 descending field2 .

ascending is default. u have to specify descending explicitly.

regards,

madhumitha

Read only

Former Member
0 Likes
737

Hi Chaaya,

Refer to the following code:

SORT int_aeoi ascending BY datuv andat DESCENDING.

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
737

Hi Chaaya,

Refer below Code:

DATA:
  wa_vbap TYPE vbap,
  t_vbap  TYPE TABLE OF vbap.

SELECT *
  FROM vbap
  INTO TABLE t_vbap.

SORT t_vbap BY vbeln ASCENDING posnr DESCENDING.

LOOP AT t_vbap INTO wa_vbap.

    WRITE:
      / wa_vbap-vbeln, '     ',
    wa_vbap-posnr, '     ',
    wa_vbap-matnr.
ENDLOOP.

Regards,

Sunil.