Академический Документы
Профессиональный Документы
Культура Документы
00
Pricing
Userexit
Manual
OVERVIEW
DEVELOPMENT
UP-GRADE
VERSION V1.05 – 16 FEBRUARY 2009 - © SAP AG 2009
2
CHANGE LOG
© Copyright 2009 SAP AG. All rights reserved. Citrix®, the Citrix logo, ICA®, Program
Neighborhood®, MetaFrame®, WinFrame®,
No part of this publication may be reproduced or VideoFrame®, MultiWin® and other Citrix product
transmitted in any form or for any purpose without the names referenced herein are trademarks of Citrix
express permission of SAP AG. The information Systems, Inc.
contained herein may be changed without prior notice.
HTML, DHTML, XML, XHTML are trademarks or
Some software products marketed by SAP AG and its registered trademarks of W3C®, World Wide Web
distributors contain proprietary software components Consortium, Massachusetts Institute of Technology.
of other software vendors.
JAVA® is a registered trademark of Sun Microsystems,
® ® ® ® ®
Microsoft , WINDOWS , NT , EXCEL , Word , Inc.
PowerPoint® and SQL Server® are registered
trademarks of Microsoft Corporation. JAVASCRIPT® is a registered trademark of Sun
Microsystems, Inc., used under license for technology
IBM®, DB2®, DB2 Universal Database, OS/2®, invented and implemented by Netscape.
Parallel Sysplex®, MVS/ESA, AIX®, S/390®, AS/400®,
OS/390®, OS/400®, iSeries, pSeries, xSeries, zSeries, MarketSet and Enterprise Buyer are jointly owned
z/OS, AFP, Intelligent Miner, WebSphere®, Netfinity
TM
®
, trademarks of SAP AG and Commerce One.
® ®
Tivoli , Informix and Informix Dynamic Server are
trademarks of IBM Corporation in USA and/or other
SAP, R/3, mySAP, mySAP.com, xApps, xApp, and
countries. other SAP products and services mentioned herein as
well as their respective logos are trademarks or
ORACLE® is a registered trademark of ORACLE registered trademarks of SAP AG in Germany and in
Corporation. several other countries all over the world. All other
product and service names mentioned are the
UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of their respective companies.
trademarks of the Open Group.
CONTENTS
Change Log ........................................................................................................................2
Contents .............................................................................................................................4
1 Overview.........................................................................................................................7
1.1 Motivation ............................................................................................................................... 7
1.2 What changed?....................................................................................................................... 7
1.3 Walk through .......................................................................................................................... 7
1.4 Prerequisites........................................................................................................................... 8
1.5 Further Information ................................................................................................................. 9
1.6 SAP E-Commerce for ERP using VMC ................................................................................... 9
1.7 SAP Support for User Exits Implementations.......................................................................... 9
3 Administration .............................................................................................................15
3.1 Overview about different Userexit Types............................................................................... 15
3.2 Register an Implementation .................................................................................................. 16
3.3 Assign Implementations to Formula ...................................................................................... 18
5 Debugging....................................................................................................................32
5.1 Set VMC in Debug Mode ...................................................................................................... 32
5.2 Attach Eclipse Java Debugger .............................................................................................. 32
5.3 View VMC Log Files ............................................................................................................. 32
6 Upgrade Guide.............................................................................................................34
C FAQ ...............................................................................................................................58
C.1 Implementation ..................................................................................................................... 58
C.2 Troubleshooting.................................................................................................................... 59
PRICING USEREXIT MANUAL 7
1 OVERVIEW
1.1 Motivation
SAP developed a very stable application server and also organized one of the first reliable development systems for
large business applications. It includes everything a developer need. Additionally it includes a versioning and transport
system, so even large application landscapes can be provided with changes and supplementary developed parts.
The server contains many preventive measures to stabilize it and improve the performance of the running applications
on top. Some of these measures are separation of user sessions and OS processes, improved DB transaction handling,
better memory footprint and much more.
Now SAP also goes that direction and applies nearly all server features not only to ABAP but also to Java. The Virtual
Machine Container (VMC) runs Java, reads its code from the database and offers the same stability as the kernel to
ABAP. All parts of the Internet Pricing Configurator (IPC) use now the new server infrastructure with Application
Platform (AP) 2005 (e.g. delivered with CRM 5.0) and are called Pricing, Tax and Configuration Engines.
import java.math.BigDecimal;
import com.sap.spe.base.logging.UserexitLogger;
import com.sap.spe.conversion.ICurrencyValue;
import com.sap.spe.pricing.transactiondata.userexit.IGroupConditionUserExit;
import com.sap.spe.pricing.transactiondata.userexit.IPricingConditionUserExit;
import com.sap.spe.pricing.transactiondata.userexit.IPricingDocumentUserExit;
8
import com.sap.spe.pricing.transactiondata.userexit.IPricingItemUserExit;
import com.sap.spe.pricing.transactiondata.userexit.ValueFormulaAdapter;
return result.subtract(qnt);
}
This coding must be written, compiled and uploaded with help of the eclipse environment and the transaction
/SAPCND/UE_DEV (enter a leading /n while using the direct transaction field).
The metadata entries are maintained using the transaction /SAPCND/UEASS with the usage PR (for pricing). In the
implementations part selected with the userexit type VAL, the customer adds the new userexit name ZSPECROUND
and goes to details. Here he adds a description and the class name your.company.pricing.userexits.
ZSpecialRoundingValueFormula. Now the coding is known to pricing and a formula number must be attached to that
userexit. In the section formulas with the application CRM (or other) the customer adds the number 600 and selects his
userexit name to it.
The only thing left for the customer is to use that formula and put it in a pricing procedure on the right line and restart
the transaction using pricing functionality. Due to the buffering mechanism it may be necessary to restart the VMC or a
buffer refresh takes place (see note 867428).
1.4 Prerequisites
The reader of this manual is expected to have a good understanding of the java language. Additional knowledge about
pricing is required if new userexits should be implemented. It is also expected that the user has basic knowledge about
the eclipse development environment for java.
Depending on the installed Support Package of AP 7.00 following table shows the SAP notes which must be
implemented.
SP Note Description
<02 Various issues have been fixed with SP02. We strongly recommend not to use SP00 and SP01
<03 902038 Error messages with unchanged userexit entries in /SAPCND/UEASS
<03 902329 Module and Package checks in /SAPCND/UE_DEV
<03 915882 Attribute mapping in Userexit maintenance
<05 928865 Userexit Development concerning external taxes
2 DEVELOPMENT ENVIRONMENT
The following section describes one way of developing pricing userexits. Only freely available tools which can be
downloaded from the internet are used. Other integrated development environments (IDE) do also work but additional
effort has to be spent because SAP already delivers with this note an example project for eclipse. Other eclipse based
IDEs like NetWeaver Developer Studio may also work with that prepared project template.
4. Select the Download option and activate the option Libraries. Downloading requires a minimum authorization
of exporting data from SAPGUI into the local file system (Object S_GUI, ACTVT 61)
5. Enter as path the newly created subfolder PRC_UE_CUSTOMER (e.g. C:\DEV\ PRC_UE_CUSTOMER) and
hit the execute button. The downloading will take a few minutes and create some subfolder in the
PRC_UE_CUSTOMER directory containing some API jars and some source jars
6. Start eclipse and select as workspace the manual created folder (C:\DEV). Eclipse will create the meta data for
an empty workspace
7. Select File Import… and Import an Existing Project into Workspace. Select the PRC_UE_CUSTOMER
folder as root directory. Eclipse should show the PRC_UE_CUSTOMER as project name
8. Now the JRE System Libraries have to be added to the build path of eclipse. Activate the context menu on the
project (right mouse click) and select Build Path Add Libraries. Select JRE System Library and use a 1.4.x
version
9. Prepare the API source and build the HTML documentation. Activate the context menu (right mouse click) on
build_api_doc.xml and select Run As Ant Build. Please ignore the error message thrown during that process
10. Refresh the eclipse Project by right mouse clicking on the project and selecting Refresh (F5) in the context
menu
Now the default project is ready to be used for custom developments. Java Documentation for all API classes is
available and can be viewed by eclipse auto completion help or by opening the file
PRC_UE_CUSTOMER/api_doc/index.html.
The project has following structure (the screenshot can look different):
12
Further explanations and background information is found in Appendix A. Some workarounds needed to overcome the
restrictions can be found in the Appendix B and the FAQ.
After the upload the jar file itself is not required anymore and can be deleted.
3 ADMINISTRATION
Every pricing userexit (including standard SAP exits) has to be known to the runtime. Each implementation is loaded
during runtime and controlled by configuration available through the transaction /SAPCND/UEASS. The work is split
into two parts.
1. The implementation (the class) must be registered and a userexit name (a technical name) has to be assigned to
it and
2. The assignment of the defined userexit name to a formula number (like the condition value formula number)
which can be used in the other configuration parts (e.g. pricing procedure).
But first a little overview is presented.
It shows all different types of available userexits for the selected usage. A short comment is provided on each line by
clicking the docu-information-icon. Each type of userexit for the usages PR (pricing), FG (freegoods) and PD (Product
substitution) is described in chapter 4.2.
On the detail screen of each userexit type the scope and the userexit interface is given. The scope is on of A, B or C.
A - number-dependent (like the requirements): The userexit is referenced via a formula number from other
configuration like pricing procedure
B - one unique implementation (like the document init formulas). The userexit with the number 0 will be executed
C - multiple implementations (like pricing init). Each userexit with an attached formula number will be executed
The formula number assignment is explained in chapter 3.3. Also userexit of scope B and C must get a number
assigned.
The userexit interface entry describes the adapter class which a userexit must inherit (details in chapter 4.2).
The registering of a new implementation can be done (cross client customizing) by creating a new entry. These data
should be entered:
Userexit name which is a symbolic or short description of the functionality. The customer namespace starts
with Y or Z.
Name of the implementation class (e.g. your.company.pricing.userexits.SpecialBaseFormula). There is no
restriction on the name but it should be different from com.sap*.
And additional a long description.
If a userexit depends on attributes passed by the calling application, the attributes names (used in the implementation)
must be entered on the sub screen attributes along with a description.
18
In the formula screen the formula number gets assigned to a userexit name. All types of userexits must be have a
formula number assigned. The range reserved for customer formula number can be reviewed with transaction
/SAPCND/UERNG and is depending on the application and usage (e.g. CRM and PR – Pricing). For userexits of scope
B (one unique implementation) the formula number 0 must be used and therefore no customer range is defined. Don’t
change the range entries on your own.
In the sub screen all needed attributes (those used in the userexit implementation) must be mapped with fieldnames of
the communication structure. Please mark the difference between the symbolic (internal) name of an attribute and the
field name which is not visible to the userexit implementation.
After registration and assignment the userexit formula must be uploaded before it can be assigned to any pricing
procedure or other configuration. As the configuration is buffered for one day (default setting) the changes will only
become immediately active with a restart of the VMC or the application server. While testing different configuration in
a test or development system also the function module IPC_DET_CLEAR_CUST_BUFFER can be executed.
20
Line 8: Create a static instance of the UserexitLogger class. As constructor parameter pass the actual class.
Line 13: In case the creation of the output string is more complex, it can be checked if the log level is reached.
Line 15: Use writeLogDebug(String s) or writeLogError(String s) to log the string s into the log.
If this method returns a null object reference, pricing will keep the automatically called base value.
ZSpecialBaseFormula
1 package your.company.pricing.userexits;
2
3 import java.math.BigDecimal;
4
5 import com.sap.spe.pricing.transactiondata.userexit.BaseFormulaAdapter;
6 import com.sap.spe.pricing.transactiondata.userexit.IPricingConditionUserExit;
7 import com.sap.spe.pricing.transactiondata.userexit.IPricingItemUserExit;
8
9 public class ZSpecialBaseFormula extends BaseFormulaAdapter {
10
11 /**
12 * Purpose: This is an example of a condition base value formula. A
13 * condition base value formula can be used to influence the basis the
14 * system uses when computing a pricing value. A condition base formula is
15 * assigned to a step (line) in the pricing procedure.
16 *
17 * This example formula is used to convert the basis to an integer number.
18 * For example, a basis of 300.153 would be converted to 300. This formula
19 * can be used to compute pallet discounts.
20 *
21 * Example: A company sells their products in cases. Each of their materials
22 * has a conversion factor to pallets. When an order is placed by a
23 * customer, the user would like the system to calculate the number of full
24 * pallets for each line and to offer a 5 USD discount per full pallet
25 * ordered. The user sets up a discount condition type in the pricing
26 * procedure and assigns this condition base value formula to it. Within the
27 * condition records for this condition type, the user maintains the 5 USD
28 * per pallet discount rate. If an order line item is placed that contains
29 * 5.5 pallets, the system will adjust the base value to 5 and compute a
30 * discount of 25 USD for the sales line item.
31 *
32 */
33
34 public BigDecimal overwriteConditionBase(IPricingItemUserExit pricingItem,
35 IPricingConditionUserExit pricingCondition) {
36
37 return pricingCondition.getConditionBase()
38 .getValue().setScale(0, BigDecimal.ROUND_FLOOR);
39 }
40 }
11 import com.sap.spe.pricing.transactiondata.userexit.ValueFormulaAdapter;
12
13 public class ZSpecialRoundingValueFormula extends ValueFormulaAdapter {
14
15 private static UserexitLogger userexitlogger =
16 new UserexitLogger(ZSpecialRoundingValueFormula.class);
17
18 public BigDecimal overwriteConditionValue(IPricingItemUserExit item,
19 IPricingConditionUserExit condition) {
20 BigDecimal result;
21
22 ICurrencyValue val = condition.getConditionValue();
23 userexitlogger.writeLogDebug("old cond value: "
24 + val.getValueAsString());
25
26 result = val.getValue().setScale(0, BigDecimal.ROUND_HALF_UP);
27
28 BigDecimal qnt = item.getProductQuantity().getValue();
29 qnt = qnt.divide(new BigDecimal("100"), 2, BigDecimal.ROUND_HALF_UP);
30
31 userexitlogger.writeLogDebug("new cond value: " + result.subtract(qnt));
32
33 return result.subtract(qnt);
34 }
35
36 public BigDecimal overwriteGroupConditionValue(
37 IPricingDocumentUserExit item, IGroupConditionUserExit condition) {
38 // do nothing
39 return null;
40 }
41 }
20 *
21 *
22 * Example: A customer sends back one of the ordered items of an already
23 * paid-for sales order. during the copy process the conditions should be
24 * fixed and their sign should be inverted. Except for the freight costs.
25 *
26 */
27 public void pricingCopy(IPricingDocumentUserExit pricingDocument,
28 IPricingItemUserExit pricingItem,
29 IPricingConditionUserExit pricingCondition,
30 IPricingType pricingType, ICopyType copyType,
31 IQuantityValue sourceSalesQuantity) {
32
33 // set condition control (KSTEU) to 'H'
34 pricingCondition.setConditionControl(
35 PricingCustomizingConstants.Control.VALUE_FIXED_FOR_COST_PRICE);
36
37 // invert condition value
38 pricingCondition
39 .setConditionValue(pricingCondition.getConditionValue()
40 .getValue().multiply(
41 PricingTransactiondataConstants.MINUS_ONE));
42
43 // invert condition base for percentage conditions that it looks
44 // consistent on the condition screen
45 if (PricingCustomizingConstants.CalculationType
46 .isFixedAmountOrPercentage(pricingCondition
47 .getCalculationType())) {
48 pricingCondition.setConditionBaseValue(pricingCondition
49 .getConditionBase().getValue().multiply(
50 PricingTransactiondataConstants.MINUS_ONE));
51 }
52 }
53 }
54
55
56
57
58
19 *
20 * Example: A company defines their prices with scales based on weight. When
21 * a sales order line item is priced, the user would like the system to read
22 * the scale with not just the weight of the current line item, but the
23 * combined weight of all items in the sales document. To accomplish this,
24 * the user defines their price condition types as group conditions and
25 * assigns this group key formula to them in customizing.
26 *
27 */
28 public String setGroupKey(IPricingDocumentUserExit document,
29 IPricingItemUserExit item, IPricingConditionUserExit condition,
30 IGroupConditionUserExit groupCondition) {
31 groupCondition.setConditionTypeName("++++");
32 return "002";
33 }
34 }
5 import com.sap.spe.pricing.transactiondata.userexit.PricingItemInitFormulaAdapter;
6
7 public class ZSpecialItemInitFomula extends PricingItemInitFormulaAdapter {
8
9 public void init(IPricingDocumentUserExit prDocument, IPricingItemUserExit prItem) {
10
11 [your coding]
12
13 }
14 }
5 DEBUGGING
Now the log files are activated and traces depending on the settings.
The log can now be checked with the same transaction sm53. The log viewer is started by clicking the navigation menu
entry Log Display onto Log Administration. The root node in log selection (lower left box) has to be switched on. On
the right side all messages are shown and details in the lower right box. The log entries can also be filtered by different
criteria such as Severity, Log Name (which is the class name or package) or User.
34
6 UPGRADE GUIDE
This chapter is intended to help upgrading IPC 3.0 and IPC 4.0 pricing userexits to the new AP 7.00 architecture. It
refers to all chapters before. As an example, an old IPC 4.0 PricingUserExits.java file is taken and converted.
This is an excerpt of the pricing userexit.
(IPC 4.0) PricingUserExits.java
1 package userexits;
2
3 [..]
4 import java.math.BigDecimal;
5
6 public class PricingUserExits
7 implements IPricingUserExits
8 {
9
10 [..]
11 public boolean checkRequirement(IConditionFindingManagerUserExit item,
12 IStep step, int reqNo)
13 throws SXERuntimeException
14 {
15 switch(reqNo)
16 {
17 case 700: {
18 String zland = null;
19 try {
20 zland = item.getHeaderAttributeValue("ZLAND").getValue();
21 } catch(Exception ex) {
22 zland = new String();
23 }
24 return zland != null && !zland.equals("US") && !zland.equals("CA");
25 }
26 case 701: {
27 String itemCategory = null;
28 boolean priceRelevant = false;
29 try {
30 itemCategory = item.getItemAttributeValue("ZITMCAT").getValue();
31 String priceIndicator = item.getItemAttributeValue(
32 AttributeNames.pricingIndicator).getValue();
33 priceRelevant = priceIndicator != null && priceIndicator.equals("X");
34 }
35 catch(Exception ex) {
36 itemCategory = new String();
37 }
38 return priceRelevant && itemCategory != null &&
39 (itemCategory.equals("TANN") || itemCategory.equals("ZTNN"));
40 }
41 [..]
42 default: {
43 throw new SXERuntimeException("Error in user exit: no condition "+
44 "found for requirement number" + reqNo + ".");
45 }
46 }
47 }
48
49 public BigDecimal overwriteConditionBase(IPricingItemUserExit prItem,
50 ILastPrice lastPrice, IPricingConditionUserExit prCondition, int baseFormNo)
51 throws SXERuntimeException
52 {
53 switch(baseFormNo)
54 {
55 case 710:
56 return prItem.getNetPrice();
57 default:
58 throw new SXERuntimeException("Error in user exit: no coding "+
59 "found for base formula number" + baseFormNo + ".");
60 }
61 }
62
63 public BigDecimal overwriteConditionValue(IPricingItemUserExit prItem,
The above pricing userexits shows a common customer implementation. Implemented are:
700. Requirement: Checks if the header (document) attribute ZLAND is neither US nor CA.
701. Requirement: Checks if the item attribute ZITMCAT is either “ZTAN” or “ZTNN” and the item attribute
PRICING_INDICATOR is “X”.
710. Base value formula: Sets the base and also the condition value to the item’s net price (net price calculated at
the time the base value formula is called).
720. Condition value formula: Sets the condition value to 0 if the header (document) attribute
TAX_DEPART_CTY is not CA.
All required attributes with the corresponding determineRelevantAttributes-methods and all implemented formula
number are shown.
6.1 Preparation
As of AP700 each userexit formula is implemented in an own java class which must be registered in the system as
described in chapter 3. Some preparation steps make it easier to implement and adopt the userexits.
Setup the development environment as described in chapter 2 and read the explanations provided there.
Find a descriptive name for the functionality achieved with each formula.
Formula Name Description
700 Req ZLANDUSCA Checks if ZLAND is neither “US” nor “CA”
Checks if ZITMCAT is “ZTAN” or “ZTNN” and for active pricing
701 Req ZITMCAT
indicator
710 Base ZSETNETP Sets the base of the condition to the item’s net price
720 Value ZTAXDEPCA Sets the value of the condition to 0 if the departure country is not Canada
Collect for each formula the used header (document) and item attributes.
Formula Name H/I Description
700 Req ZLAND Header Country of the last depot
701 Req ZITMCAT Item Item Category
701 Req PRICING_INDICATOR Item Pricing Indicator
720 Value TAX_DEPART_CTY Header Tax Departure Country
Define a java package structure or a simple package name along with the class name for the implementation.
Formula Name Class
700 Req ZLANDUSCA your.company.pricing.req.Zland
701 Req ZITMCAT your.company.pricing.req.Zitmcat
710 Base ZSETNETP your.company.pricing.base.Zsetnetp
720 Value ZTAXDEPCA your.company.pricing.value.Ztaxdepca
6.2 Implementation
Next step is to create each userexit and adapt the coding to implement the adapter’s methods. For each kind of userexit
an adapter must be inherited, more information is provided in chapter 4.
Create new empty classes which inherit from the appropriate adapter class (depending on the type of the
userexit).
Override necessary methods and fill in the coding parts which were formally (and usually) in the switch-case
of the old implementation.
Some adaptations have to been made because parameters names and other references might have changed.
The four resulting userexits may look like these:
your.company.pricing.req.Zland
1 package your.company.pricing.req;
2
3 import com.sap.spe.base.logging.UserexitLogger;
4 import com.sap.spe.condmgnt.customizing.IAccess;
5 import com.sap.spe.condmgnt.customizing.IStep;
6 import com.sap.spe.condmgnt.finding.userexit.IConditionFindingManagerUserExit;
7 import com.sap.spe.condmgnt.finding.userexit.RequirementAdapter;
8
9 public class Zland extends RequirementAdapter {
10
11 private static UserexitLogger uelogger =
12 new UserexitLogger(Zland.class);
13
14 public boolean checkRequirement(IConditionFindingManagerUserExit item,
15 IStep step, IAccess access)
16 {
17 String zland = item.getAttributeValue("ZLAND");
18 if (zland.equals("")) {
19 uelogger.writeLogError("ZLAND attribute missing");
20 return false;
21 } else {
22 return !zland.equals("US") && !zland.equals("CA");
23 }
24 }
25 }
your.company.pricing.req.Zitmcat
1 package your.company.pricing.req;
2
3 import com.sap.spe.base.logging.UserexitLogger;
4 import com.sap.spe.condmgnt.customizing.IAccess;
5 import com.sap.spe.condmgnt.customizing.IStep;
6 import com.sap.spe.condmgnt.finding.userexit.IConditionFindingManagerUserExit;
7 import com.sap.spe.condmgnt.finding.userexit.RequirementAdapter;
8
9 public class Zitmcat extends RequirementAdapter {
10
11 private static UserexitLogger uelogger =
12 new UserexitLogger(Zitmcat.class);
13
14 public boolean checkRequirement(IConditionFindingManagerUserExit item,
15 IStep step, IAccess access)
16 {
17 String itemCategory = item.getAttributeValue("ZITMCAT");
18 String priceIndicator = item.getAttributeValue("PRICING_INDICATOR");
19 boolean priceRelevant = priceIndicator.equals("X");
20
21 if (itemCategory.equals("")) {
22 uelogger.writeLogError("ZITMCAT attribute missing");
23 return false;
24 }
25
26 return priceRelevant &&
27 (itemCategory.equals("TANN") || itemCategory.equals("ZTNN"));
28 }
29 }
your.company.pricing.base.Zsetnetp
1 package your.company.pricing.base;
2
3 import java.math.BigDecimal;
4
5 import com.sap.spe.pricing.transactiondata.userexit.BaseFormulaAdapter;
6 import com.sap.spe.pricing.transactiondata.userexit.IPricingConditionUserExit;
7 import com.sap.spe.pricing.transactiondata.userexit.IPricingItemUserExit;
38
8
9 public class Zsetnetp extends BaseFormulaAdapter {
10
11 public BigDecimal overwriteConditionBase(IPricingItemUserExit pricingItem,
12 IPricingConditionUserExit pricingCondition) {
13 return pricingItem.getNetPrice().getValue();
14 }
15 }
your.company.pricing.value.Ztaxdepca
1 package your.company.pricing.value;
2
3 import java.math.BigDecimal;
4
5 import com.sap.spe.pricing.customizing.PricingCustomizingConstants;
6 import com.sap.spe.pricing.transactiondata.PricingTransactiondataConstants;
7 import com.sap.spe.pricing.transactiondata.userexit.IPricingConditionUserExit;
8 import com.sap.spe.pricing.transactiondata.userexit.IPricingItemUserExit;
9 import com.sap.spe.pricing.transactiondata.userexit.ValueFormulaAdapter;
10
11 public class Ztaxdepca extends ValueFormulaAdapter {
12
13 public BigDecimal overwriteConditionValue(IPricingItemUserExit pricingItem,
14 IPricingConditionUserExit pricingCondition) {
15 String taxdepcty = pricingItem.getAttributeValue("TAX_DEPART_CTY");
16 if (taxdepcty.equals("")) {
17 // INACTIVE_DUE_TO_ERROR = X
18 pricingCondition
19
20 .setInactive(PricingCustomizingConstants.InactiveFlag.INACTIVE_DUE_TO_ERROR);
21 }
22 boolean isCanada = taxdepcty.equals("CA");
23 if (!isCanada)
24 return PricingTransactiondataConstants.ZERO;
25 // keep the automatically calculated Condition Value
26 return null;
27 }
28 }
Compile the java sources and create the jar package per the description in chapter 2 and chapter 2.6.
7.2.1 IConditionFindingManagerUserExit
Earlier Release Changes in AP 7.00 Comments
7.2.2 IPricingDocumentUserExit
Earlier Release Changes in AP 7.00 Comments
7.2.3 IPricingItemUserExit
Earlier Release Changes in AP 7.00 Comments
getCurrencyConversion() isCurrencyConversion()
getDeletionAllowed() isDeletionAllowed()
getHeaderConditionFlag() isHeaderCondition()
getIndicatorStructureCondition() getStructureConditionF
lag()
getInterCompanyFlag() isInterCompanyBilling(
)
getInvoiceListFlag() isInvoiceList()
getItemConditionFlag() isItemCondition()
getPricingUnit() The return type changed from
IDimensionalValue to
IPhysicalValue
getPurpose() The return type changed from
String to
IConditionPurpose
getRoundingDifference_Locale() Removed Alternatively use getRoundingDifference().toString()
getSalesTaxCode() getTaxCode()
getStatistical() isStatistical()
getStepNo() getStepNumber()
getVariantFlag() isVariantCondition()
getVarnumh() getConditionRecordId()
hasBeenChangedManually() isManuallyChanged()
7.2.5 ILastPrice
Earlier Release Changes in AP 7.00 Comments
Was part of package Now is part of package The Interface is renamed to ILastPriceUserExit
com.sap.spe.pricing.transactiondata.applicatio
n com.sap.spe.pricing.tr
ansactiondata.userexit
getVarnumh() getConditionRecordId()
getStepNo() getStepNumber()
7.2.6 IDocumentUserExitAccess
Earlier Release Changes in AP 7.00 Comments
7.2.7 IItemUserExitAccess
Earlier Release Changes in AP 7.00 Comments
addVariantCondition(String, String, String) addVariantCondition(St Convert the String to double before calling the method
ring, double, String)
getHeaderAttributeBinding(IAttributeClass) Removed Alternatively use getAttributeBinding(String)
getHeaderAttributeBinding(String)
getItemAttributeBinding(IAttributeClass)
getItemAttributeBinding(String)
getPricingTimestamp() Removed
getSalesQuantity() Removed Alternatively use
getSalesQuantityUnit() getProductQuantity()
getProductQuantity().getUnit()
isHeaderAttributeRelevantForPricing(String) isAttributeRelevantFor
Pricing(String)
isItemAttributeRelevantForPricing(String)
isHeaderAttributeSetExplicitly(String) isAttributeSetExplicit
ly(String)
isItemAttributeSetExplicitly(String)
removeVariantCondition(IVariantCondition) removeVariantCondition
(String)
7.2.8 ISPCDocumentUserExitAccess
Earlier Release Changes in AP 7.00 Comments
7.2.9 ISPCItemUserExitAccess
Earlier Release Changes in AP 7.00 Comments
7.2.10 IPricingUserExits
Earlier Release Changes in AP 7.00 Comments
overwriteConditionBase(IPricingItemUserExit, Removed Alternatively extend the BaseFormulaAdapter and implement the method
ILastPrice, IPricingConditionUserExit, int) overwriteConditionBase(IPricingItemUserExit,
IPricingConditionUserExit) as described in Ch. 4.2.
Note: to get the ILastPrice use method
IPricingItemUserExit.getUserExitLastPrice().
overwriteConditionValue(IPricingItemUserExit, Removed Alternatively extend the ValueFormulaAdapter and implement the
ILastPrice, IPricingConditionUserExit, int) method overwriteConditionValue(IPricingItemUserExit,
overwriteGroupConditionValue(IPricingDocumentU IPricingConditionUserExit) or/and
serExit, IGroupConditionUserExit, int) overwriteConditionValue(IPricingItemUserExit,
IPricingConditionUserExit) as described in Ch. 4.2.
Note: to get the ILastPrice use method
IPricingItemUserExit.getUserExitLastPrice().
overwriteGroupConditionScaleBase(IPricingDocum Removed Alternatively extend the ScaleBaseFormulaAdapter and implement the
entUserExit, IGroupConditionUserExit, int) method overwriteScaleBase(IPricingItemUserExit,
overwriteScaleBase(IPricingItemUserExit, IPricingConditionUserExit, IGroupConditionUserExit)
ILastPrice, IPricingConditionUserExit, or/and
IGroupConditionUserExit, int) overwriteGroupScaleBase(IPricingDocumentUserExit,
IGroupConditionUserExit) as described in Ch. 4.2.
Note: to get the ILastPrice use method
IPricingItemUserExit.getUserExitLastPrice().
setGroupConditionKey(IPricingDocumentUserExit, Removed Alternatively extend the GroupKeyFormulaAdapter and implement the
IPricingItemUserExit, setGroupKey(IPricingDocumentUserExit,
IPricingConditionUserExit, IPricingItemUserExit, IPricingConditionUserExit,
IGroupConditionUserExit, int) IGroupConditionUserExit) as described in Ch. 4.2.
pricingCopy(IPricingDocumentUserExit, Removed Alternatively extend the PricingCopyFormulaAdapter and implement
IPricingItemUserExit, the method pricingCopy(IPricingDocumentUserExit,
IPricingConditionUserExit, IPricingType, IPricingItemUserExit, IPricingConditionUserExit,
ICopyType, IQuantityValue, int) IPricingType, ICopyType, IQuantityValue) as described in Ch.
4.2.
7.2.11 IDocumentUserExit
Earlier Release Changes in AP 7.00 Comments
7.2.12 IItemUserExit
Earlier Release Changes in AP 7.00 Comments
7.2.13 ISPCItemUserExit
Earlier Release Changes in AP 7.00 Comments
As the user exit instance is kept per Java VM (current pricing implementation), all instance members are shared and
therefore are accessible by each request running on the same Java VM. Any use of instance members, which are not
used within the same single method run, can lead to problems. That’s setting the member in one call and using the
member in another. In later Support Packages of the pricing engine the use of members in any user exit class (also
helper classes) will be causing issues, because the instance will be kept in shared memory and will only have read-only
accessibility.
sleep() / wait()
synchronize
The use of the above mentioned functionalities could lead to a break up of the transaction integrity or lock a Java VM.
This rule above is the main reason to avoid the use of DB, File, Socket, JCo functionality. Each of those functionalities
creates native references to the Operating System. A Java VM referencing native code can not be shared and the request
running might be mapped to another Java VM.
C FAQ
C.1 Implementation
Use the parameter key as a description of the information you want to store. obj is the stored object, containing your
data, which is shared and can be accessed later across the same item.
The same technique can be used to store data, unique within the entire document, by using the interface
IPricingDocumentUserExit. This can be accessed (if not passed in as an parameter) by calling
IPricingItemUserExit.getUserExitDocument().
Cautions: 1. All objects passed must be shareable. 2. Your coding should not depend on the sequence in which the user
exits are called. The pricing procedure is normally processed from top to the bottom i.e. a formula should only depend
on data calculated or set in the preceding lines of the pricing procedure. The sequence of processing of the pricing items
is not guaranteed.
IPricingItemUserExit.setStatusMessage(StatusEvent event)
As StatusEvent you should use one of its subclasses ErrorStatusEvent, InfoStatusEvent or WarningStatusEvent
(all from package com.sap.spe.base.util.event. Here is the signature of the method to use:
The boolean popUp should be false. True is not supported, source should be the local object this, messageArea is the
ABAP message class.
C.2 Troubleshooting