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

how to avoid data repeated in report?

Former Member
0 Likes
860

Hi experts,

I'm working on a report that needed

plant,

new material code,

old material code,

material type,

special stock and

(material status ne '01')


select p~werks m~matnr m~bismt m~mtart s~sobkz
  into corresponding fields of table it_mat
  from ( ( MARC as p inner join MARA as m on p~matnr = m~matnr )
inner join MSEG as s on s~matnr = p~matnr )
  where m~matnr in p_mcode
  and m~bismt in p_ocode
  and m~mtart in p_mtype
  and p~werks in p_plant
  and m~matkl in p_mgroup
  and p~mmsta ne '01'
  and s~sobkz in p_spec
  order by m~matnr.
  APPEND it_mat.

This is my select stament ,

and it's output layout the material code are all repeating twice or 3-5 times for the same data.

Is there anyway to take out the repeated data?

Please advice.

Thank you in advanced.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
821

Hi,

Use

ORDER BY <field> ASCENDING.

DELETE ADJACENT DUPLICATES FROM it_mat.

it will delete all duplicates & repeated data.

Regards

Hema

Hi experts,

I'm working on a report that needed

plant,

new material code,

old material code,

material type,

special stock and

(material status ne '01')


select p~werks m~matnr m~bismt m~mtart s~sobkz
  into corresponding fields of table it_mat
  from ( ( MARC as p inner join MARA as m on p~matnr = m~matnr )
inner join MSEG as s on s~matnr = p~matnr )
  where m~matnr in p_mcode
  and m~bismt in p_ocode
  and m~mtart in p_mtype
  and p~werks in p_plant
  and m~matkl in p_mgroup
  and p~mmsta ne '01'
  and s~sobkz in p_spec
  order by m~matnr.
  APPEND it_mat.

This is my select stament ,

and it's output layout the material code are all repeating twice or 3-5 times for the same data.

Is there anyway to take out the repeated data?

Please advice.

Thank you in advanced.

6 REPLIES 6
Read only

Former Member
0 Likes
822

Hi,

Use

ORDER BY <field> ASCENDING.

DELETE ADJACENT DUPLICATES FROM it_mat.

it will delete all duplicates & repeated data.

Regards

Hema

Read only

0 Likes
821

Hi,

Use ,

select pwerks mmatnr mbismt mmtart s~sobkz

into corresponding fields of table it_mat

from ( ( MARC as p inner join MARA as m on pmatnr = mmatnr )

inner join MSEG as s on smatnr = pmatnr )

where m~matnr in p_mcode

and m~bismt in p_ocode

and m~mtart in p_mtype

and p~werks in p_plant

and m~matkl in p_mgroup

and p~mmsta ne '01'

and s~sobkz in p_spec

order by m~matnr ASCENDING.

DELETE ADJACENT DUPLICATES FROM it_mat.

APPEND it_mat.

it will delete all duplicates & repeated data.

Regards

Hema

Read only

0 Likes
821

Hi hema,

Thank you so much, it's solve ^.*

Thanks to vijay and chandra too.

I've rewards marks to you ya.

Thanks a lots !

Read only

0 Likes
821

You are most Welcome,

Hema

Read only

Former Member
0 Likes
821

add werks also in JOIN on MSEG.

select p~werks m~matnr m~bismt m~mtart s~sobkz
  into corresponding fields of table it_mat
  from ( ( MARC as p inner join MARA as m on p~matnr = m~matnr )
inner join MSEG as s on s~matnr = p~matnr  and
                                     s~werks = p~werks
)
  where m~matnr in p_mcode
  and m~bismt in p_ocode
  and m~mtart in p_mtype
  and p~werks in p_plant
  and m~matkl in p_mgroup
  and p~mmsta ne '01'
  and s~sobkz in p_spec
  order by m~matnr.
  APPEND it_mat.

Read only

Former Member
0 Likes
821

Hi Milka,

Try the following:

ORDER BY m~matnr ASCENDING.

DELETE ADJACENT DUPLICATES FROM it_mat.

Regards,

Chandra Sekhar