Sorting rule
Hi All,
i have to sort a set of records by one field.. this field could be blank and may have digits as well..
So i need to sort this internal table such that blank spaces have a precedence over alphabets and alphabets over digits.
How do i go about doing this..
Thanks in advance,
Herwin.
HI check this code it is working as u need.
TYPES: begin of t_c,
c type char1,
end of t_c.
data: t_tab type STANDARD TABLE OF t_c.
data w_c type t_c.
data:t_tab1 type STANDARD TABLE OF t_c.
w_c-c = space.
append w_c to t_tab.
w_c-c = '1'.
append w_c to t_tab.
w_c-c = 'a'.
append w_c to t_tab.
sort t_tab DESCENDING.
loop at t_tab into w_c where c is INITIAL.
append w_c to t_tab1.
endloop.
loop at t_tab into w_c where not c is initial .
append w_c to t_tab1.
endloop.
if sy-subrc = 0.
endif.
Check the entries in tab t_tab1 in debug. It is according to your requirement I hope.
Edited by: Anurag_n on Feb 23, 2010 12:03 PM
Similar Messages
-
Sorting Rule in Batch Management
Hi,
I want to issue 23no of pieces from my stock which is in batch managment.It is picking 20qty correctly but its not picking from a batch where qty 3 is available.How can I solve it.
I used LOBM_ZUSTD (qty status) as characteristics for sorting rule.You can see the senario here while issuing.
Batch Split quantity Available quantity SLoc S
0000000416 20 20 0001
0000000414 3 15 0001
0000000415 10 0001
0000000417 5 0001
0000000418 3 0001Are you doing batch determination for a SD delivery, just for an MM movement, or for PP or for WM?
-
Sorting rule for generating voucher number ina payment batch.
Hi All,
How does system generate the voucher number in a payment batch?
In my system, some voucher number in a payment batch seem sorted by supplier name, some are not.
I want to know is there any sorting rule for generating voucher number in a payment batch?
Thanks in advance,
Best Regards.
Edited by: user631092 on Jul 16, 2009 3:07 PMHi John,
Thanks for your information. Maybe I did not explain clearly.My problem is...
If my setup for payment doucument sequence is starting with 200900000001.
The user create a payment batch for 10 payments, 200900000001~200900000010.
I am wondering how does the system decide which payment is 200900000001, which one is 200900000002?
My users used to file the physical document sorting by supplier name for one batch.
Most of time, the payment document numbers are also sorted.For expamples,
200900000001 Supplier A
200900000002 Supplier B
200900000003 Supplier C
Sometimes the sequence become like this,
200900000001 Supplier B
200900000002 Supplier A
200900000003 Supplier C
Thank you.
Best Regards,
Edited by: user631092 on Jul 16, 2009 3:23 PM -
Dear all,
I have maintained Sort Sequence ZBATCHSORT in my strategy type ZSD1 which is getting picked up at the time of delivery.
But the problem is that during delivery when we do batch split,
my Sort rule does not get automatically picked up in the Strategy Info.I have to give it manually every time in the Strategy group after which my sort rule becomes effective.
What needs to be done?
Regards,
Rahul.Dear all,
In VCH2, for that strategy type , we have to give the sort rule name in the sort tab after slecting the line item.
It will then get picked up automatically in the strategy info. -
Can we define a custom sorting rule for a column in a SortingTable ?
Currently, all the columns in my SortingTable are being sorted alphabetically. Is there a way I can change that ? (Eg. Alphabetically, Nov will precede Oct. Should be the other way round)
Thanks,
896180Sorting table provides both way of sorting by default and also on numeric as well then what are you looking for.
-
Batch determination -sort rule -reg
hi,
requirement is :
Through COR2 , for the process order's component when batch determination is done , Batch determination should first select for the unrestricted stock in the storage location and once all the unrestricted stock is consumed then only batch determination should happen from the stock of the batches of the consignment stock in the storage location.
With in the stock of the storage location ... first it should check for unrestricted stock -with in unrestricted it should sort based on GR date of the batch and consume the oldest batch.Once all unrestricted is consumed then only it should look for consignment stock consumption , again based on the Gr date and consume the oldest batch with in the consignment .
We have created a sort sequence with unrestricted stock as the first characteristic (table MCHB-field CLABS in the additional data tab of the CT04) and then Gr date in ascending (table MCH1-Field LWEDT)
and also tried with the combination of consignment stock also (from MARD table ) but it is not working as expected
System is always picking the oldest GR date batch irrespective whether it is unrestricted or consignment as sorting is done for the characteristic Gr date which is updated in the classification tab of the batch when it is created .
Can the multiple sorting ( first sort on stock type :unrestricted / consignment & then on gr date) is possible in standard SAP
please guide us
regards,
Madhu KiranHi Madhu,
I have the same issue. What was your solution please ?
Thanks in advance, -
Hello friends,
In batch determination at delivery level
In strategy type SD01, if I don't maintain sort sequence
can sytem automatically determines the batch at delivery level?
Please clarify my doubt.
regards,
Sekhar_sd consultant.Hi Harrison,
Noted. Thanks.
Best practice to achieve optimal performance also states that in all the look up tables (includes Qualified), sort index for DF must be set to Normal.
Ref:SAP Note 1258982 ; Read 'Please Note' which states the above .
Please put your thoughts on this.
Reards,
Vinay -
Any suggestions on how to use the sorting option the most efficiently in Itunes?
Use it however it works best for you.
Any other extremely vague questions? -
TreeByNestingTableColumn and sorting rules for children
Hi,
i have created my first WD Application by using a table with a TreeByNestingTableColumn. My question is how can i influence the order of the children. It seems that the order is hard coded and depends on the sequence of the entries in the table. I added and moved the childs on differnent positions in the table ( by using "bind element ..index x ) . I expected a special field/attribute in the UI element which can be used to influence the sequence of the children.
A second question: Is it possible to combine WD-ALV table with a TreeByNestingTableColumn ? I have the impression that you only can use TreeByKeyTableColumn within WD-ALV to build a hierachy.
Thanks in advance, JuergenHi Juergen,
The ALV does not support the hierarchy functionality. As far as I know the only way to get a hierarchy is to build a table, sort and collapse by one column.
Especially the tree by nesting is not supported by the ALV.
Just use the normal table control with the mastercolumn.
Ciao, Regina -
Missing Mail Rules after upgrade to 10.8.2 from 10.6.8
The title says it all, really - I just upgraded to 10.8.2 via the App Store from 10.6.8, and, after a long period of re-indexing my email, Mail.app opened up and all of my sorting rules were gone gone gone.
There doesn't seem to be an easily findable post on this already, so I'm adding one here. Does anyone have any advice?
thanks,
-j.
specs: MacBookPro, 2.53 GHz Intel Core i5Ok, never mind: re-starting Mail solved the problem.
-
When I sort by Album Artist, it sorts, but the next level of sorting seems to be the artist then I'm not sure what it sorts by? I prefer the tree to go Album Artist>Album>Track number, is there any way to modify this?
In the iTunes the Album by Artist view ordering is:-
<Sort Album Artist OR Album Aritst OR Sort Artist OR Artist>, <Album>, <Disc No.>, <Track No.>
On the iPod, Cover Flow ordering is:-
<Sort Artist OR Artist>, <Album>, <Disc No.>, <Track No.>
Where the OR uses the first non-blank value. In iTunes you can use Sort Artist to make a number of different artist values sort as one & display as one entry in the browser list. On the iPod this will group an album as one unit for the Album & Cover Flow view, however the Artist menu may still display the individual values put in the Artist field often listed thus:-
Artist
Artist/Guest 1
Artist
Artist/Guest 2
Artist/Guest 3
Artist
etc.
I use the Sort Artist field myself, in preference to putting all guest artist info. into the track title, but it's worth noting the side effects of doing so. Hopefully at some point the iPod sorting rules will be changed to match that of iTunes.
tt2 -
Address Book sorting list print
I noticed today a strange behaviour of the print function in Mac Os X Mountain Lion Address Book.
I have to print the entire contacts list.
I ckecked the "Sort by Last Name" in preferences, and on the video everithing is as expected.
So I tried to print ad with my big surprise all the contacts are totally mixed!
I can't find any sort rule! Just one contact after another!
At the moment I thought that I made a mistake in some settings.
I checked the entire print window and I havent found any option to set the sorting list preference.
Maybe is very well hidden........
Can anybody help?https://discussions.apple.com/message/19330865
Hope this helps. -
Sort Result set in Custom Order
Hello - Happy Friday everyone !!
I would like result set to be sorted in a custom order, for example, a specific value must appear at top of result set, a specific value must appear at bottom of result set, and others can be sorted in standard order.
Below is the link I found while researching for the possible solution. This works great if I have to sort a specific value to appear at top of result set but I want some specific values to appear at the very bottom as well.
http://sqlandme.com/2013/11/18/sql-server-custom-sorting-in-order-by-clause/
For example:
CountryName
AUSTRALIA
BANGLADESH
CHINA
FRANCE
INDIA
JAPAN
NEW ZEALAND
PAKISTAN
SRI LANKA
UNITED KINGDOM
UNITED STATES
Now based on the popularity you might need a country to appear on top of the list. In order to return results as required, we need to specify a custom sort order in ORDER BY clause. It can be used as below.
The following query will return result set ordered by CountryName, but INDIA at top and CHINA at 2nd "container">
USE [SqlAndMe]
GO
SELECT CountryName
FROM dbo.Country
ORDER BY CASE WHEN
CountryName = 'INDIA' THEN '1'
WHEN
CountryName = 'CHINA' THEN '2'
ELSE
CountryName END ASC
GO
Result Set:
CountryName
INDIA
CHINA
AUSTRALIA
BANGLADESH
FRANCE
JAPAN
NEW ZEALAND
PAKISTAN
SRI LANKA
UNITED KINGDOM
UNITED STATES
My predicament: Based on the example above, I always want 'India' and 'China' at the TOP and 'Bangladesh' and 'Pakistan' at the bottom. Rest can follow the general sort rule. How do I tweak/approach this? Thank you very
much for your help in advance.
Result Set I am anticipating;
INDIA
CHINA
AUSTRALIA
FRANCE
JAPAN
NEW ZEALAND
SRI LANKA
UNITED KINGDOM
UNITED STATES
BANGLADESH
PAKISTAN
This would make my weekend great!!
Regards,
SJ
http://sqlandme.com/2013/11/18/sql-server-custom-sorting-in-order-by-clause/
Sanjeev Jhathis would be enough
USE [SqlAndMe]
GO
SELECT CountryName
FROM dbo.Country
ORDER BY CASE CountryName
WHEN 'INDIA' THEN 1
WHEN 'CHINA' THEN 2
WHEN 'BANGLADESH' THEN 4
WHEN 'PAKISTAN' THEN 5
ELSE 3
END,CountryName
GO
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Sort list items according to predifined order
hi all,
I wonder is there any way to sort the items of a list
according to a predefined order (e.g., 2,3,1)?
Many thanksAs far as I know the only predefined sort order is
alphabetic. You could write a function using
list.addAt(position,value) to add new items in the proper location
and maintain the sort order yourself. This might involve a lot of
looping through the target list, depends on how complex your sort
rules are.
I had a project where I needed to keep a list of file names
sorted by rules other than alphabetic. I actually used a big lookup
table (case statement) to append letters to the beginning of each
name just before adding them to the list, the letters were stripped
off when data was retrieved from the list. This trick allowed me to
use list.sort() to maintain the sort order. It’s an ugly
solution and I’m not proud of it, but it got the job done. -
Interesting Sort using ORDER BY
I would like to sort by footnote names in our table which should be sorted as below:
2a,2b,2c,3a,3b,3c,8,10,15,18
When I use ORDER BY FOOTNOTE_NAME, Oracle sorts the result like this:
10,15,18,2a,2b,2c,3a,3b,3c,8
which is not what I want.
Any ideas. Will I need to strip characters, convert the remaining part to Int and then sort. Does Oracle let you specify your own sort rules?
Thanks in advance.Assuming that the footnote names only have letters and numbers, then something like:
SQL> SELECT * FROM t;
COL
2a
2b
3b
3c
8
15
18
3a
2c
10
SQL> SELECT * FROM t
2 ORDER BY TO_CHAR(TRANSLATE(UPPER(col),'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ',
3 '1234567890'),'0000')||
4 TRANSLATE(UPPER(col),'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
5 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
COL
2a
2b
2c
3a
3b
3c
8
10
15
18TTFN
John
Maybe you are looking for
-
Problem in excuting select statement
Hi, I have created simple report and in start-of-selection i have writen select statement with bukrs and lifnr as parameters. But i am unable to execute the query. find the code start-of-selection. select bukrs lifnr name1
-
Project Management Roadblock with mac
I love my mac! I always have loved my macs. I mainly used my macs for personal which is mostly multimedia world. For the past 6 months I have kicked my work provided Dell to the curb and am using my mac for everything business related with some snags
-
Gig DWDM connection between 2 x 3750's
We have a customer that has a gig DWDM connection between 2 cat3750's. The interfaces are SMF. He is complaining of throughput issues. He has a pair of AIX servers transfering a file between them using we believe RPC (not 100% sure). If he does it ac
-
Hello.... I want to get the last date of the month. For example, the last date of Jan is 31. How can I get the last date of the particular month and year ???? Thanks for help. Gloria
-
Finally G4 to Intel Mac. Photoshop CS to Intel upgrade or plug-in?
Finally G4 to Intel Mac. Photoshop CS to Intel upgrade or plug-in? Do I have options?