Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

IPC - Technical Consulting Tips

SDN Community Contribution


(This is not an official SAP document.)

Disclaimer & Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces
and therefore is not supported by SAP. Changes made based on this information are not supported and can
be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods
suggested in this document, and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of
this technical article or code sample, including any liability resulting from incompatibility between the content
within this document and the materials and services offered by SAP. You agree that you will not hold, or seek
to hold, SAP responsible or liable with respect to the content of this document.

2005 SAP AG

The SAP Developer Network: http://sdn.sap.com

IPC - Technical Consulting Tips

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

The SAP Developer Network: http://sdn.sap.com

IPC - Technical Consulting Tips

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

The SAP Developer Network: http://sdn.sap.com

IPC - Technical Consulting Tips

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

The SAP Developer Network: http://sdn.sap.com

IPC - Technical Consulting Tips

Technical overview and quick facts


Installation
You can install it on any of several major operating systems (Linux, AIX, W2K, HP-UX, Solaris).
It is a relatively small footprint installation you can install it on your notebook for development and
education purposes (but it can use a lot of resources depending on how the calling applications use
it)
You can scale it separately to the other components, i.e. have lots of IPC servers if you are doing lots
of pricing and configuration.
You should get the installation file from the Patches section of the SAP Service Marketplace so that
you always have the latest version.

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

The SAP Developer Network: http://sdn.sap.com

IPC - Technical Consulting Tips

Downloading R/3 pricing configuration


Most projects will reuse R/3 pricing configuration, as orders will pass through R/3 for fulfillment.
The CRM middleware R/3 Adapter has functions for downloading R/3 pricing configuration and converting to
the CRM data model.
Read the documentation carefully. Not all R/3 functions are supported by the CRM system.
The documentation can be found at http://help.sap.com . Navigate to the CRM help. Follow the path:
Application Services Application Engines Pricing Conditions Data Exchange for Conditions
Data Transfer from the R/3 system (Download) Transferring Customizing Data.
Once the download and generation of customizing data is complete, you can download condition records
(master data). For custom condition tables, you will have to create your own download objects using the
delivered ones as a template.
Z fields in condition tables
Often condition tables were created in the R/3 system with new Z fields. These will not be generated in the
CRM system until a relevant data element is added to the CRM field catalog and a mapping entry made. Then
the customizing download and generation can take place successfully.
The basic steps are:
Create the data element in CRM to match the R/3 one
Add the data element to the CRM field catalog (transaction CTFC_CRM) and generate it. This adds
the field to the appropriate structures.
Create a mapping entry by maintaining table CND_MAPM_CNV_FLM (use SM30 and view
V_CND_MAP_CNVFLD ). If necessary, use a BAdi to translate the field values (eg from R/3 partner
number to CRM GUID). The table CND_MAPC_CNV_FLM shows the SAP function modules that you
can use.
Run the customizing download and generation and make sure the table is generated OK.
To fill the field in the communication structure at run time, you will need to implement the BAdi
CRM_COND_COM_BADI .
Note that if you fill all attributes in the communication structure, and keep your routines as simple as possible,
then the process of mapping R/3 pricing to CRM pricing is much easier. Routines that read the database are
very hard to rewrite in Java (see next section).
Read the documentation carefully:
Application Services Application Engines Pricing Conditions Data Exchange for Conditions
Data Transfer from the R/3 system (Download) Transferring Master Data.

2005 SAP AG

The SAP Developer Network: http://sdn.sap.com

IPC - Technical Consulting Tips

Creating new pricing routines


