2008 May 22 5:51 AM
Hi experts
I have one internal table , i need to print and delete duplicate material no respective to the period...means it should check from internal table weather for same period two or more same material is there or not...if there give error msg and delete..
Plz give sample code..
usefull ans will b rewarded...
2008 May 22 6:46 AM
Hi,
we can code this like----
DELETE ADJASCENT DUPLICATES FROM ITAB COMPARING <FLD>...
IF SY-SUBRC EQ 0.
MESSAGE '............' TYPE 'I'.
Hope it may b helpful.
Thanks.
Hi experts
I have one internal table , i need to print and delete duplicate material no respective to the period...means it should check from internal table weather for same period two or more same material is there or not...if there give error msg and delete..
Plz give sample code..
usefull ans will b rewarded...
2008 May 22 5:57 AM
Hi,
new_table = old_table.
Sort the new_table by peiod and material and delete adjacent duplicates.
loop at new_table.
loop at old_table where period = new_table-period and matnr = new_table-matnr.
count. = count + 1.
endloop.
if count GT 1.
"print error.
endif.
endloop.
New_table has unique entries
Edited by: Shruthi R on May 22, 2008 6:57 AM
2008 May 22 6:50 AM
Hi,
sort old_table by period matnr.
loop at old_table where period = new_table-period and matnr = new_table-matnr.
if l_period = old_table-period and l_matnr = old_table-matnr.
"print duplicate.
delete old_table index sy-tabix.
else.
l_period = old_table-period.
l_matnr = old_table-matnr.
endif.
endloop.
2008 May 22 6:01 AM
Hi,
data: begin of itab,
period,
matnr,
...
end of itab.
sort itab by period and matnr.
loop at itab.
at new matnr.
loop at itab where period = itab-period and matnr = itab-matnr.
message.
exit.
endloop.
endat.
endloop.
Cheers.
...Reward if useful.
2008 May 22 6:46 AM
hi friend
i need to find out the duplicate material no. from same ineternal table..if duplicate mat no is there print error msg......its not working
2008 May 22 6:46 AM
Hi,
we can code this like----
DELETE ADJASCENT DUPLICATES FROM ITAB COMPARING <FLD>...
IF SY-SUBRC EQ 0.
MESSAGE '............' TYPE 'I'.
Hope it may b helpful.
Thanks.