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

Проблема с объединением ekpo и vbrp



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
vetal
Участник
Участник



Joined: 18 Jan 2008
Posts: 44

PostPosted: Mon Feb 04, 2008 11:51 pm    Post subject: Проблема с объединением ekpo и vbrp Reply with quote

Добрый вечер.
Требуется сделать select с использованием for all entries
где на основе
ekpo-bednr ekpo-afnam
выбрать
vbrp-aubel vbrp-aupos

Проблема в том, что типы afnam и aupos различные, поэтому не может использоваться в FOR ALL ENTRIES.

Посоветуйте, пожалуйста, рабочий способ?
Back to top
View user's profile Send private message
vga
Мастер
Мастер


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

PostPosted: Tue Feb 12, 2008 5:32 pm    Post subject: Reply with quote

Ответ малость запоздалый. Проблема в разхной длине полей, поэтому прямым JOIN объединение не сделать.

Видится два способа:
1) Через FOR ALL ENTRIES.

Code:
DATA: BEGIN OF itab_ekpo OCCURS 0,
  bednr LIKE ekpo-bednr,
  afnam LIKE ekpo-afnam,
END OF itab_ekpo.

DATA: BEGIN OF itab_vbrk OCCURS 0,
  aubel LIKE vbrp-aubel,
  aupos LIKE vbrp-aupos,
END OF itab_vbrk.

LOOP AT itab_ekpo.
  itab_vbrk-aubel = itab_ekpo-bednr.
  itab_vbrk-aupos = itab_ekpo-afnam.
  APPEND itab_vbrk.
ENDLOOP.

SELECT * FROM vbrp
  INTO TABLE t_vbrp
  FOR ALL ENTRIES IN itab_vbrk
  WHERE aubel = itab_vbrk-aubel
      AND aupos = itab_vbrk-aupos.



2) Создать промежуточную таблицу в словаре с двумя полями

afnam LIKE ekpo-afnam
aupos LIKE vbrp-aupos.

Заполнить таблицу значениями
Quote:
afnam aupos
'000000000001' '000001'
'000000000002' '000002'
'000000000003' '000003'
...
'0000000999999' '999999'


и делать Join через нее. Возможно, будет достоточно 999 значений, нужно подвериться, какое максимальное значение допустимо в вашей системе.
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.