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

select statement

Former Member
0 Likes
802

hi,

SELECT partner addrnumber FROM but020 INTO TABLE lt_adno

WHERE partner = lt_bpiddata-bottlerid.

The above select statement is removing all the duplicate values.

but i need duplicate values also.

is there any solution?

thanks in advance,

srinivas.

8 REPLIES 8
Read only

Former Member
0 Likes
777

in this table but020 there is no dulicate entries ..

Read only

0 Likes
777

yes u r correct.

in my table primary key is bottler id and mat grp id.

both are partners.

and my question is

select statement removes duplicate values.

is there any syntax for the select statement so that it should not remove duplicate values.

Read only

Former Member
0 Likes
777

Hi,


put for all entries in select stmt 
if not lt_bpiddata[] is initial.
SELECT partner addrnumber FROM but020 INTO TABLE lt_adno 
for all entries in lt_bpiddata
WHERE partner = lt_bpiddata-bottlerid.
endif.

Thanks,

Krishna..

Read only

0 Likes
777

i tried this code

i m facing the same problem.

Read only

0 Likes
777

Hi,

As far as I can see, the table but020 have 2 primary keys , i.e the PARTNER and ADDRNUMBER. Now if you select an entry using a partner only, you should get all the ADDRNUMBERS for that partner as well. So no issues with your select statement. But it is not always necessary that the each partner will have multiple addresses.

However if it does and still you not getting the duplicates, then check that there is no uniquekey defined for the internal table lt_adno.

regards,

Advait

Read only

Former Member
0 Likes
777

Hi,

Put break Pt & check values coming correnct in first internal table or not.

second query is correct of for all entries..

Thanks,

Krishna..

Read only

0 Likes
777

SELECT bottler material_group FROM zsupplier INTO TABLE lt_bpiddata.

IF lt_bpiddata[] IS NOT INITIAL..

SELECT partner addrnumber FROM but020 INTO TABLE lt_adno FOR ALL ENTRIES IN lt_bpiddata WHERE partner = lt_bpiddata-bottlerid.

duplicate values are getting populated into lt_bpiddata

but it not the same with lt_adno.

Read only

Former Member
0 Likes
777

Hi,

Please select both key fields in your query. Doing this you will get all the duplicate values also.

SELECT PARTNER ADDRNUMBER FROM but020

INTO TABLE lt_adno

FOR ALL ENTRIES IN lt_bpiddata

WHERE partner = lt_bpiddata-bottlerid.

Hope it helps.

Regards,

Nadim