如何選擇正確的讀取SD的資料表,提高程式效能
SD Table Access – SAP Note 185530
Read SAP Note 185530 before developing new SD report or if your SD report is running slow.
1. Accesses to sales orders (tables VBAK, VBAP)
Search orders for customer number (field VBAK-KUNNR)
If you want to look for sales order for a customer do not directly select from VBAK, instead first select on VAKPA and then based on what sales order you get execute second select in VBAK to get additional data.
Incorrect | SELECT FROM vbak WHERE kunnr = … |
Correct | SELECT FROM vakpa WHERE kunde = … SELECT FROM vbak WHERE vbeln = vakpa-vbeln. |
Search order items for material number (field VBAP-MATNR)
To search for sales order line for particular material select from table VAPMA first and then go to VBAP table for more information.
Incorrect | SELECT FROM vbap WHERE matnr = … |
Correct | SELECT FROM vapma WHERE matnr = … SELECT FROM vbap WHERE vbeln = vapma-vbeln AND posnr = vapma-posnr |
Use search help views defined for Sales Order
Other search helps for sales orders offer the matchcode tables and views M_VMVAx, x. = A, B, C, … M; for example search for purchase order number of the customer, description and so on.
View Name | Search Fields |
---|---|
M_VMVAA | Customer PO number |
M_VMVAE | Partner number (KUNNR, LIFNR, or PERNR) |
M_VMVAL | Sales Org, Sold-to party |
M_VMVAO | Sold-to party |
2. Accesses to deliveries (tables LIKP, LIPS)
Search for deliveries with customer number (field LIKP-KUNNR)
Incorrect | SELECT FROM likp WHERE kunnr = … |
Correct | SELECT FROM vlkpa WHERE kunde = … SELECT FROM likp WHERE vbeln = vlkpa-vbeln. |
Search for delivery items with material number (field LIKP-MATNR)
Incorrect | SELECT FROM lips WHERE matnr = … |
Correct | SELECT FROM vlpma WHERE matnr = … SELECT FROM lips WHERE vbeln = vlpma-vbeln AND posnr = vlpma-posnr |
Search for deliveries with sales order number (preceding document, field LIPS-VGBEL)
Incorrect | SELECT FROM lips WHERE vgbel = … |
Correct | SELECT FROM vbfa WHERE VBELV = … and VBTYP_N = ‘J’ SELECT FROM lips WHERE vbeln = vbfa-vbeln AND posnr = vbfa-posnn |
Use search help views defined for Delivery
Other search helps for deliveries offer matchcode tables and views M_VMVLx, x. = A, B, C, … M; for example search for goods issue date, picking date, transportation planning date and so on.
3. Accesses to invoices (tables VBRK, VBRP)
Search for invoices with customer number (“payer”) (field VBRK-KUNRG)
Incorrect | SELECT FROM vbrk WHERE kunrg = … |
Correct | SELECT FROM vrkpa WHERE kunde = … SELECT FROM vbrk WHERE vbeln = vrkpa-vbeln |
Search for invoice items with material number (field VBRP-MATNR)
Incorrect | SELECT FROM vbrp WHERE matnr = … |
Correct | SELECT FROM vrpma WHERE matnr = … SELECT FROM vbrp WHERE vbeln = vrpma-vbeln AND posnr = vrpma-posnr |
Search for invoices with delivery number (preceding document, field VBRP-VGBEL)
Incorrect | SELECT FROM vbrp WHERE vgbel = … |
Correct | SELECT FROM vbfa WHERE vbtyp_n = ‘M’ AND vbelv = … SELECT FROM vbrp WHERE vbeln = vbfa-vbeln AND posnr = vbfa-posnn |
Search for invoices with order number (preceding document, field VBRP-AUBEL)
Incorrect | SELECT FROM vbrp WHERE aubel = … |
Correct | SELECT FROM vbfa WHERE vbtyp_n = ‘M’ AND vbelv = … SELECT FROM vbrp WHERE vbeln = vbfa-vbeln AND posnr = vbfa-posnn |
4. Other accesses in SD
Document flow
In table VBFA only the preceeding document is used to search for the subsequent document (for example, delivery for order). Searching the other way makes no sense with this table since the preceding documents (for example, order for delivery) are stored directly in the document tables. Thus reading in table VBFA is a one-way street.
Incorrect | SELECT vbelv FROM vbfa WHERE vbeln … |
Correct | SELECT vgbel FROM lips WHERE vbeln = …; or SELECT vgbel FROM vbrp WHERE vbeln = …; or SELECT aubel FROM vbrp WHERE vbeln = … |
Search for shipping unit item with delivery
Incorrect | SELECT FROM vepo WHERE vbtyp = ‘J’ AND vbeln = i_lips-vbeln |
Correct | SELECT FROM vbfa WHERE vbtyp_n = ‘X’ AND vbelv = i_lips-vbeln SELECT FROM vepo WHERE venum = vbfa-vbeln |
Link to SAP Note 185530
相關文章
- 設計表時,如何選擇正確的資料型別資料型別
- 如何選擇正確的雲伺服器配置伺服器
- 如何選擇正確的Node框架:Next, Nuxt, Nest?框架UX
- 如何正確選擇適合的CRM系統?
- 資料庫的效能調優:如何正確的使用索引?資料庫索引
- 選擇catalyst是正確的麼?
- 在分割槽表上使用正確的索引來提高效能索引
- 選擇華瑞,是我做的最正確的選擇
- 如何選擇正確的雲伺服器配置呢伺服器
- 如何正確讀取RTI中enum
- MongoDB是不是正確的選擇? - simplethreadMongoDBthread
- 如何選擇正確的Node框架:Express,Koa還是Hapi?框架ExpressAPI
- 如何為微服務選擇正確的訊息佇列微服務佇列
- 【UX設計】如何為你的遊戲選擇正確的字型?UX遊戲
- 如何正確選擇Web前端培訓機構Web前端
- 利聯科技:如何正確的選擇適合自己的伺服器伺服器
- 用 PHP 讀取檔案的正確方法PHP
- 如何提高python程式的效能Python
- 值得收藏!選擇正確BI工具的最佳指南
- [MobX State Tree資料元件化開發][3]:選擇正確的types.xxx元件化
- 選擇正確DevSecOps解決方案的七個技巧dev
- 如何正確選擇ARM核心板、ARM工控板的儲存型別?型別
- 《高效能MySQL》筆記——MySQL建表資料型別的選擇MySql筆記資料型別
- 談如何正確理解 IP 資料的覆蓋率,兼談正確率~
- 一表理清如何正確選擇視覺化圖表,掌握後再也不怕用錯圖表視覺化
- 讀取ClassPath下resource檔案的正確姿勢
- SD-如何讀取文字訂單的抬頭文字
- 微服務間如何選擇推送和拉取資料微服務
- 海關資料如何正確使用
- 一文講清如何正確選擇圖表,學會後再也不會用錯圖表
- 如何用ABAP程式碼讀取CDS view association的資料View
- 正確讀取SQL Server中的擴充套件事件SQLServer套件事件
- 【譯】Web 效能優化: 使用 Webpack 分離資料的正確方法Web優化
- 如何正確挑選人力資源資訊系統?
- 如何選擇合適的NoSQL資料庫SQL資料庫
- 資料視覺化如何選擇合適的視覺化圖表?視覺化
- 如何正確定義效能瓶頸
- 如何正確選擇iOS簽名,它們有什麼區別iOS