Application Development 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: 

Select distinct issue

former_member202733
Participant
0 Kudos
456

Hi gurus.

Forgive me for such silly question but I don't have too much experience in ABAP.

I search for an answer for this question but being honest, I have no idea of an effective way to search for this.

Well, the problem is:

I build a dynamic SQL statement like this.

So, I'm facing a problem, when I execute the same statemant using SE11 I got more records than when I execute this sentence in the program, so, I record a trace for this statemant in ST05 and for my surprise I got this.

So, I ask you guys, where that DISCTINC came from? Because it is not in the lv_fields variable.

I could solve this problem by selecting the PK fields for this table but, I don't need those fields.

I very appreciate any help.

regards

Ronaldo.

1 ACCEPTED SOLUTION

former_member192023
Active Participant
0 Kudos
115

Hi Ronaldo,

Maybe it is because you used for all entries in itab.

It will delete the same lines in the result when you did not use all keys field in Select statement.

Regards.

4 REPLIES 4

former_member192023
Active Participant
0 Kudos
116

Hi Ronaldo,

Maybe it is because you used for all entries in itab.

It will delete the same lines in the result when you did not use all keys field in Select statement.

Regards.

rosenberg_eitan
Active Contributor
0 Kudos
115

Hi,

is correct .

Actually it is documented

To get there use "google search operators "
site:http://help.sap.com/abapdocu_740/en/ "WHERE - FOR ALL ENTRIES "

In order to get all your data you need to include in the output table the full key of your input table

Regards.

Eitan.

former_member202733
Participant
0 Kudos
115

Thank you guys!!!

So, in terms of performance, which is better, build the in condition my self or use the full qualified PK on the internal table?

best regards

Ronaldo.

0 Kudos
115

Hi,

The point is not only performance.

you will not get all the records if you fail to use the full key.

Regards.