Upload
krishnacfp232
View
244
Download
0
Embed Size (px)
Citation preview
7/30/2019 SD User Exit
1/26
SAP America
R
Top 10 SD Userexits
Ramesh Prasad
Product Requirements Planning
7/30/2019 SD User Exit
2/26
SAP America
R
What is a Userexit?
A Userexit is a predefined point
in the SAP standard code where the user can write code
to influence processing.
Code written in userexits is not overwritten during anupgrade.
A list of most userexits can be found in the IMG.
SD -> System Modification -> Userexits
This list was significantly improved with Release 3.1G Code written in userexits is not supported by SAP.
7/30/2019 SD User Exit
3/26
SAP America
R
TOP 10 SD Userexits
1. APPEND Structures
2. User Screens in Sales Order Processing
3. Determining Sales Orders Fields
4. Add New Fields for Pricing
5. Pricing Procedure Userexits
6. ATP Plant Selection
7. Partner for Customer/Material Info Record
8. Sales Document Save Userexits9. Pricing Type with New Pricing
10.Influencing New Pricing
7/30/2019 SD User Exit
4/26
SAP America
R
Number 1: Append Structures
1 Can I add a new field to the sales order?
Release 3.0A APPEND STRUCTURES
7/30/2019 SD User Exit
5/26
SAP America
R
Number 2: User Screens in Sales Order Entry
2 I just added a field to the sales order header. How
can I maintain / display it in the sales order?
HEADER
SAPMV45A 8309
This is an include dynpro in SAPMV45A 309
ITEM
SAPMV45A 8459
This is an include dynpro in SAPMV45A 459
7/30/2019 SD User Exit
6/26
SAP America
R
User dynpros exist as part of the additional
data screens at header/item level in 3.0. They
have their own tabs in Release 4.0.
Sales Installation Specific Data Definitions
MV45ATZZ
Sales Installation Specific PBO Modules MV45AOZZ
Sales Installation Specific PAI Modules
MV45AIZZ
2 I just added a field to the sales order header. How
can I maintain / display it in the sales order?
Number 2: User Screens in Sales Order Entry
7/30/2019 SD User Exit
7/26
SAP America
R
Number 3: Determining Sales Order Fields
MV45AFZZ Sales Order Header
USEREXIT_MOVE_FIELD_TO_VBAK
Sales Order ItemUSEREXIT_MOVE_FIELD_TO_VBAP
MV45AFZB
Sales Order Serial Numbers USEREXIT_MOVE_FIELD_TO_VBSN
3a I just added a new field to the sales order header.
How do I fill it with a value?
3b How can I determine the payment terms different
from standard?
Sales Order Schedule Line USEREXIT_MOVE_FIELD_TO_VBEP
Sales Order Business Data USEREXIT_MOVE_FIELD_TO_VBKD
7/30/2019 SD User Exit
8/26 SAP America
R
Number 3: Determining Sales Order Fields
MV45ATZZ
Use for general data declarations
TABLES: YYYY.
Common Work Areas
KUAGV - Sold-to Party Information
KUWEV - Ship-to Party Information
KURGV - Payer Information
KUREV - Bill-to Party Information
MAAPV - Material Master View: Sales Screen 1
MAEPV - Material Master View: Sales Screen 2
7/30/2019 SD User Exit
9/26 SAP America
R
Number 3: Determining Sales Order Fields
MV45AFZZ3a FORM USEREXIT_MOVE_FIELD_TO_VBAK.
IF SVBAK-TABIX = 0.
VBAK-ZZFIELD = YYYY-ZZFIELD1.
ENDIF.3b FORM USEREXIT_MOVE_FIELD_TO_VBKD.
IF SVBKD-TABIX = 0.
VBKD-ZTERM = YYYY-ZZFIELD2.
ENDIF.
7/30/2019 SD User Exit
10/26 SAP America
R
Number 4: Add New Fields for Pricing
4 How can I price off of the new field I added to the
sales order header?
Add new field to:
KOMKAZ - User header fields for pricing
KOMPAZ - User item fields for pricing
Add to pricing field catalog and create
necessary pricing tables, access sequences.
Next slide .
7/30/2019 SD User Exit
11/26 SAP America
R
Number 4: Add New Fields for Pricing
Fill value during order entry and billing.
MV45AFZZ - Sales Order
USEREXIT_PRICING_PREPARE_TKOMK
TKOMK-ZZABC = VBAK-ZZABC.
USEREXIT_PRICING_PREPARE_TKOMP
TKOMP-ZZABC = VBAP-ZZABC.
RV60AFZZ - Billing DocumentUSEREXIT_PRICING_PREPARE_TKOMK
USEREXIT_PRICING_PREPARE_TKOMP
4 How can I price off of the new field I added to the
sales order header?
7/30/2019 SD User Exit
12/26 SAP America
R
Number 5: Pricing Procedure Userexits
5 What are all of the formulas, requirements, etc. in
the pricing procedure for?
Pricing Procedure Requirement
Access Sequence Requirement
Scale Base Formula
Condition Base Formula
Condition Value Formula
7/30/2019 SD User Exit
13/26 SAP America
R
VOFM
Requirements
CopyingRequirements
Formulas
Data transfer
Sales
Orders
DeliveriesBilling
DocumentsTexts
Sales
Activities
Pricing
Output
Control
Account
determination
Material
determination
Listing /
Exclusion
Scale
base
Condition
base
Condition
base value
Structure of
group key
Rounding
ruleStatistics
Number 5: Pricing Procedure Userexits
7/30/2019 SD User Exit
14/26 SAP America
R
Number 5: Pricing Procedure Userexits
General Notes
Requirements are available to aid performance by
eliminating unnecessary accesses to the database.
Formulas are available to calculate values differently
from the way they are calculated in the standard system
or to set certain values.
In formulas, the field XKWERT always stands for the
number being determined.
Important work areas:
KOMK - Sales header communication structure
KOMP - Sales item communication structure
XKOMV - Internal pricing table
7/30/2019 SD User Exit
15/26 SAP America
R
Number 5: Pricing Procedure Userexits
Requirements
Definable at the pricing procedure
and access sequence level.
The requirement routine defines the circumstances
under which the access should be made.
Examples
Requirement 6: Only perform the access if condition
exclusion is not active.
CHECK: KOMP-KZNEP NE X.
New Requirement: Discount is only relevant for items
with material group ABC.
CHECK: KOMP-MATKL EQ ABC.
7/30/2019 SD User Exit
16/26 SAP America
R
Number 5: Pricing Procedure Userexits
Formulas
Scale Base Formula
This formula alters the value that the system uses to read the scales in
the condition record.
Standard delivered formula 023 is used with condition type KP03 to
compute the incremental surcharge for not ordering in full pallets. If24.30 pallets are ordered, scale base formula 023 changes
XKWERT to 0.30 which is then used to read the scales to determine
the appropriate surcharge.
Scale
Base
7/30/2019 SD User Exit
17/26 SAP America
R
Number 5: Pricing Procedure Userexits
Formulas
Condition Base Formula
After the condition record has been read and the scale value retrieved,
it is possible to influence the condition basis to which the scale value
will be applied.
Standard delivered formula 022 is used with condition type KP00 tocompute the discount based on full pallets ordered. If 24.30 pallets
are ordered, condition base formula 022 changes XKWERT to 24
which is then multiplied by the scale rate.
Condition
Base Formula
7/30/2019 SD User Exit
18/26 SAP America
R
Number 5: Pricing Procedure Userexits
Formulas
Condition Value Formula
After the system has found the correct scale rate from the condition
record and the condition basis for the calculation, the condition value
is calculated.
Scale Rate Condition Basis Condition Value
5- USD per CS X 5 CS = 25- USD
10- % X 1500 USD = 150- USD
It is possible to influence the condition value calculated by the system
using the condition value formula. It is also possible to use theformula to do comparisons and set flags.
7/30/2019 SD User Exit
19/26 SAP America
R
Number 5: Pricing Procedure Userexits
Formulas
Condition Value Formula - Examples
Under certain circumstances, the condition value should be set to
zero.
IF XXX = YYY.
XKWERT = 0.
ENDIF.
Standard formulas 8 and 9 are used with customer expected price
to compare the expected value / price with the net value of the sales
order item. Based on the result, the pricing ok flag is used to block
the line item.
7/30/2019 SD User Exit
20/26 SAP America
R
Number 6: ATP Plant Selection
6a My primary sourcing plant is determined by zip
code and shipping conditions. Can I do this in SAP?6b How can I automate the selection of plants on the
Other Plants push button screen?
MV45AFZB
Selection of primary sourcing plantUSEREXIT_SOURCE_DETERMINATION
RV03VFZZ
Selection of secondary sourcing plantUSEREXIT_PLANT_SELECTION
7/30/2019 SD User Exit
21/26 SAP America
R
Number 6: ATP Plant Selection
Define new table (ZZSOURCE) in data dictionary:
ZIPCD Zip code (full or partial length)
LPRIO Delivery priority
PLNT1 Plant 1
PLNT2 Plant 2, 3, 4, etc.
MV45AFZB
FORM USEREXIT_SOURCE_DETERMINATION
SELECT SINGLE * FROM ZZSOURCE
WHERE ZIPCD EQ KUWEV-PSTLZ
AND LPRIO EQ KUWEV-VSBED.
VBAP-WERKS = ZZSOURCE-PLNT1.
6a My primary sourcing plant is determined by zip
code and shipping conditions. Can I do this in SAP?
7/30/2019 SD User Exit
22/26 SAP America
R
Number 6: ATP Plant Selection
RV03VFZZ
FORM USEREXIT_PLANT_SELECTION
SELECT SINGLE * FROM ZZSOURCE
WHERE ZIPCD EQ KUWEV-PSTLZ
AND LPRIO EQ KUWEV-VSBED.
(Mark SELKZ field in PLANTS internal table for the plant(s)that should be checked or rearrange plants to show secondary,tertiary, etc. selections).
6b How can I automate the selection of plants on the
Other Plants push button?
7/30/2019 SD User Exit
23/26
7/30/2019 SD User Exit
24/26 SAP America
R
Number 8: Sales Document Save Userexits
MV45AFZZ
8a USEREXIT_SAVE_DOCUMENT_PREPARE
(Look at Note 64876 if you want to return the user to
the transaction.)
MV45AFZZ
8b USEREXIT_SAVE_DOCUMENT
8a I have some special checks to perform before a
sales order can be saved. Where can I specifythem?
8b I have some user tables to update when a sales
order is saved. Where can I do that?
7/30/2019 SD User Exit
25/26 SAP America
R
Number 9: Pricing Type with New Pricing
MV61AFZA
USEREXIT_CHANGE_PRICING_RULE
PRICING_RULE = C.
Release 4.0C allows the pricing rule to be
specified in a pop up window with New Pricing.
Refer to note 24832 for more examples.
9 When I use new pricing in the sales order, I lose
all manually entered conditions. Can I do anythingabout this?
7/30/2019 SD User Exit
26/26
R
Number 10: Influencing New Pricing
10 When I change the value of field XXX, the system
does not automatically reprice the document. Howcan I accomplish this?
MV45AFZB
USEREXIT_NEW_PRICING_VBAP (document item)
Example: New pricing if the route is changed.
IF VBAP-ROUTE NE *VBAP-ROUTE.
NEW_PRICING = 'B'.
ENDIF.
USEREXIT_NEW_PRICING_VBKD (business data)