Let us take an example. Consider a purchase document as viewed via transaction ME23 as shown in Figure 1.
Figure 1. Purchase items in a purchase document viewed through ME23.
Figure 1 lists the purchase items of the purchasing document with number 4500000574. When we click on record item 2, then press the Item Conditions button as encircled in Figure 1, the condition records for purchase item 2 will be shown as displayed in Figure 2.
Figure 2. Sample display of condition records viewed through ME23.
From Figure 2, we are able to view the gross price, non-deductable tax, freight and cash discount conditions. The gross price costs 13,888 EUR per tone. Since the purchase item has a quantity of 3 tones, the condition value is 13,888 EUR x 3 = 41,664 EUR. The condition records also shows a freight cost which is a fixed amount of 540.61 EUR regardless of the quantity of the purchase item. Hence the total cost of the purchase item for crossing the country border is the gross price plus the freight cost: 41,664 + 540.61 = 42,204.61 EUR.
Conditions are stored in SAP through the KONV table. Figure 3 shows a description of the KONV table definition as viewed via SE11.
Figure 3. KONV table definition as seen through SE11.
To be able to find the condition records of Figure 2 in the KONV table, we need to know the KNUMV or the document condition number of the condition. (The KNUMV is a key field in the KONV table as shown in Figure 3.) To be able to know the KNUMV of a given condition, we can search this via transaction SE16 using the purchasing document header table or EKKO. In SE16, we search the EKKO table using the purchasing document number of 4500000574 or EKKO-EBELN = 4500000574. Doing this results to the table record shown in Figure 4.
Figure 4. Accessing the document condition through the EKKO table via transaction SE16.
From Figure 4, we find that the document condition number for purchase document with number 4500000574 is 1000008695. This means that EKKO-KNUMV = KONV-KNUMV = 1000008695.
We can then use this KNUMV value to access the condition records for the purchase document with number 4500000574 via transaction SE16 using table KONV. To access the condition records corresponding to the records shown in Figure 2, we note that the purchase item under consideration has value of 2. The purchase item number, technically the EBELP field of the EKPO table (EKPO-EBELP), corresponds to the condition item number, KPOSN, of the KONV table as shown in Figure 3.
Therefore to view the condition records in Figure 2, in the selection screen for the KONV table in SE16, we use a document condition number (KONV-KNUMV) of 1000008695 and an item number (KNUMV-KPOSN) of 2. Doing this results to the records in Figure 5.
Figure 5. Condition records viewed via SE16 through the KONV table.
Notice how the records in Figure 5 correspond to the records shown in Figure 2.
For the example of Figure 2, in ABAP terms, we can select the condition records through a code similar to the following.
SELECT EKKO~FIELD1
EKKO~FIELD2
EKKO~FIELD3
EKPO~FIELD1
EKPO~FIELD2
EKPO~FIELD3
KONV~FIELD1
KONV~FIELD2
KONV~FIELD3
FROM EKKO
INNER JOIN EKPO
ON EKKO-EBELN EQ EKPO-EBELN
INNER JOIN KONV
ON EKKO-KNUMV EQ KONV-KNUMV
AND EKPO-KPOSN EQ KONV-KPOSN
WHERE EKKO-EBELN EQ ‘4500000574’
AND EKPO-EBELP EQ ‘2’.
In doing so, we are able to link the EKKO, EKPO and KONV tables.
No comments:
Post a Comment