2006 Jul 29 2:34 PM
Hi All,
matnr idocty date status idocnum
75008845 matmas 22/7/06 53 13432
75008845 cremas 23/7/06 51 12341
75008845 bommat 21/7/06 64 15432
75008840 matmas 22/7/06 51 12432
75008840 cremas 22/7/06 51 12351
75008840 bommat 23/7/06 53 15438
75008825 matmas 21/7/06 64 19876
75008825 cremas 23/7/06 53 12543
75008825 bommat 22/7/06 51 15439.
My int.table looks like above For every there can be some three or four idoctypes with various status.I want to take only the least status for every material irrespective of message type. For eg I need only cremas record for material 75008845 since idoc status is least(51) out of three idoc types for mtrl 75008845.
How it would be possible.
Thanks,
Ponraj.s.
2006 Jul 29 4:39 PM
Hi,
if you want to take the least idoc status for a material irrespective of the idoc type .
use this code, it works as you expect.
code :
SORT i_tab BY matnr ASCENDING status ASCENDING.
DELETE ADJACENT DUPLICATE FROM i_tab COMPARING matnr status.
now your internal table will contain material numbers with least status.
if you want to read this internal table for least status , in that case 'DELETE ADJACENT DUPLICATE' is not required ,because after sort, required record comes as first record for each matnr.
Regards
Appana
Hi All,
matnr idocty date status idocnum
75008845 matmas 22/7/06 53 13432
75008845 cremas 23/7/06 51 12341
75008845 bommat 21/7/06 64 15432
75008840 matmas 22/7/06 51 12432
75008840 cremas 22/7/06 51 12351
75008840 bommat 23/7/06 53 15438
75008825 matmas 21/7/06 64 19876
75008825 cremas 23/7/06 53 12543
75008825 bommat 22/7/06 51 15439.
My int.table looks like above For every there can be some three or four idoctypes with various status.I want to take only the least status for every material irrespective of message type. For eg I need only cremas record for material 75008845 since idoc status is least(51) out of three idoc types for mtrl 75008845.
How it would be possible.
Thanks,
Ponraj.s.
2006 Jul 29 2:49 PM
Hi,
I think you only have to sort your table for that
sort int_table by matnr status (ascending/descending)
In this case, you can read your materials like this:
loop at int_table.
at new matnr
some coding
endat.
endloop.
2006 Jul 29 2:52 PM
Hi Ponraj,
Please write this code. it will work perfectly I think.
Hi
SORT itab BY <b>materialnumber ASCENDING idocnumber Ascending</b>.
DELETE ADJACENT DUPLICATE FROM itab COMPARING materialnumber idocnumber.
Reagrds,
Amit.
Please reward points for help.
2006 Jul 29 4:39 PM
Hi,
if you want to take the least idoc status for a material irrespective of the idoc type .
use this code, it works as you expect.
code :
SORT i_tab BY matnr ASCENDING status ASCENDING.
DELETE ADJACENT DUPLICATE FROM i_tab COMPARING matnr status.
now your internal table will contain material numbers with least status.
if you want to read this internal table for least status , in that case 'DELETE ADJACENT DUPLICATE' is not required ,because after sort, required record comes as first record for each matnr.
Regards
Appana
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |