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

Sort Internal Table Partialy

Former Member
0 Likes
697

Dear All,

I am having one ITAB which having 4000 records.

I want sort my records partialy.

E.g. Some records will be sorted against certain criteia and other will be some differnt criteria in a

Single Internal table.

Is it Possible?

If so kindly give me some input.

Thanking you in Advance.

Siladitya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
660

Hi sarkar,

You can do this by using dynamic sorting.

Check this link...

1.

2. I have found another link... See if it is help full.

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3800358411d1829f0000e829fbfe/content.htm

Hope this helps you.

Regards,

Vivek.

5 REPLIES 5
Read only

Former Member
0 Likes
660

Hi siladitya,

1. I don't think it is possible in 1 straight shot.

2. u will have to take 2 extra itnernal tables

of same structure.

3. then using loop where

u must popultae the 1 extra table,

then using second loop where 2nd condition,

u must popultae the 2 extra table.

4. then u must sort them individually

using both criteria.

5. then u can merge them.

something of the above logic.

I hope it helps.

regards,

amit m.

Read only

Former Member
0 Likes
660

split the table and sort them in different orders.

and combine..

regards

vijay

Read only

Former Member
0 Likes
661

Hi sarkar,

You can do this by using dynamic sorting.

Check this link...

1.

2. I have found another link... See if it is help full.

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3800358411d1829f0000e829fbfe/content.htm

Hope this helps you.

Regards,

Vivek.

Read only

Former Member
0 Likes
660

Hi its not possible to sort the internal tables PARTIALLY.

in order to acheive ur functionality what u can do is...

sort based on ur requirements multiple times as follows.

sort itab by field1.

.....

.....

sort itab by field2.

....

....

sort itab by field3.

....

...

hope u got my point.

satish

Read only

former_member186741
Active Contributor
0 Likes
659

to achieve this you can include generic field(s) solely for sorting. eg if you have a table with data fields Rec_type(1), matnr and date. You could create a table:

sort_field(20) " can be as long as the longest source field

rec_type,

matnr,

date.

You can then have logic to populate the sort field, say

if rec_type = 'A'.

concatenate matnr date into sort_field.

else.

sort_field = date.

endif.

You can then sort the table. Obviously you could have multiple fields, sort_field1,2 etc.