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

Duplicate material Desc

Former Member
0 Likes
674

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

4 REPLIES 4
Read only

Former Member
0 Likes
619

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

Read only

0 Likes
619

I need to pick duplicate description records

Read only

0 Likes
619

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

Read only

Former Member
0 Likes
619

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.