Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Internal tables.

Former Member
0 Likes
617

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.

[email protected]

1 ACCEPTED SOLUTION
Read only

Laxmana_Appana_
Active Contributor
0 Likes
570

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.

[email protected]

3 REPLIES 3
Read only

Former Member
0 Likes
570

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.

Read only

Former Member
0 Likes
570

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.

Read only

Laxmana_Appana_
Active Contributor
0 Likes
571

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