To create new pricing routines you will need to develop them in Java, even if you have already built them in
ABAP on the R/3 system. This can be very easy (less than one day with no experience for simple
mathematical routines) to very hard (if you have pages and pages of legacy ABAP to rewrite).
This section will help you set up a development environment to do so. Although only one of several possible
options, it is probably the easiest and cheapest.
It is assumed that you have access to a developer workstation.
Local software installation
Eclipse IDE
I recommend the Eclipse integrated development environment. It is available (for free) at
http://www.eclipse.org/ . The instructions in this section refer to Eclipse.
Download it and install it.
Local IPC
Download the same Support Pack level of the IPC to match your CRM system and install it. You should
choose the version for your local operating system.
You do not need to connect it to the CRM system - it is needed for compiling your new code as certain IPC
libraries must be included.
You can however connect and run it locally to test your own code (see later section).
It also provides extra developer documentation start from \ipc\doc\spe\UserExits.html and
navigate from there. Technical documentation (javadoc) is also available.

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

IPC - Technical Consulting Tips

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

The SAP Developer Network: http://sdn.sap.com

IPC - Technical Consulting Tips

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;
}

}
// Item
2005 SAP AG

The SAP Developer Network: http://sdn.sap.com

IPC - Technical Consulting Tips

else {
// KOMP fields
switch(valueFormulaNo) {

case 601:
relevantAttributes = new String[] { "ZZCOLOR" };
break;

case 701:
relevantAttributes = new String[] { "ZZSIZE" };
break;
}
}

// Return the determined string of attributes


return relevantAttributes;

2005 SAP AG

The SAP Developer Network: http://sdn.sap.com

10

IPC - Technical Consulting Tips

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.

// Routine 601: Test Routine


case 601:

2005 SAP AG

The SAP Developer Network: http://sdn.sap.com

11

IPC - Technical Consulting Tips

// Exception trap for this attribute


try {

// Get the value


String ordType =
prItem.getItemAttributeValue(
CustomizingConstants.AttributeNames.bus_proc_type).getValue().
trim();

// 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 Basic Functions Pricing
User-Defined Fields.

2005 SAP AG

The SAP Developer Network: http://sdn.sap.com

12

IPC - Technical Consulting Tips

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

The SAP Developer Network: http://sdn.sap.com

13

IPC - Technical Consulting Tips

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

The SAP Developer Network: http://sdn.sap.com

14

IPC - Technical Consulting Tips

Pricing Analysis and Product Configuration


To perform a pricing analysis, or to perform interactive product configuration, you need to ensure that the IPC
web applications are installed.
The IPC web applications are J2EE applications that talk to the IPC and provide an HTML user interface. The
calling application launches the web page (or sub-frame) with the IPC session ID in the URL, and the
application calls the IPC, retrieves the session information, and presents it to the user.
The installation guide IPC 4.0 Web Applications Installation Guide explains this. You would normally simply
install the web application on the J2EE Engine that is part of the Basis layer.
Once the web application is installed, configure the pricing analysis as per the IPC Server Installation guide.
For example, for CRM 4.0 SP04 you do the following:
1. Maintain table COMM_IPC_URL (cross-client) with the following entries:

DESTINATION

CALLER

URL

NOTE

IPC_CFG_UI

http://<J2EE_server>:<port>/ipc/ipc/command.do

For config

IPC_PRICING_UI

http://<J2EE_server>:<port>/pricing

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 Basic Functions
Configuration Engine Define URLs.
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

The SAP Developer Network: http://sdn.sap.com

15

IPC - Technical Consulting Tips

Using the IPC in your own applications


It is relatively easy to use the IPC in your own CRM applications for example, if you need to provide a list of
products with prices for a customer. The APIs are already built and are easy to use.
The most important thing to remember is that you must manage your IPC sessions opening and,
importantly, closing them. If you do not close them, the IPC must manage them and this can mean that the
IPC struggles under many orphaned sessions. If your ABAP program ends in any way, this does not
automatically close your IPC session!
There is a delivered ABAP program IPC_TEST_ORDER that shows how to use the IPC for pricing and
configuration. Other programs exist in package COM_IPC_TOOLS_ORDER.
Do not be daunted by using IPC pricing in your custom ABAP it is probably simpler than using R/3 pricing.

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

The SAP Developer Network: http://sdn.sap.com

16

You might also like