如何選擇正確的讀取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
相關文章
- 設計表時,如何選擇正確的資料型別資料型別
- 為什麼說選擇正確的程式語言很重要,以及如何正確的選擇
- 為什麼說選擇正確的程式語言很重要 以及如何正確的選擇
- SD--物料確定的資料表
- 如何選擇正確的雲伺服器配置伺服器
- 如何正確選擇適合的CRM系統?
- 資料庫的效能調優:如何正確的使用索引?資料庫索引
- 如何選擇正確的雲伺服器配置呢伺服器
- 如何選擇正確的Node框架:Next, Nuxt, Nest?框架UX
- 如何正確讀取RTI中enum
- 響應式設計:做出正確的選擇——資料資訊圖
- 選擇正確的 WebSphere 診斷工具Web
- 【UX設計】如何為你的遊戲選擇正確的字型?UX遊戲
- 如何為你的應用選擇正確的盈利模式?模式
- 如何選擇正確的Node框架:Express,Koa還是Hapi?框架ExpressAPI
- 如何為微服務選擇正確的訊息佇列微服務佇列
- 如何正確的刪除表空間資料檔案
- MongoDB是不是正確的選擇? - simplethreadMongoDBthread
- 如何選擇大資料的程式語言大資料
- 如何正確選擇Web前端培訓機構Web前端
- SD的重要的資料表
- 利聯科技:如何正確的選擇適合自己的伺服器伺服器
- 值得收藏!選擇正確BI工具的最佳指南
- 用 PHP 讀取檔案的正確方法PHP
- PL/SQL 中如何正確選擇遊標型別SQL型別
- 如何正確的停止MongoDB程式MongoDB
- 如何正確選擇ARM核心板、ARM工控板的儲存型別?型別
- 權威支援: 選擇正確的 WebSphere 診斷工具Web
- 海關資料如何正確使用
- 談如何正確理解 IP 資料的覆蓋率,兼談正確率~
- 《高效能MySQL》筆記——MySQL建表資料型別的選擇MySql筆記資料型別
- 正確停止資料泵程式
- 一表理清如何正確選擇視覺化圖表,掌握後再也不怕用錯圖表視覺化
- 演算法太多挑花眼?教你如何選擇正確的機器學習演算法演算法機器學習
- 如何提高python程式的效能Python
- [MobX State Tree資料元件化開發][3]:選擇正確的types.xxx元件化
- 讀取ClassPath下resource檔案的正確姿勢
- 微服務間如何選擇推送和拉取資料微服務