05-09-2006 8:18 AM
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
05-09-2006 8:31 AM
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??
05-09-2006 9:06 AM
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
05-09-2006 9:48 AM
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