Posted: Fri Nov 23, 2007 11:22 am Post subject: Как ускорить селект по LIPS-VGBEL
Очень торомозит отчет, использующий связанные таблицы позиций по заказу и поставке. Таблицы связаны по ключу
VBAP~VBELN = LIPS~VGBEL
VBAP~POSNR = LIPS~VGPOS
другой связи не нашел. Придется создавать индекс для LIPS или есть другой способ?
Связь правильная, а вот как ускорить работу отчета, можно сказать, только увидев Ваш код и узнав, что Вы хотите получить в итоге
Может, пригодится вот эта ссылка:
https://www.sdn.sap.com/irj/sdn/thread?threadID=535308
SELECT
p~vgbel AS vbeln
p~vgpos AS posnr
p~matnr AS matnr
p~werks AS werksl
p~charg
p~lgort
p~mtart
p~vrkme
k~vkorg
k~auart
k~erdat
k~aedat
k~audat
k~vdatu
k~kunnr AS pkunag
a~werks AS werksv
a~vgbel AS vgbel
k~kunnr AS pkunwe
k~vbeln AS vbelnd
k~vstel
k~bldat
k~wadat
k~wadat_ist
k~aedat AS aedatd
k~lfdat
k~lfart
SUM( p~lfimg ) AS lfimg
APPENDING CORRESPONDING FIELDS OF TABLE gt_tab
FROM lips AS p
INNER JOIN likp AS k ON k~vbeln = p~vbeln
INNER JOIN vbak AS v ON v~vbeln = p~vgbel
INNER JOIN vbap AS a ON a~vbeln = p~vgbel AND
vbap~posnr = p~vgpos
WHERE
k~vkorg IN s_vkorg AND
k~bldat IN p_bldat AND
k~wadat IN s_erdat AND
k~wadat_ist IN s_wadat AND
k~kunag IN s_kunag AND
k~kunnr IN s_kunnr AND
k~lfart IN s_lfart AND
p~matnr IN s_matnr AND
p~charg IN s_charg AND
p~mtart IN s_mtart AND
p~matkl IN s_matkl AND
k~vstel IN s_werks AND
k~vbeln IN p_vbeln AND
k~vbeln IN s_vbeln AND
k~auart IN s_auart AND
k~audat IN s_audat AND
k~aedat IN p_aedat AND
k~aedat IN p_lastc
GROUP BY
p~vgbel
p~vgpos
p~matnr
p~werks
p~charg
p~lgort
p~mtart
p~vrkme
k~vkorg
k~auart
k~erdat
k~aedat
k~audat
k~vdatu
k~kunnr
k~kunnr
k~vbeln
k~vstel
k~bldat
k~wadat
k~wadat_ist
k~aedat
k~lfdat
k~lfart
a~werks
a~vgbel
ORDER BY
vbeln
matnr.
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.