2007 Sep 07 9:04 AM
hi experts
i have done sorting as follows, but its not working properly.
sort ipos by kda pos udate UTIME descending.
loop at it_final.
read table ipos with key kda = it_final-kdauf pos = it_final-kdpos.
if sy-subrc = 0.
it_final-budat = ipos-udate.
55002964 10 20070907 124549
55002964 20 20070907 124519
55002964 20 20070907 112943
what could be the reason, how to solve this issue.
Thanks in advance.
Regards
Rajaram
2007 Sep 07 9:13 AM
hi rajaram,
as per ur coding it is getting sorted by the utime descending.
If u want to do sorting descending.
Then u can use this kind of coding.
<b>sort ipos descending by kda pos udate.</b>
Regards...
Arun.
Reward points if useful.
2007 Sep 07 9:07 AM
Hi,
sometimes the sequense of your fields are relevant.
Take a look to your definition IPOS and set at first the field KDA.
It should work.
Regards
Nicole
2007 Sep 07 9:08 AM
Hi Rajaram..
Do this way...
sort ipos by kda pos <b>Ascending </b> UDATE UTIME descending.
loop at it_final.
read table ipos with key kda = it_final-kdauf pos = it_final-kdpos <b>binary search.</b>
if sy-subrc = 0.
it_final-budat = ipos-udate.
<b>REWARD IF HELPFUL.</b>
2007 Sep 07 9:17 AM
sort ipos by udate UTIME descending.
loop at it_final.
read table ipos with key kda = it_final-kdauf pos = it_final-kdpos binary search.
if sy-subrc = 0.
it_final-budat = ipos-udate.
i tried this way also, but the descending is not working properly yar.
2007 Sep 07 9:22 AM
Hi,
If this is the result you are getting when you execute the statement
sort ipos by udate UTIME descending
udate utime
55002964 10 20070907 124549
55002964 20 20070907 124519
55002964 20 20070907 112943
<b>then it is correct.</b>
Time is sorted correctly 12:45:49> 12:45:19> 11:29:43.
Regards,
Sesh
2007 Sep 07 9:11 AM
What is the structure or field sequence of your table ipos?
When sorting a table, be sure that the fields are listed as first, second, third.... index in your table.
In your example your ipos should be contain:
data: begin of ipos occurs 0,
kda like ...,
pos like ...,
udate like ...,
UTIME like ...,
fieldxxx like ...,
fieldxxx like ...,
fieldxxx like ...,
end of ipos.
2007 Sep 07 9:13 AM
hi rajaram,
as per ur coding it is getting sorted by the utime descending.
If u want to do sorting descending.
Then u can use this kind of coding.
<b>sort ipos descending by kda pos udate.</b>
Regards...
Arun.
Reward points if useful.
2007 Sep 07 9:37 AM
why don't you look into the documentation ...
sort ipos {ascending| descending} by ....
has an effect on ALL fields
sort ipos by field1 field2 descending
works only on field2, acending is default.
=> Everything is fine!
Any you should use binary search for the read, then you must sort ipos by kda and pos, and you sort it acending.
=> from my side your program would be o.k., if you add binary search to the read.
Siegfried