Beruflich Dokumente
Kultur Dokumente
2005 SAP AG
Applies To:
The IPC (Internet Pricing and Configurator). The IPC is versioned to match CRM. The current version is 4.0 SP9.
Summary
This document is an accelerator for developers using the IPC in a CRM Enterprise or Internet Sales project. It may also be useful for SRM or other IPC scenarios (e.g. IS-Auto).
By: Dom Padden Company: SAP Australia Date: June 2004, updated for SDN in July 2005
Table of Contents
Applies To:........................................................................................................................................2 Summary ..........................................................................................................................................2 Table of Contents .............................................................................................................................2 Introduction.......................................................................................................................................4 What is the IPC?...........................................................................................................................4 Why do we have the IPC? ............................................................................................................4 Does the IPC integrate with R/3? .................................................................................................4 Technical overview and quick facts..................................................................................................5 Installation.....................................................................................................................................5 Service packs and patches...........................................................................................................5 Web Applications ..........................................................................................................................5 Downloading R/3 pricing configuration.............................................................................................6 Z fields in condition tables ............................................................................................................6 Creating new pricing routines...........................................................................................................7 Local software installation.............................................................................................................7 Eclipse IDE................................................................................................................................7 Local IPC...................................................................................................................................7
2005 SAP AG
Project setup .................................................................................................................................7 Coding...........................................................................................................................................8 Example of getConditionValueFormulaNumbers ....................................................................8 Example of determineRelevantAttributesForValueFormula ....................................................9 Example of overwriteConditionValue ....................................................................................11 Texts ...........................................................................................................................................13 Installation...................................................................................................................................13 Use of local IPC for testing .........................................................................................................13 Upgrade ......................................................................................................................................14 Pricing Analysis and Product Configuration ...................................................................................15 Using the IPC in your own applications..........................................................................................16 Author Bio.......................................................................................................................................16
2005 SAP AG
Introduction
This document is an accelerator for CRM consultants using the IPC in a CRM Enterprise or Internet Sales project. It may also be useful for SRM or other IPC scenarios (e.g. IS-Auto). It is written at a point in time and may not be kept up to date. What is the IPC? The IPC is the Internet Pricing and Configurator. It is a Java-based client-server package. It provides R/3 pricing and R/3 product configuration outside of an R/3 system. It is made up of several components: The Sales Pricing Engine, or SPE (relates to R/3 Condition Technique) The Sales Configuration Engine, or SCE (relates to R/3 Variant Configuration) The Product Modeling Environment, or PME (relates to R/3 Variant Configuration master data) In addition, it has Java Server Page (JSP) front ends and a Java UI. The JSP front ends are integrated into the different CRM scenarios (telesales, internet sales, mobile sales, etc). You can deploy them normally on your J2EE stack. Why do we have the IPC? Short answer: to enable consistent pricing and configuration through all sales channels, without needing an online R/3 system, whilst still maintaining pricing and configuration data in one place. Long answer: Go to Quick Link /cwg , or http://www.configuration-workgroup.com . Does the IPC integrate with R/3? The IPC is typically used in a CRM scenario, using the CRM database (for Telesales and Internet Sales). It uses its own database for other scenarios. The IPC can integrate with an R/3 system using its own database (>4.0B). In this case, you use the IPC Dataloader to take data from the R/3 system via qRFC. The IPC converts the data to the CRM data model. IS-Auto Vehicle Management System uses it this way. The Product Modeling Environment can be used in mySAP ERP 2004 on a project basis. It is used as a frontend to variant configuration master data maintenance. Object dependencies are much easier to write. Further integration with R/3 is planned. Get used to it!
2005 SAP AG
Service packs and patches You must install the same service pack level (and patch) as the CRM system. You can now upgrade the service pack level rather than reinstalling. OSS note code corrections are installed via the IPC patch. Patch files are available from the OS Independent section. Click on info to see which notes are included. Read note 486061. Sometimes a note involves ABAP corrections AND Java corrections.
Web Applications You need to install IPC Web Applications on your J2EE Engine in order to use IPC features like Pricing Analysis or Configuration. You should have a J2EE Engine available as part of your CRM installation (3.0 and up). You need to be familiar with the Extended Configuration Management (XCM) of SAP web applications in order to set up some of the web applications. Follow the install guide carefully. This is simply a replacement for the old web.xml approach that allows for multiple configurations of one deployment, and separates SAP and customer settings.
2005 SAP AG
2005 SAP AG
Project setup You need to set up a new Java project in Eclipse to manage your development. This project should include the IPC code libraries so that your code will compile correctly, and so that you can use the advanced features of the IDE. 1. Start Eclipse. 2. Start the Create new Project wizard ( File > New > Project ). 3. Choose Java project and click on Next. 4. Give the project a name (eg IPC) and click on Next. 5. Click on the Libraries tab. 6. Click on Add External JARs. 7. Add all the JAR files from the \ipc\lib\ folder in your local IPC installation: "IPCClient.jar" "IPCPatch.jar" "SAP_IPC.jar" "thirdParty.jar" 8. Click Finish. 2005 SAP AG The SAP Developer Network: http://sdn.sap.com 7
The IPC routines will be contained in a package called userexits. You need to create this. 1. Start the Create new package wizard ( File > New > Package ). 2. Enter the name userexits. 3. Click Finish. The code template for your routines is supplied in the IPC installation. Import this file into your package. 1. Start the Import wizard ( File > Import ) or right click on the new package. 2. Select File system and click on Next. 3. Browse to the <local IPC>\ipc\lib\userexits folder and click on OK. 4. Select the PricingUserExits.java file in the right window and click on Finish. You can now expand out the userexits package to see the PricingUserExits class source code and the methods contained in it. Eclipse tip: You can navigate to each method in the source code by double clicking on its name in the Package Explorer on the left rather than scrolling and searching. Coding There are many coding scenarios which may occur. In this document I provide some basic tips that relate to creating a pricing routine (similar to using menu VOFM in R/3). It is assumed that you are familiar with pricing logic and routines (requirements, formulas) in general. The provided source code for the standard SAP routines is a valuable reference. You can access this in your local IPC installation at \ipc\lib\userexits\CRMStandardExits.java.txt . It provides many examples of how you can code your own routines. You will normally have to enter code in three different methods for each routine that you want to add: 1. The relevant getNumbers method which the pricing engine needs so that it knows which routines to call (for example, getConditionValueFormulaNumbers). 2. The relevant determineRelevantAttributes method which the pricing engine needs so that it know which custom attributes are required from the document (for example, determineRelevantAttributesForValueFormula ). 3. The actual routine method that performs the pricing logic (for example, overwriteConditionValue, ). These methods are described in the following three sections, using an example where we are creating a couple of new condition value formulas. Example of getConditionValueFormulaNumbers Simply change the code to return the numbers of your new routines. New routines should not be numbered below 600, as this is in the SAP reserved namespace.
2005 SAP AG
For example, if you have two new routines 601 and 701, then change the line as follows:
Change this: return new int[0]; To this: return new int[] { 601, 701 }; Example of determineRelevantAttributesForValueFormula The IPC requires that required attributes are registered here (attributes are not automatically provided for performance reasons). The code required is relatively simple depending on whether we are pricing at header or item level, and the actual routine number, we provide a list of relevant attribute names. New attributes need to be added to the field catalog via the IMG and populated via a BAdi. The code within the method could look something like this: // String of relevant attribute names to return String[] relevantAttributes = new String[0];
// Header? if (headerAttributes) { // KOMK fields switch(valueFormulaNo) { case 601: // Nothing needed at header level break; case 701: // Nothing needed at header level break; }
2005 SAP AG
10
Note that the delivered SAP attributes do not always have the same name as the field in the field catalog. It is best to choose them using the IDE inline help. To do this, first include the relevant library where they are declared by placing the following line at the top of your code with the other includes.
import com.sap.spe.condmgnt.customizing.application.CustomizingConstants;
Then you can declare attributes using inline help rather than literals:
There are many more imports that you can use in order to reuse delivered IPC code. Example of overwriteConditionValue The actual routine logic is of course dependent on the routine number, so there is a switch:
switch (valueFormNo) {
Below this we put our code. In this hypothetical example, for routine 601, if the transaction type is ZDOM, then this condition value is 100.
2005 SAP AG
11
// If a ZDOM order, then value = 100 if (ordType.equals("ZDOM")) { return PricingConstants.HUNDRED; } else { return PricingConstants.ZERO; }
} // If we couldnt get the attribute, exit gracefully catch (UnsuppliedAttributeException e) { return PricingConstants.ZERO; }
Of course, any logic could go here. It is probably better to send attributes here via the communication structure rather than performing a JCo call to a backend system (CRM, R/3, etc) to get the information you require. This is documented in the IMG under Customer Relationship Management User-Defined Fields. Basic Functions Pricing
2005 SAP AG
12
Texts In order that others may know what your routines do, you should maintain a text for them so that a text is displayed in trace files and from the drop-down in pricing Customizing. Edit the file \ipc\lib\text\userexits_en.properties . Example (additions in red):
#File created by SLIM generator #Fri Aug 01 17:06:42 CEST 2003 CRMPR_CNDVAL_601=Price by Color CRMPR_CNDVAL_701=Price by Size CRMPR_CNDBAS_16=Net Value + Cash Discount CRMPR_CNDBAS_15=Check Exclusion Ind. CRMPR_CNDBAS_14=Set Exclusion Ind. Installation Once you have finished your coding, you compile your Java class by saving the project, which performs an automatic build and syntax check. When your code is ready for testing, you need to move it onto the IPC server. Installation consists of:
Stopping the IPC dispatcher and server Replacing the existing \ipc\lib\userexits\PricingUserExits.class and \ipc\lib\userexits\PricingUserExits.java files with your new ones (taken from your \eclipse\workspace\<project>\<package> directory). You may wish to back up the old files. Replacing the existing \ipc\lib\text\userexits_en.properties file with your new one. You may wish to back up the old file. Starting the IPC dispatcher and server. In a landscape with multiple IPC installations (eg one for Telesales and one for Internet sales) you must of course install them on each one. Use of local IPC for testing If you want to do some serious development, it is probably best to use your local IPC installation for testing. This saves on moving your files onto the real IPC every time you want to unit test, and then restarting it. You
2005 SAP AG
13
can simply drop your files in the right place locally, and restart your own IPC. Once you are happy, you can get the files installed on the real IPC. Follow the IPC installation instructions, creating separate RFC destinations for your local installation. To force the use of your IPC so that you can test it, set your user parameter IPC_RFC_DESTINATION to the RFC destination name of your local dispatcher (eg IPC_RFC_DISPATCHER_DEV ). Upgrade When applying a new support pack to the IPC, you will need to take the userexit.java file from the new support pack and insert your previous custom code and then recompile. The linked SAP libraries will have changed. You cannot use the previous compiled userexits as it may (for example) cause IPC connection problems that are difficult to diagnose. Please see OSS note 670000.
2005 SAP AG
14
DESTINATION
IPC_CFG_UI
CALLER
NOTE
For config
IPC_PRICING_UI
For analysis
2. To activate pricing analysis, you have to set the user parameter PRC_TRACE to value X in the CRM system. This is also accessible in the IMG under Customer Relationship Management Configuration Engine Define URLs. Basic Functions
In earlier versions of CRM, the analysis was dependent on creating a dummy RFC destination which held the URL parameters. The pricing analysis works as follows: Setting your parameter ID as above triggers your IPC pricing session to create a trace file. Calling the pricing trace generates an URL pointing to the web application, with parameters in the URL representing your IPC session. The web application retrieves the pricing trace for your session from the IPC and formats it nicely as an interactive web page. Set a breakpoint at function module COM_SPE_SHOW_PRICING_TRACE if you are having problems.
2005 SAP AG
15
Author Bio
Dom Padden is a Solution Architect at SAP Australia. He has been working with SAP software since 1994. Since 2001 he has focused on SAPs CRM products.
2005 SAP AG
16