‎2007 Dec 05 3:07 PM
Hi Friends,
I have an internal table having matnr, mtart, maktx,
here dupliate material descriptions are there, i.e different materials (matnr) having same material description, i have to find the dupliate material description which materials having.
In this regard, please send me some peice of code.
thanks in advance
Rams
‎2007 Dec 05 3:12 PM
Hi Ramesh,
There will be a language key in the table. define the language key to avoid duplicate records.
Else you need to use the string operation to compare the table entries. What is your requirement? do you want to avoid duplicate entries or you have some specific logic?
Cheers
VJ
Message was edited by:
Vijayendra Rao
‎2007 Dec 05 3:13 PM
‎2007 Dec 05 3:17 PM
You can do that by doing following steps.
1). Take a copy of the internal table
itab1[] = itab2[].
2). Sort ITAB1 and ITAB2 based on material number
SORT ITAB1 BY MATNR.
SORT ITAB2 BY MATNR
3). Loop at itab1.
loop at itab2 where matnr eq itab1-matnr.
IF itab1-matkx CO itab2-maktx.
DUPLICATE RECORDS
ESLE.
ENDIF.
endloop.
endloop.
Hope this helps
Cheers
VJ
‎2007 Dec 05 3:18 PM
Hi
Please execute this sample code.
DATA: BEGIN OF itab OCCURS 0 ,
desc(10),
END OF itab.
itab-desc = 'TEST'.
APPEND itab.
APPEND itab.
itab-desc = 'TEST1'.
APPEND itab.
itab-desc = 'TEST'.
APPEND itab.
APPEND itab.
itab-desc = 'TEST1'.
APPEND itab.
DATA: l_desc(10).
SORT itab BY desc.
READ TABLE itab INDEX 1.
l_desc = itab-desc.
DATA: l_sytabix TYPE sy-tabix.
LOOP AT itab.
l_sytabix = sy-tabix + 1.
READ TABLE itab INDEX l_sytabix.
IF itab-desc = l_desc.
WRITE: / l_sytabix , 'Contains duplicate'.
ENDIF.
ENDLOOP.