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 distinct issue

former_member202733
Participant
0 Kudos
849

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
Read only

former_member192023
Active Participant
0 Kudos
508

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
Read only

former_member192023
Active Participant
0 Kudos
509

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.

Read only

rosenberg_eitan
Active Contributor
0 Kudos
508

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.

Read only

former_member202733
Participant
0 Kudos
508

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.

Read only

0 Kudos
508

Hi,

The point is not only performance.

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

Regards.