09-29-2008 3:06 PM
Friends,
I have declared an internal table declared as below:
data:zitab type table of zsalesitem1a.
The ztable 'zsalesitem1a' has a primary key, zecrno.
After populating the internal table zitab with values from the ztable, i am sorting the zitab using :
sort zitab descending by zecrno.
But the sort statement is sorting the zitab using line number, not by zecrno values.
Please let me know what is missing.
Thanks and Regards.
09-29-2008 3:10 PM
09-29-2008 3:09 PM
09-29-2008 3:41 PM
Hi,
There is no change with this version of the sort statement.
Thanks and Regards.
09-29-2008 3:10 PM
09-29-2008 3:42 PM
Hi,
There is no change with this version of the sort statement.
Thanks and Regards.
09-29-2008 4:11 PM
09-29-2008 4:29 PM
Hi,
Here is the code:
data:zstruct type zsalesitem1b.
data:zitab type table of zsalesitem1b.
select zecrno from zsalesitem1b into zstruct.
append zstruct to zitab.
endselect.
describe table zitab.
sort zitab by zecrno descending.
Thanks and Regards.
09-29-2008 4:36 PM
What does zsalesitem1b look like?
Avoid SELECT ENDSELECT.
Instead use:
select zecrno from zsalesitem1b into corresponding fields of table zitab.
09-30-2008 6:03 AM
Hello
Try:
data:zstruct type zsalesitem1b.
data:zitab type table of zsalesitem1b.
select zecrno from zsalesitem1b into zstruct-zecrno.
append zstruct to zitab.
endselect.
describe table zitab.
sort zitab by zecrno descending.
09-30-2008 6:54 AM
Hi,
The SORT statement can be like:
sort zitab by zecrno descending.
OR
sort zitab descending by zecrno .
There is no problem.
But check the below ones:
1.You might have filled line numbers instead of zecrno values.If so Check the content and fill accordingly.
2.The fields order might be swapped.?If so Check the strture and content.
3.You might have declared the Key fields and not followed the rules as there are different kinds of internal tables like SORTED,HASHED,STANDARD.If so folllow the order.
Regards,
Rama Chary.Pammi
09-30-2008 10:28 AM
Hi,
Problem seems to be with the structure definition of zsalesitem1a and zsalesitem1b. Compare the two structures and make sure that zrecno from zsalesitem1a actually gets mapped to the same field in zsalesitem1b. In debug check that the right values are getting populated into your internal table. Once that happens, sorting should work just fine.
09-29-2008 4:05 PM
1.First delete the Duplicates.
2.SORT itab DESCENDING BY field-1 field-2 asceding .
try this...
09-30-2008 10:34 AM
10-01-2008 5:45 AM
hi,
write in the below way.
sort <internal table> by <field> descending.
Regards,
venkat
10-01-2008 5:47 AM
Hi,
can you paste your code..then we will look at once.
Regards,
venkat
10-01-2008 10:02 AM
Hi,
Pls try this
select zecrno from zsalesitem1b into corresponding fields of zstruct.
append zstruct to zitab.
endselect.
describe table zitab.
sort zitab descending by zecrno .
Regards
10-03-2008 5:38 PM