‎2010 Jun 30 11:34 AM
Hi,
I am sorting a int. table gt_marm like this in my program
SORT gt_marm BY meinh DESCENDING.
SORT gt_marm BY meinh AS TEXT .
SORT gt_marm BY umrez .
After sorting i am getting like this
000000000000001006|LAB | 1 | 1 |
000000000000001006|PC | 1 | 1 |
00000000000001006|021 | 11 | 1
My probleam is I want PC (2nd row as always in as first record) but here it is occuping as 2nd record.
CAN somebody help me how to do it? or how to interchange the position of first row as second row and second row as first row.
Please i am in trouble...
‎2010 Jun 30 12:23 PM
Assign as sort sequence as a numeric field in your internal table....increment the value as your process the screen content...sort by that value ascending...then you will see the data as it came from the screen.
‎2010 Jun 30 11:38 AM
‎2010 Jun 30 12:19 PM
Hi,
In mm02 screen the values populated this order.So i want exactly the same order in my int. table also
Whatever sorting i maintaned its working some extent and the order is in my int. table
MM02 scree:::::::::::::::
1 PC Piece <=> 1
1 020 1.4980 Roh <=> 1
1 LAB Label Qty <=> 1
1 021 1.4401 <=> 11
1 BOX Box <=> 11
1 110 1.4370 <=> 15
1 029 1.4404 T <=> 34
1 097 1.4405 T <=> 34
1 003 HOUR <=> 70
int, table after sorting
1 000000000000001006|020 | 1 | 1 |
2 000000000000001006|LAB | 1 | 1 |
3 000000000000001006|PC | 1 | 1 |
4 000000000000001006|021 | 11 | 1 |
000000000000001006|BOX | 11 | 1 |
000000000000001006|110 | 15 | 1 |
000000000000001006|029 | 34 | 1 |
000000000000001006|097 | 34 | 1 |
000000000000001006 |003
That mens PC 020 LAB only changing the wrong order...
Please help me.
‎2010 Jun 30 11:54 AM
Hi,
Use this logic.
SORT gt_marm BY meinh TEXT umrez descending.
Regards,
Preetham
‎2010 Jun 30 12:23 PM
Assign as sort sequence as a numeric field in your internal table....increment the value as your process the screen content...sort by that value ascending...then you will see the data as it came from the screen.
‎2010 Jun 30 12:26 PM
Hi,
Thanks
can u explain little bit more.
I did like this ..
SORT gt_marm BY meinh DESCENDING.
SORT gt_marm BY meinh AS TEXT .
SORT gt_marm BY umrez .
How to do??
‎2010 Jun 30 12:50 PM
Hi..
The way this sort is written, the table will first be sort in the following steps:
1. MEINH in descending order.
2. Sorting again in MEINH as text.
3. Then again on UMREZ ascending.
So in the process, the initial sorting is lost.
So you need to decide which should be the important key for sorting, so it can be written as:
SORT gt_marm BY meinh AS TEXT DESCENDING umrez.
Regards,
Karthik
‎2010 Jun 30 3:19 PM
SORT gt_marm BY meinh DESCENDING.
SORT gt_marm BY meinh AS TEXT .
SORT gt_marm BY umrez .Wouldn't you want that last statement to be a SORT....STABLE....to retain the original row order before rearranging by UMREZ?
‎2010 Jun 30 1:26 PM
SORT gt_marm BY meinh DESCENDING.
you will get PC (2nd row as always in as first record)
zashok