‎2009 Jan 29 9:52 AM
DEar Experts,
I am facing the following problem....
I have got a ZTABLE in which pricing data is being maintained. the data is stored as shown below
Material Indentifier From Batch To Batch Material Description ZMRP Z004
000000000000500073 1 A7095 A7111 MGL TABS 200 MG 1 X 10 SALES 4.10 0.40
000000000000500073 10 RM28001 RM28999 MGL TABS 200 MG 1 X 10 SALES 3.99 0.22
000000000000500073 11 TM28001 TM28999 MGL TABS 200 MG 1 X 10 SALES 3.99 0.22
000000000000500073 12 A2001 A5077 MGL TABS 200 MG 1 X 10 SALES 0.00 0.40
000000000000500073 13 A6217 A7094 MGL TABS 200 MG 1 X 10 SALES 0.00 0.39
000000000000500073 14 T8001 T8999 METROGYL TABS 200 MG 1 X 10 SALES 3.99 0.22
000000000000500073 2 A7112 A8082 MGL TABS 200 MG 1 X 10 SALES 4.17 0.39
000000000000500073 3 A8083 A9999 MGL TABS 200 MG 1 X 10 SALES 3.99 0.22
000000000000500073 4 R7001 R8009 MGL TABS 200 MG 1 X 10 SALES 4.17 0.39
000000000000500073 5 R8010 R9999 MGL TABS 200 MG 1 X 10 SALES 3.99 0.22
000000000000500073 6 T7001 T7010 MGL TABS 200 MG 1 X 10 SALES 4.10 0.40
000000000000500073 7 T7011 T7015 MGL TABS 200 MG 1 X 10 SALES 4.09 0.39In this under the column indentifer you can see the values 1,10,11,12,2,3 etc....
Now i want to call the record with the maximum indentifier i.e. in this case the 6th record with indentifier 14. But when i am sorting this data it is sorting in a different fashion. as shown above it stores entries with indentifier starting with 1 first, then it goes to the other record. As a result any way i sort in descending or ascending i do not the get the record with indentifier 14.
This is a critical one for me.
<<removed_by_moderator>>
Thanks,
Regards,
Jitesh M Nair
Edited by: Vijay Babu Dudla on Jan 29, 2009 5:20 AM
‎2009 Jan 29 9:56 AM
looks like the field Identifier is defined as character. You have two options:
1. Define the field as integer, than the sorting will be OK
OR
2. Leave the field definition as it is, but when you fill up with data, use leading zeros. (01, 02, 03, ..., 10, 11)
‎2009 Jan 29 9:55 AM
Hi,
Keep the identifier field as the first field in the internal table and sort it by descending order so that the largest identifier will be the first data in the internal table.
Regards
Khanna
‎2009 Jan 29 9:55 AM
‎2009 Jan 29 9:56 AM
looks like the field Identifier is defined as character. You have two options:
1. Define the field as integer, than the sorting will be OK
OR
2. Leave the field definition as it is, but when you fill up with data, use leading zeros. (01, 02, 03, ..., 10, 11)
‎2009 Jan 29 9:57 AM
Hi,
Did u use
SORT ztable BY identifier.
If yes show me ur code.
Thanks.
‎2009 Jan 29 9:58 AM
Hello jbclp
SORT iinternal table BY indentifier DESCENDING.
Hope it will help you.
Thanks
-Arun Kayal
Edited by: Arun Kayal on Jan 29, 2009 11:01 AM
‎2009 Jan 29 9:58 AM
Hi,
SORT ZTABLE BY Material Indentifier Descedning.Read the first record,
‎2009 Jan 29 9:58 AM
Hello Jitesh,
I assume you have selected data from ZTABLE into internal table ITAB.
You can use the stmt:
SORT ITAB BY MATERIAL IDENTIFIER DESCENDING. Suhas
PS: Sorry Avinash !!! Cant help laughing it off )
Edited by: Suhas Saha on Jan 29, 2009 3:29 PM
‎2009 Jan 29 10:07 AM
Hi,
what is the type of the indentifier? if it is string or character, the sort command may result as your case. if it doesn't cause type conflict, change the data type of indentifier to integer and try it again.
regards,
Murat Kaya