Reason and Prerequisites
The R/3 System contains no secondary indexes to the most important SD transaction data tables in the delivery. Instead, the R/3 System has proprietary index tables (sales document indexes, for example the tables VAKPA and VAPMA, matchcode tables for example M_VMVAB, M_VMVAC or matchcode views for example M_VMVAA, M_VMVAE), which allow an efficient access.
In order to use these efficiently a certain basic knowledge of the SAP data model is required. For this this note lists the most important errors which are made and it offers alternatives.
However note the following WARNINGS:
Consider the following NOTES:
In the following examples, there are often accesses to several tables, for example:
SELECT FROM vakpa WHERE kunde = ... SELECT FROM vbak WHERE vbeln = vakpa-vbeln.
It can increase the performance, to define a selection view on the corresponding tables (here: VAKPA and VBAK) in order to combine the accesses to the two tables in one access.
SELECT FROM vbak WHERE vbeln = vakpa-vbeln.
AND posnr = vapma-posnr
AND posnr = vlpma-posnr
AND posnr = vbfa-posnn
AND posnr = vrpma-posnr
AND vbelv = ... SELECT FROM vbrp WHERE vbeln = vbfa-vbeln
AND posnr = vbfa-posnn
SELECT FROM vbrp WHERE vbeln = vbfa-vbeln
AND posnr = vbfa-posnn
Correct: SELECT vgbel FROM lips WHERE vbeln = ...; or SELECT vgbel FROM vbrp WHERE vbeln = ...; or
SELECT aubel FROM vbrp WHERE vbeln = ...
SELECT FROM vepo WHERE venum = vbfa-vbeln
In order to use these efficiently a certain basic knowledge of the SAP data model is required. For this this note lists the most important errors which are made and it offers alternatives.
However note the following WARNINGS:
- Before you use the listed alternatives productively, you must check your program closely for functional accuracy.
- The sales document indexes must be maintained correctly in your system. This is usually automatically the case, however, there can be inconsistencies. Carefully read and follow Notes 128947 and 178328.
Consider the following NOTES:
In the following examples, there are often accesses to several tables, for example:
SELECT FROM vakpa WHERE kunde = ... SELECT FROM vbak WHERE vbeln = vakpa-vbeln.
It can increase the performance, to define a selection view on the corresponding tables (here: VAKPA and VBAK) in order to combine the accesses to the two tables in one access.
Solution
- 1. Accesses to sales orders (tables VBAK, VBAP)
- a) Search orders for customer number (field VBAK-KUNNR):
Incorrect: SELECT FROM vbak WHERE kunnr = ...
SELECT FROM vbak WHERE vbeln = vakpa-vbeln.
- b) Search order items for material number (field VBAP-MATNR):
Incorrect: SELECT FROM vbap WHERE matnr = ...
AND posnr = vapma-posnr
- c) 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
- 2. Accesses to deliveries (tables LIKP, LIPS)
- a) Search for deliveries with customer number (field LIKP-KUNNR):
Incorrect: SELECT FROM likp WHERE kunnr = ...
- b) Search for delivery items with material number (field LIKP-MATNR):
Incorrect: SELECT FROM lips WHERE matnr = ...
AND posnr = vlpma-posnr
- c) Search for deliveries with sales order number (preceding document, field LIPS-VGBEL):
Incorrect: SELECT FROM lips WHERE vgbel = ...
AND posnr = vbfa-posnn
- d) 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)
- a) Search for invoices with customer number ("payer") (field VBRK-KUNRG):
Incorrect: SELECT FROM vbrk WHERE kunrg = ...
- b) Search for invoice items with material number (field VBRP-MATNR):
Incorrect: SELECT FROM vbrp WHERE matnr = ...
AND posnr = vrpma-posnr
- c) Search for invoices with delivery number (preceding document, field VBRP-VGBEL):
Incorrect: SELECT FROM vbrp WHERE vgbel = ...
AND vbelv = ... SELECT FROM vbrp WHERE vbeln = vbfa-vbeln
AND posnr = vbfa-posnn
- d) Search for invoices with order number (preceding document, field VBRP-AUBEL):
Incorrect: SELECT FROM vbrp WHERE aubel = ...
SELECT FROM vbrp WHERE vbeln = vbfa-vbeln
AND posnr = vbfa-posnn
- 4. Other accesses in SD:
- a) Document flow:
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 = ...
- b) Search for shipping unit item with delivery
Incorrect: SELECT FROM vepo WHERE vbtyp = 'J' AND vbeln = i_lips-vbeln
SELECT FROM vepo WHERE venum = vbfa-vbeln
No comments:
Post a Comment