SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

FOR ALL ENTRIES with hashed table



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
vga
Мастер
Мастер


Age: 145
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Wed May 05, 2010 12:17 pm    Post subject: FOR ALL ENTRIES with hashed table Reply with quote

Коллеги, а не было ли у кого проблем при использование HASHED таблицы в качестве параметра для FOR ALL ENTRIES?

Отчет работал не один год, а тут неожиданно стали выбираться не все строки из EKBE в select ниже, вроде все перепроверил, не знаю, на что еще грешить. Проблема в продуктиве, лишние транспорта с экспериментами не приветсвуются.
Отправил пока запрос на пересбор статистики, может в ней дело.


Code:
DATA: it_lips TYPE HASHED TABLE OF ty_lips
       WITH UNIQUE KEY vbeln posnr WITH HEADER LINE.

DATA: it_ekbe TYPE SORTED TABLE OF ty_ekbe
       WITH NON-UNIQUE KEY ebeln ebelp WITH HEADER LINE.

SELECT ebeln ebelp shkzg charg menge budat
    INTO TABLE it_ekbe FROM ekbe
      FOR ALL ENTRIES IN it_lips
       WHERE ebeln EQ it_lips-vgbel AND
             ebelp EQ it_lips-vgpos+1 AND
             vgabe EQ '1' AND
             gjahr IN lr_gjahr.

_________________
Молитва - это запрос разработчику на изменение кода программы.
Back to top
View user's profile Send private message Blog Visit poster's website
Armann
Модератор
Модератор



Joined: 01 Jan 2008
Posts: 422
Location: Moscow

PostPosted: Wed May 05, 2010 1:46 pm    Post subject: Reply with quote

Было похожее странное поведение при выборке - выбиралось совсем не то что требовалось, и кстати проявилось сначала при запросе с FOR ALL ENTRIES, правда со стандартной таблицей. Пересбор статистики нам помог
Back to top
View user's profile Send private message Blog
Удав
Гуру
Гуру


Age: 48
Joined: 25 Jan 2008
Posts: 580
Location: Москва

PostPosted: Wed May 05, 2010 3:31 pm    Post subject: Reply with quote

Это старая беда - см. справку:
"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."
То есть для гарантированного получения всех записей по условию(а не только уникальных) необходимо, чтобы в списке полей в SELECT присутствовал первичный ключ таблицы, из которой выбираются данные с помощью FOR ALL ENTRIES.

_________________
С уважением,
Удав.
Back to top
View user's profile Send private message
vga
Мастер
Мастер


Age: 145
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Wed May 05, 2010 9:11 pm    Post subject: Reply with quote

Точно, как раз строки с одинаковым количеством материала пропали.
Когда то сам отвечал на этот вопрос "Проблема с FOR ALL ENTRIES", а сейчас забыл. Embarassed

Спасибо!

_________________
Молитва - это запрос разработчику на изменение кода программы.
Back to top
View user's profile Send private message Blog Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.