[轉]SAP SD定價技術分析

LittleGun發表於2010-01-18

定價技術一直是SAP引以為豪的一個設計。設計也很複雜,閒下空來DEBUG了一下SAP的標準程式。
基礎的IMG設定(定價表/訪問順序/定價型別/定價過程)就不說了,
現將一些SAP的定價邏輯分享給大家,希望能給做定價增強的ABAPer兄弟一些些幫助。

[@more@]

1) 定價程式
FunctionPool: SAPLV61A
Function Name: Pricing

2) 變數說明
XKOMV 記錄系統定價結果(Item Level)
TKOMV 記錄系統定價結果(Doc. Level)
KOMT1 定價過程
KOMT2 訪問順序
KOMK 定價關鍵字(表頭)
KOMP 定價關鍵字(行)

3) 程式處理邏輯
A) 整理 KOMK / KOMP 的值 (SAP提供介面做增強,SO/DN/BILLING)
SO:
Program: MV45AFZZ
User Exit: userexit_pricing_prepare_tkomk / userexit_pricing_prepare_tkomp
DN:
BADI: LE_SHP_PRICING
Method: CHANGE_INPUT_HEADER_AND_ITEMS
BILLING:
Program: RV60AFZZ
User Exit: USEREXIT_PRICING_PREPARE_TKOMK / USEREXIT_PRICING_PREPARE_TKOMP

B) 抓取定價IMG的相關設定
Program: LV61AA12
FORM: KONDITIONSVORSTEP
* --&gt KOMK header communication structure *
* *

C) 根據定價設定,整理定價過程結果內表
Program: LV61AA67
FORM: XKOMV_AUFBAUEN_AUS_KOMT1
*---------------------------------------------------------------------*
* Build XKOMV from KOMT1 derived from T683S *
*---------------------------------------------------------------------*
* --&gt KOMK header communication structure *
* --&gt KOMP item communication structure *
* --&gt KOMT1 pricing procedure *
* --&gt KOMT2 accesses *
* *---------------------------------------------------------------------*

定價過程中的"需求"將在這裡被處理. 如果檢查透過的話,改定價型別將會被記錄在XKOMV裡面.
價格主檔的資料也會在這裡被處理,見
Program: LV61AA29
FORM: konditionen_lesen

D) 根據TKOMV整理XKOMV定價過程結果內表
Program: LV61AA58
FORM: XKOMV_AUFBAUEN_AUS_TKOMV
*---------------------------------------------------------------------*
* Build XKOMV from TKOMV *
*---------------------------------------------------------------------*
* --&gt KOMT1 pricing procedure *
* --&gt TKOMV complete table of conditions *
* *---------------------------------------------------------------------*

E) 定價過程內表的計算(處理Formula,subtotal,base value ...)
Program: LV61AA55
FORM: XKOMV_BEWERTEN
*---------------------------------------------------------------------*
* Calculate on internal table of conditions *
*---------------------------------------------------------------------*
* --&gt PREISFINDUNGSART pricing type *
* --&gt KOMK header communication structure *
* KOMP item communication structure *
* XKOMV internal table of conditions *
* GKOMV table of group conditions pricing type F only *
* --&gt GKOMZ table of group cond indeces pricing type F only *
*---------------------------------------------------------------------*

小計/計算型別/基礎型別 在這裡被處理. 可參考 SAP NOTES: 900089,有詳細描述處理邏輯.

F) 根據表T684的記錄,執行定價排斥
Program: LV61AA56
FORM: XKOMV_AUSSCHLUSS
可參考 SAP NOTES: 836243

G) 將XKOMV的結果整理到TKOMV
Program: LV61AA42
FORM: XKOMV_UEBERTRAGEN_NACH_TKOMV
*---------------------------------------------------------------------*
* Transfer XKOMV to TKOMV *
*---------------------------------------------------------------------*
* --&gt XKOMV table document conditions *
* *---------------------------------------------------------------------*

4) 有關定價的一些SAP NOTES.
1165078 Authorization check for conditions or subtotals
1007110 How is the KWERT determined in a subtotal?
836243 How condition exclusion works in R/3
791944 How is the KBETR determined in a subtotal?
485740 Conditions with fixed amount in copy activities
201830 Calculation of the net price of an item
154529 Pricing in the delivery
130417 Pricing preparation in billing document (user exit)
92090 Exclusion indicator KZNEP
67958 Mode of operation of the condition exclusion
41490 Condition exclusion (KZNEP)
24832 Pricing rules / TVCPF
18173 Minimum order value
900089 Pricing: Processing steps FORM XKOMV_BEWERTEN
363212 'Pricing analysis' mode of operation

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23138807/viewspace-1030684/,如需轉載,請註明出處,否則將追究法律責任。

相關文章