‎2009 Jul 01 2:14 PM
Hello Friends,
I am sorting an internal table like
sort ITAB by F1 F3 F4.but after this sort I lost my sequence and grouping of VBELN PONR. which is as below:
VBELN-----POSNR---F1
F4
80011864- 40
CSL
80011866- 10
CSL
80011866- 20
CSL
80011864- 10
CSL
80011864- 20
CSL
80011867- 10
CSL
80011864- 30
CSL
80011865- 10
CSL
I can't add VBELN and POSNR in the sort statment coz it ll make my o/p like
VBELN-----POSNR---F1
F4
80011864- 10
CSL
80011864- 20
CSL
80011864- 30
CSL
80011864- 40
CSL
80011865- 10
CSL
80011866- 10
CSL
80011866- 20
CSL
80011867- 10
CSL
Here F2 with value 'V000' is placed in between the 80011864 and 80011866 data which is useless as we have to sort on only F1 F3 and F4. So i can't add F2 in sort sequence.
i want my output like
VBELN-----POSNR---F1
F4
80011864- 10
CSL
80011864- 20
CSL
80011864- 30
CSL
80011864- 40
CSL
80011866- 10
CSL
80011866- 20
CSL
80011865- 10
CSL
80011867- 10
CSL
Please Help to solve this sorting problem.
-Maharshi
‎2009 Jul 01 2:42 PM
HI,
SORT ITAB by F1 F3 F4 F2 VBELN POSNR.
You get the out as follows
VBELN-------POSNR-------F1------------- F2-------------F3-------------F4
80011865--- 10----------- 300730------ V000------- GER--------- CSL
80011867--- 10----------- 300730------ V150------- GER--------- CSL
80011864--- 10----------- 300730------ V100------- GER--------- CSL
80011864--- 20----------- 300730------ V100------- GER--------- CSL
80011864--- 30----------- 300730------ V100------- GER--------- CSL
80011864--- 40----------- 300730------ V100------- GER--------- CSL
80011866--- 10----------- 300730------ V100------- GER--------- CSL
80011866--- 20----------- 300730------ V100------- GER--------- CSL
‎2009 Jul 01 2:43 PM
F2, F3, F4 have same value through out.. how will the sort work???
and on what basis 80011865 is coming between 80011866 and 80011867
‎2009 Jul 01 5:18 PM
Please read the help on SORT. You will see that one of the options is STABLE. That will preserve the order for fields that are not in the SORT field list.
Rob