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 ... FOR ALL ENTRIES IN fails!!!

Clemenss
Active Contributor
0 Kudos

Hi,

we are on Kernel 640_REL unicode and found a Kernel error:

Using SELECT ... FOR ALL ENTRIES IN with a field list to be retrieved, the ABAP-Database interface obviously deletes duplicate records.

Our scenario is retrieval of open special ledger postings for customers from BSID.

The fields specified were

BUKRS KUNNR WAERS DMBTR WRBTR SHKZG UMSKZ

If a customer has more than one matching record with the same amount, only one of those is returned. The only way to get all matching records is to retrieve all key fields.

I forwarded to the people handling OSS-requests in our project. Before we get the solution, i want to issue a severe warning.

This failure is decribed in note 65554 for Kernel-Release <= 3.0F and <= 4.6D, also Release 6.10. But nothing newer.

After all those years of ABAP I did not expect they can't handle SQL.

regards,

Clemens

3 REPLIES 3

Former Member
0 Kudos

I hope the fields u have specified are the ones u r using in the select statement in the given manner..

select BUKRS KUNNR WAERS DMBTR WRBTR SHKZG UMSKZ.. ???

if u know that for the same kunnr, you get the results condensed into one, why don't you use all the key fields in the select statement, to avoid any redundancy in the data you are fetching??

Former Member
0 Kudos

Hi Clemens

If I understand your post, I don't think there is an error, the following is from the online help:

"The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read. "

I believe that 'FOR ALL ENTRIES' is a union and therefore duplicate rows are removed. If you want each row to appear then you need to make the row unique by using all the key fields. I think it would also be better to inlcude all the key fields in the WHERE clause anyway.

Kind regards

Andy

Former Member
0 Kudos

Hi Clemens,

If you want all the duplicate entries too, then use appending internal table for all customers (for eg:) instead of FOR ALL ENTRIES where duplicates are eliminated.

Regards,

Raj