Skip to Content
Author's profile photo Former Member

SAP IPC Development Help

I tried to bring all relevant information about IPC under one blog.

Introduction


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:

1) The Sales Pricing Engine, or SPE (relates to R/3 Condition Technique)

2) The Sales Configuration Engine, or SCE (relates to R/3 Variant Configuration)

3) 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.

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.

Functions of IPC

The IPC consists of a set of engines which execute pricing (in a broad sense) and product

configuration functionality in a variety of scenarios and SAP applications (CRM, SRM, ERP).

The most important components of the Internet Pricing and Configurator are:


1) Sales Pricing Engine (SPE) is the single source of pricing for all sales and procurement channels.

The pricing is based on product, business partner or hierarchy. Pricing conditions can be applied at

header, item, or detail level. It supports discounts, surcharges, rebates, volume based pricing, tax

determination, price overrides – on percentage or on value basis. The SPE also used for integrated

pricing for procurement in SAP SRM.


2) Sales Configuration Engine (SCE) is the single source of intuitive product and service configuration

information for all sales channels (E-Commerce, Enterprise Sales, Field Sales, Interaction Center)

across sales reps, business partners and customers. It uses an intuitive and adaptable Web user

interface based on JSP.


3)  Free Goods Engine: Used to determine free goods of the same or another product (for example,

“Buy two, get three”) in all scenarios. Free Goods are also based on condition techniques.


4) Listings allow to determine whether a certain products are explicitly allowed or excluded for a specific customer in e.g. a sales order. The determination of listings is based on condition technique and part of the IPC.


5)  Free Goods Engine: Used to determine free goods of the same or another product (for example, “Buy two, get three”) in all scenarios. Free Goods are also based on condition technique.


6)  Listings and Exclusions allow to determine whether a certain products are explicitly allowed or excluded for a specific customer in e.g. a sales order. The determination of listings is based: -> Based on condition technique and part of the IPC.



IPC Architectural Sketch

As of the 2005 edition, the IPC engines (SCE, SPE, etc.) run within the so-called Virtual Machine Container (VMC). It is part of the SAP Web Application Server in Netweaver 2004s and allows the SAP Kernel to execute ABAP as well as Java programs. Some relevant technical information for administrators regarding the VMC can be found in note 853711.


The VMC executes java programs within a strong and robust enterprise scale infrastructure and offers:

1)  SAP kernel technology (work processes, transport system)

2)  Fast in-process Java-ABAP communication

3)  Strong user isolation, robustness


However, this does not mean that Java is “translated” to ABAP. The IPC itself remains a Java

program; however, it enjoys the same infrastructure as an ABAP program. The IPC engines are installed and patched with the AP Foundation layer (see SAP Note 844817).


The VMC is not a J2EE Container and does not contain an EJB container. Hence, the IPC UI used for product configuration or pricing analysis runs on the J2EE Engine like in previous releases.


Note: Execution of byte-code in the Java VM is accelerated by something that is known as a Just-In- Time (JIT) compiler. Currently, the JIT is not available for all platforms.

How to Configuring SAP CRM 7.0 for download and use of Variant Configuration Products

http://wiki.sdn.sap.com/wiki/display/CRM/How+to+Configuring+SAP+CRM+7.0+for+download+and+use+of+Variant+Configuration+Products

Pricing Configuration Guide with Used Cases

http://scn.sap.com/docs/DOC-36366

16 Fields in Pricing Procedure and Their Description

SAP Community Network Wiki – ERP Operations – 16 Fields in Pricing Procedure and Their Description

Steps for creating pricing userexits for beginners.

http://scn.sap.com/community/crm/web-channel/blog/2012/09/26/steps-for-developing-ipc-pricing-userexit-developement-for-beginners

How UserExists get Triggered

How Pricing Is Triggered

When a customer creates an order on the SAP CRM Ecommerce B2B or B2C applications.

The following steps are undertaken for pricing to be triggered.

Step 1.

The customer inputs the values of the product he wishes to buy.

Step 2.

Depending on the Sales Area(Sales Org, Distribution Channel and Division) , Partner Determination Procedure and Document  Pricing Procedure the Pricing Procedure on CRM system is triggered.(These are basically part of Base Customization of SAP CRM  ).

Step3.

Within pricing procedure we have condition types , these are the various kinds of calculations required to find the total price of the item

Step 4.

Within condition types we have access sequence,the system reads the first condition type of the pricing  procedure and determines the assigned access sequence.

This step, together with the following , is repeated for each condition type on the pricing procedure.

            The system reads the access sequence with the condition tables. The sequence of the condition tables forms the search strategy for determining the individual condition records.The system reads the first condition type of the pricing procedure and determines the assigned access sequence. If the system does not find a valid condition record for the first condition table, it carries on and searches for a condition record for the next condition table.

Step 5.

       Once the system has found a valid condition record for a condition table, it makes the result available to pricing in the form of prices and discounts.


Pricing User Exits Manual

Go to SAP Note 809820 for pricing manual and download the project and the document.

Debugging IPC User Exit

5.1 Set VMC in Debug Mode


The logical application server is usually hosted on different servers and load balanced via the message server. To debug

the VMC the user has to know on which host his work process run. In the SAPGUI menu System -> Status… the Server

name (first part) is displayed. On the next page (3rd button) also the corresponding IP address is given. Switching

between hosts of one server can be done via transaction sm51.

Run transaction sm52 to display the available VMCs. This window will later show the servers running virtual machines

and also the debug state and port of each one.

A VMC work process switches into debug mode when a program flow from ABAP to Java (RFC function module) is

passed and ABAP was in debug mode (with /h). To help debugging each call of such a pricing RFC module a

conditional breakpoint triggered. To active the breakpoint the user parameter PRC_RFC has to be set to X (transaction

su3).

While running the transaction (e.g. order processing) each call to pricing will hold and with a step-into debugging into

the RFC module (F5) a VMC debug port will be activated. This VMC will stay attached as long the ABAP transaction

runs.

5.1 Set VMC in Debug Mode

The logical application server is usually hosted on different servers and load balanced via the message server. To debug

the VMC the user has to know on which host his work process run. In the SAPGUI menu System -> Status… the Server

name (first part) is displayed. On the next page (3rd button) also the corresponding IP address is given. Switching

between hosts of one server can be done via transaction sm51.

Run transaction sm52 to display the available VMCs. This window will later show the servers running virtual machines

and also the debug state and port of each one.

A VMC work process switches into debug mode when a program flow from ABAP to Java (RFC function module) is

passed and ABAP was in debug mode (with /h). To help debugging each call of such a pricing RFC module a

conditional breakpoint triggered. To active the breakpoint the user parameter PRC_RFC has to be set to X (transaction

su3).

While running the transaction (e.g. order processing) each call to pricing will hold and with a step-into debugging into

the RFC module (F5) a VMC debug port will be activated. This VMC will stay attached as long the ABAP transaction

runs.

5.2 Attach Eclipse Java Debugger

After a VMC work process has an open debug port, which can be viewed with transaction sm52, the eclipse debugger

can be attached to it.

Because attaching the debugger to the VMC will run directly the code, first interesting java breakpoint may be set.

Attaching eclipse works then as follow:

1. Open menu Run->Debug…

2. Create a new Remote Java Application Configuration

3. Enter as host the server where the VMC work process is running on

4. Enter the debug port as the one VMC work process debug port shown in transaction sm52

5. Click on Debug

The debugging view will normally popup automatically and a successful attachment will show all working threads of

that VMC work process.

Attach Eclipse Java Debugger

After a VMC work process has an open debug port, which can be viewed with transaction sm52, the eclipse debugger

can be attached to it.

Because attaching the debugger to the VMC will run directly the code, first interesting java breakpoint may be set.

Attaching eclipse works then as follow:

1. Open menu Run->Debug…

2. Create a new Remote Java Application Configuration

3. Enter as host the server where the VMC work process is running on

4. Enter the debug port as the one VMC work process debug port shown in transaction sm52

5. Click on Debug

The debugging view will normally popup automatically and a successful attachment will show all working threads of

that VMC work process.


User Exit Example 1

http://scn.sap.com/people/dheeram.kallem3/blog/2010/07/07/pricing-user-exits-in-crm

Transferring data ABAP to UserExit in IPC

we found another way without JCo to transfer the differences from ABAP to JAVA.

If you use the COND_COM_BADI then do the following in method item_name_value:

METHOD if_ex_crm_cond_com_badi~item_name_value.

DATA: ls_inv TYPE prct_attr_name_value,

lv_seq TYPE prct_attr_sequence_number,

lv_pricing type char1.

FIELD-SYMBOLS: <ls_inv> TYPE prct_attr_name_value.

get parameter id ‘YY_PRICING_EXIT’ field lv_pricing.

check: lv_pricing = ‘X’.

READ TABLE ct_item_name_value ASSIGNING <ls_inv>

WITH KEY attr_name = ‘CAMPAIGN_GUID’.

IF sy-subrc 0.

lv_seq = 0.

ELSE.

lv_seq = 1.

ENDIF.

* CRM_PRIDOC_COMM_BADI

ls_inv-attr_name = ‘CAMPAIGN_GUID’.

ls_inv-seq_number = lv_seq.

ls_inv-attr_value = ‘11111111111111111111111111111111’.

INSERT ls_inv INTO TABLE ct_item_name_value.

lv_seq = lv_seq + 1.

ls_inv-attr_name = ‘CAMPAIGN_GUID’.

ls_inv-seq_number = lv_seq.

ls_inv-attr_value = ‘22222222222222222222222222222222’.

INSERT ls_inv INTO TABLE ct_item_name_value.

lv_seq = lv_seq + 1.

ls_inv-attr_name = ‘CAMPAIGN_GUID’.

ls_inv-seq_number = lv_seq.

ls_inv-attr_value = ‘33333333333333333333333333333333’.

INSERT ls_inv INTO TABLE ct_item_name_value.

ENDMETHOD.

Then in JAVA you can read the multi-value attribute with the following coding:

String[] test = pricingItem.getAttributeValues(“CAMPAIGN_GUID”);

userexitLogger.writeLogDebug(“Length: ” + test.length);

for (int i = 0; i < test.length; i++){

userexitLogger.writeLogDebug(“CAMPAIGN_GUID: ” + test);

}

BADI CRM_COND_COM_BADI  Information.


The BADI CRM_COND_COM_BADI is used for filling the pricing communication structure.

If you have added any field at header level of the field catelog that will available in the changing parameter of the method HEADER_COMMUNICATION_STRUCTURE.

If you have added any field at item level of the field catelog that will available in the changing parameter of the method ITEM_COMMUNICATION_STRUCTURE.

Additional fields added at catalog can be filled with the values using this BADI.

Tables and Explanaition

KOMP – is the table in the R/3 which holds information about Pricing              Communication Item


KOMV – is the table in the R/3 which holds information about Pricing Communications-Condition Record


VBAK—- is the table in the Sales Document: Header Data


KSCHL – is Condition Type


KWERT – is Condition value


kzwi3 – is Subtotal 3 from pricing procedure for condition

Characteristics :

     CABN                    Characteristics ( o.a. batch/vendor)    

     CABNT                    Characteristics description

     CAWN                    Characteristics  ( o.a. material)

     CAWNT               Characteristics description

     AUSP                    Characteristic Values

Class types and objects :

     TCLAO                                    Several class types for object

     TCLA                    Class types ( vb. lfa1 => v10 en 010)

     TCLAT                    Class type text

     TCLT                    Classifiable objects

     TCLC                    Classification status

Links :

     INOB                    Link between Internal Number and Object

     KLAH                     Class header data 

     KSSK                    Allocation Table: Object (vb.matnr) to Class

     KSML                    Characteristics for a class (internal number)

User Exit Example 1


1) Requirement 620:

sy-subrc = 4.
if komp-matkl = ‘ZV87’ or
   komp-matkl = ‘ZV96’.
  clear sysubrc.
endif.

Explanation:

Just material group ZV87 and ZV96 will be valid for this requirement.

This is User Exit of type Requirement(REQ).

The following is the java code for the above ABAP requirment.

package com.sybase.pricing.userexits;

import com.sap.spe.condmgnt.customizing.IAccess;

import com.sap.spe.condmgnt.customizing.IStep;

import com.sap.spe.condmgnt.finding.userexit.IConditionFindingManagerUserExit;

import com.sap.spe.condmgnt.finding.userexit.RequirementAdapter;

import com.sap.spe.base.logging.UserexitLogger;

/**

*

*

* To change the template for this generated type comment go to

* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments

*/

public class Z620 extends RequirementAdapter {

private static UserexitLogger userexitlogger = new UserexitLogger(Z620.class);

public boolean checkRequirement(IConditionFindingManagerUserExit item, IStep step, IAccess access)

{

if (item.getAttributeValue(“HIER_CAT_ID”).equals(“ZV87”) || item.getAttributeValue(“HIER_CAT_ID”).equals(“ZV96”))

{

return true;

}

return false;

}

}

Pricing validations using requirement routine

http://wiki.sdn.sap.com/wiki/display/CRM/Pricing+validations+using+requirement+routine

IPC Facts

http://scn.sap.com/people/tapan.jain/blog/2009/06/25/ipc–facts-you-always-wanted-to-know–fact-1

About Variant Functions

You will write the Java functions based on the custom VC functions in the ECC system. You will closely work with ECC Variant configuration team and get the details of the custom functions that are developed in the designtime VC model for supporting their runtime VC.


                    This runtime environment is not available in CRM, only the design time information is downloaded as “Knowledge Base”.


                    SAP provides the Java code for all the standard “VC” functions in ECC. In ECC see function group “CUPR” for the standard VC functions.


                   Variant function is the other face of the IPC and should not be confused with any of the features of the Pricing in IPC.


                    The SCE(Configuration Engine) deals with with the configurable product. The design time configuration of configurable products are downloaded as Knowledgebase in CRM. Since the design time (KB) is available to IPC, during runtime the reference to pfunctions and functions are known to IPC and IPC be design will look for the instances for the classes of these variant functions.


                      In ECC, you use transactions CU65,CU66,CU67 to maintain the interface definition of a variant function.


                       Here, Variant functions are implemented as ABAP functions with a generic interface which contains QUERY and MATCH arguments with structure CVOV_2. The interface definition of a variant function(import and export parameters) is part of the knowledge base generated in ECC.



Function:  Function provides read access to the knowledge base to derive the export parameters.


PFunction: Compared to Function, PFunction offers extended functions it provides read and write access to configuration and dynamic database(DDB). For this reason, you cannot use PFunctions in declarative dependencies(constraints and actions).


  

At the start of the configuration process, the Configuration Engine automatically searches the knowledge base for java classes of variant functions that have the same name as the variant functions created in ERP. If no variant function is found, the Configuration engine executes the function sce_noop_fn instead, with the output true.

                    

Definition

You can use variant conditions to influence the price of a configurable material depending on the characteristic values assigned.

Use

You can use variant conditions in Sales and Distribution and Purchasing to define surcharges and discounts for the basic price.

Structure

Variant conditions consist of a variant key and an amount that is identified by the variant key.

Pfunctions Implementation

Go to SAP note 870201 for pfunctions implementation manual.

Variant Conditions in Purchasing

Use

In Purchasing, you can use variant conditions to define surcharges and discounts for configurable materials that are procured externally. The surcharges and discounts depend on the values assigned to the characteristics in the sales order or (for material variants) the material master.

Example

If you order a bicycle frame in the color ‘Silver metallic’, the vendor adds a surcharge of $20. You create a variant condition called SILVER. When you select a frame in silver metallic, the variant condition is added to the price automatically.

Prerequisites

You have created a characteristic that refers to table MMCOM, field VKOND. The characteristic is assigned to the variant class for the configurable material.

Note

An object characteristic with a reference to the table MMCOM field VKOND is multi-value because several variant conditions can be entered.

In Customizing for Purchasing, you have defined a new access sequence (0014) and 2 new condition types (VA00, which is quantity-dependent, and VA01, which is a percentage). These condition types are in schema RM0000. You have set the Variant condition indicator.

Process Flow

1.     You create a purchasing info record for the externally-procured, configurable material, in which you maintain the variant conditions.

2.     You create a procedure where you enter the reference from the characteristic to the structure MMCOM and the variant key.

Example

CHAR_VARCOND = ‘SILVER’ if PAINT = ‘Silvermetallic’

–     You have created a characteristic, CHAR_VARCOND, that refers to table MMCOM, field VKOND.

–     The variant condition SILVER with the amount $ 20 is maintained in the purchasing info record.

3.     You allocate the procedures to either the characteristic values that trigger the variant conditions or the configuration profile, depending on the condition defined in the procedures.

4.     You configure the material:

–     In the material master, as a material variant

–     In the sales order

5.     In material requirements planning (MRP), a purchase requisition is created for the material. The purchase requisition contains the configuration of the material.

6.     Once released, the purchase requisition is converted to a purchase order. The net price for the material is displayed in the item overview of the purchase order. When you display the conditions for an item, you see the value of the variant condition that is included in the net price.

Maintaining Variant Conditions in the Info Record Locate the document in its SAP Library structure

Prerequisites

The material for which the info record is to be created or changed is configurable.

Procedure

  1. Choose Master data ® Info record ® Create or Change.
    • Enter the vendor, the configurable material, the purchasing organization, and the plant.

  2. Press ENTER .
  3. Make the necessary specifications (see Structure link Creating an Info Record for a Material With a Master Record).
  4. Choose Extras ® Variant conditions.
    • Enter a variant key.

  5. Select the variant key and press ENTER .
  6. A box containing the condition types defined for the variant key appears.

    • Choose the desired condition type and specify the period during which the discounts and surcharges are to apply.
    • Enter the amount and save.

Result

The next time the material is needed in a sales order (i.e. the configurable material is either reconfigured in such a way that a characteristic value is reached or it is already so configured), a requisition is generated for it and converted into a purchase order, the system applies the variant conditions when determining the purchase order price.

Product configuration info

http://scn.sap.com/people/santosh.v/blog/2007/03/05/configuration–part-1


Pricing user exits in CRM

http://scn.sap.com/people/dheeram.kallem3/blog/2010/07/07/pricing-user-exits-in-crm





Assigned Tags

      27 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Samir Kulkarni
      Samir Kulkarni

      A very good compilation of most of that is needed to learn and perfom IPC related task..thanks Sarath!!

      Author's profile photo Former Member
      Former Member

      Hi Sarath,

      thanks a lot for this wonderful article...I need a clarification on adding or changing pricing conditions in SAP CRM. i'm adding a new condition type through ORDER_SAVE bapi method PREPARE....The new condition should be added in the header level. I need your help on fixing this as i tried a lot in doing that but missing some key stuffs. Please help me out on this.

      http://scn.sap.com/message/13952930#13952930

      Below is my code in the PREPARE method of BADI: ORDER_SAVE.

      method IF_EX_ORDER_SAVE~PREPARE.

         TYPES: BEGIN OF ST_ITEM,

                GUID TYPE CRMT_OBJECT_GUID,

               END OF ST_ITEM.

         DATA: IT_ITEM TYPE TABLE OF ST_ITEM,

               WA_ITEM TYPE ST_ITEM.

         DATALV_GUID TYPE CRMT_OBJECT_GUID,

                LV_PROCESS_TYPE TYPE CRMT_PROCESS_TYPE_DB,

                LV_OBJECT_ID TYPE CRMT_OBJECT_ID_DB,

                LV_ZAMP TYPE I.

         data: IT_PRI_DOC   type CRMT_PRIDOC_COMT,

                ls_cond_h   type CRMT_PRIDOC_COM,

                IT_COND_ADD   type PRCT_COND_EXTERNAL_INPUT_T,

                WA_COND_ADD LIKE LINE OF IT_COND_ADD,

                IT_COND_CHANGE TYPE PRCT_COND_EXTERNAL_CHANGE_T,

                WA_COND_CHANGE TYPE LINE OF PRCT_COND_EXTERNAL_CHANGE_T,

                lt_input_fields type CRMT_INPUT_FIELD_TAB,

                ls_input_fields type CRMT_INPUT_FIELD,

                IT_HEAD TYPE CRMT_ORDERADM_H_COMT,

                WA_HEAD TYPE LINE OF CRMT_ORDERADM_H_COMT,

                IT_ADM_I TYPE CRMT_ORDERADM_I_COMT,

                WA_ADM_I TYPE LINE OF CRMT_ORDERADM_I_COMT,

                IT_FIELD_NAMES TYPE crmt_input_field_names_tab,

                WA_FIELD_NAMES TYPE crmt_input_field_names.

         DATA : dest TYPE string,

                success TYPE CHAR1.

         SELECT SINGLE GUID OBJECT_ID PROCESS_TYPE

                FROM   CRMD_ORDERADM_H

                INTO   (LV_GUID,LV_OBJECT_ID,LV_PROCESS_TYPE )

                WHERE  GUID EQ IV_GUID.

          SELECT GUID

                FROM CRMD_ORDERADM_I

                INTO TABLE IT_ITEM

                WHERE HEADER EQ IV_GUID.

            LOOP AT IT_ITEM INTO WA_ITEM.

             WA_ADM_I-GUID = WA_ITEM-GUID.

             APPEND WA_ADM_I TO IT_ADM_I.

             CLEAR: WA_ADM_I.

            ENDLOOP.

         IF LV_PROCESS_TYPE EQ 'ZSQT' OR

            LV_PROCESS_TYPE EQ 'ZQIN' OR

            LV_PROCESS_TYPE EQ 'ZQIC'.

           DATA: IT_HEADER_GUID TYPE CRMT_OBJECT_GUID_TAB,

                 IT_PRIDOC TYPE CRMT_PRIC_COND_T,

                 "IT_PRIDOC TYPE CRMT_PRIDOC_COMT,

                 WA_PRIDOC LIKE LINE OF IT_PRIDOC,

                 IT_PRIC_COND TYPE PRCT_COND_DU_TAB,

                 WA_PRIC_COND LIKE LINE OF IT_PRIC_COND,

                 WA_ZAMP LIKE LINE OF IT_PRIC_COND,

                 LV_ZAMP_GUID TYPE CRMT_OBJECT_GUID,

                 LV_COUNT TYPE I,

                 LV_KBETR TYPE KBETR.

           CLEAR: IT_HEADER_GUID, IT_PRIDOC[], LV_COUNT, LV_KBETR,

                  LV_ZAMP_GUID, WA_ZAMP.

           APPEND LV_GUID TO IT_HEADER_GUID.

      *Read the Pricing Document Conditions FROM CRM_ORDER_READ

      *USING EXPORT PARAMETER ET_PRIDOC

           CALL FUNCTION 'CRM_ORDER_READ'

             EXPORTING

               IT_HEADER_GUID       = IT_HEADER_GUID

             IMPORTING

               ET_PRIDOC            = IT_PRIDOC

             EXCEPTIONS

               DOCUMENT_NOT_FOUND   = 1

               ERROR_OCCURRED       = 2

               DOCUMENT_LOCKED      = 3

               NO_CHANGE_AUTHORITY  = 4

               NO_DISPLAY_AUTHORITY = 5

               NO_CHANGE_ALLOWED    = 6

               OTHERS               = 7.

           IF SY-SUBRC <> 0.

      * Implement suitable error handling here

           ENDIF.

           LOOP AT IT_PRIDOC INTO WA_PRIDOC.

             READ TABLE WA_PRIDOC-PRIC_COND INTO WA_PRIC_COND

                        WITH KEY KSCHL = 'ZAMP'.

             IF SY-SUBRC EQ 0.

               LV_ZAMP = 1.

               WA_ZAMP = WA_PRIC_COND.

               LV_ZAMP_GUID = WA_PRIDOC-GUID.

             ENDIF.

             LOOP AT WA_PRIDOC-PRIC_COND INTO WA_PRIC_COND

                     WHERE KSCHL = 'YAMP' AND

                           KBETR IS NOT INITIAL.

               LV_KBETR = LV_KBETR + WA_PRIC_COND-KBETR.

               LV_COUNT = LV_COUNT + 1.

             ENDLOOP.

           ENDLOOP.

           IF LV_COUNT GT 0.

      *  *Calculating the Average Mark up 'ZAMP' From YAMP item conditions

             LV_KBETR = LV_KBETR / LV_COUNT.

           ENDIF.

      *Populate new condition rate

           CLEAR: ls_cond_h, WA_COND_ADD, LS_COND_H-COND_ADD,

                  IT_PRI_DOC[].

         LOOP AT IT_ITEM INTO WA_ITEM.

             IF LV_ZAMP NE 1.

             ls_cond_h-ref_guid = WA_ITEM-GUID.

             ls_cond_h-ref_kind = 'B'.

             WA_COND_ADD-kschl = 'ZAMP'.

             WA_COND_ADD-KBETR = LV_KBETR.

             INSERT WA_COND_ADD INTO TABLE  LS_COND_H-COND_ADD.

             INSERT LS_COND_H INTO TABLE  IT_PRI_DOC.

             WA_FIELD_NAMES-FIELDNAME = 'KSCHL'.

             WA_FIELD_NAMES-CHANGEABLE = 'X'.

             INSERT WA_FIELD_NAMES INTO TABLE IT_FIELD_NAMES.

             CLEAR: WA_FIELD_NAMES.

             WA_FIELD_NAMES-FIELDNAME = 'KBETR'.

             WA_FIELD_NAMES-CHANGEABLE = 'X'.

             INSERT WA_FIELD_NAMES INTO TABLE IT_FIELD_NAMES.

             LS_INPUT_FIELDS-REF_GUID = WA_ITEM-GUID.

             LS_INPUT_FIELDS-REF_HANDLE = '0000000001'.

             LS_INPUT_FIELDS-REF_KIND = 'A'.

             "LS_INPUT_FIELDS-OBJECTNAME = 'PRICING'.

             LS_INPUT_FIELDS-OBJECTNAME = 'PRIDOC'.

             "LS_INPUT_FIELDS-OBJECTNAME = 'CONDITION_H'.

             LS_INPUT_FIELDS-FIELD_NAMES = IT_FIELD_NAMES.

             INSERT LS_INPUT_FIELDS INTO TABLE LT_INPUT_FIELDS.

           ELSEIF LV_ZAMP EQ 1.

             ls_cond_h-ref_guid = WA_ITEM-GUID.

             ls_cond_h-ref_kind = 'B'.

             WA_COND_CHANGE-STUNR = WA_ZAMP-STUNR.

             WA_COND_CHANGE-ZAEHK = WA_ZAMP-ZAEHK.

             WA_COND_CHANGE-KBETR = LV_KBETR.

             INSERT WA_COND_CHANGE INTO TABLE  LS_COND_H-COND_CHANGE.

             INSERT LS_COND_H INTO TABLE  IT_PRI_DOC.

             WA_FIELD_NAMES-FIELDNAME = 'KSCHL'.

             WA_FIELD_NAMES-CHANGEABLE = 'X'.

             INSERT WA_FIELD_NAMES INTO TABLE IT_FIELD_NAMES.

             CLEAR: WA_FIELD_NAMES.

             WA_FIELD_NAMES-FIELDNAME = 'KBETR'.

             WA_FIELD_NAMES-CHANGEABLE = 'X'.

             INSERT WA_FIELD_NAMES INTO TABLE IT_FIELD_NAMES.

             LS_INPUT_FIELDS-REF_GUID = WA_ITEM-GUID.

             LS_INPUT_FIELDS-REF_HANDLE = '0000000002'.

             LS_INPUT_FIELDS-REF_KIND = 'B'.

             "LS_INPUT_FIELDS-OBJECTNAME = 'PRICING'.

             LS_INPUT_FIELDS-OBJECTNAME = 'PRIDOC'.

             "LS_INPUT_FIELDS-OBJECTNAME = 'CONDITION_H'.

             LS_INPUT_FIELDS-FIELD_NAMES = IT_FIELD_NAMES.

             INSERT LS_INPUT_FIELDS INTO TABLE LT_INPUT_FIELDS.

           ENDIF.

           REFRESH LT_INPUT_FIELDS.

           CLEAR: LS_INPUT_FIELDS, LS_INPUT_FIELDS-FIELD_NAMES,

                  WA_FIELD_NAMES, IT_FIELD_NAMES[].

            CLEAR: WA_ADM_I, IT_ADM_I.

      *    CLEAR: WA_HEAD, IT_HEAD[].

      *    WA_HEAD-GUID = LV_GUID.

      *    WA_HEAD-OBJECT_ID = LV_OBJECT_ID.

      *    WA_HEAD-PROCESS_TYPE = LV_PROCESS_TYPE.

      *

      *    APPEND WA_HEAD TO IT_HEAD.

      *  Note that FIELD_NAMES in table LT_INPUT_FIELDS SHOULD be initial.

           CALL FUNCTION 'CRM_ORDER_MAINTAIN'

             EXPORTING

               IT_PRIDOC         = IT_PRI_DOC

      *    IMPORTING

      *      ET_EXCEPTION      = GT_EXCEPTION

             CHANGING

               "CT_ORDERADM_H     = IT_HEAD

               CT_ORDERADM_I     = IT_ADM_I

               CT_INPUT_FIELDS   = LT_INPUT_FIELDS

      *      CV_LOG_HANDLE     = LV_LOGHNDL

             EXCEPTIONS

               ERROR_OCCURRED    = 1

               DOCUMENT_LOCKED   = 2

               NO_CHANGE_ALLOWED = 3

               NO_AUTHORITY      = 4

               OTHERS            = 5.

          ENDLOOP.

         ENDIF.

        endmethod.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Arun,

      I'm not much in to ABAP side of IPC. Sorry I cant help you in this.

      Author's profile photo Former Member
      Former Member

      Hi Sarath,

      Thanks for your blog. It really helps. Is there anyway we can create a DB table in IPC and store values in the database in Java userexits?

      Thanks,

      Kiran

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Kiran,

      SAP doesn't recommend to access the DB tables from IPC pricing user exits because it effects the performance and you will not get support from SAP after that.

      But for your knowledge you can do like below.

      import com.sap.sxe.db.db;

      db db1 = com.sap.sxe.db.db.getDb();

      String client = com.sap.vmc.runtime.RuntimeInformation.getInstance().getUserInfo().getClient();;

      //some declarations and initialization of data

        sys_query_pair[] queryPair1 = new sys_query_pair[4];

      // Read the dist. channel from table SMOTVKOV

        queryPair1[0] = new sys_query_pair("MANDT", client);

        queryPair1[1] = new sys_query_pair("VKORG", sales_org);

        queryPair1[2] = new sys_query_pair("VTWEG", dist_chan);

        queryPair1[3] = new sys_query_pair("DELETED", "0");

      //this is the field we want to read from table

        projection1 = new String[]{"VTWKU"};

        //this is the database access to the table

        res resultSet = db1.db_read_table("SMOTVKOV",

         queryPair1,

         projection1);

        //here we check whether database access was successful

        if (!res.db_empty_results_p(resultSet)) {

        dist_chan = resultSet.db_get_row_element_string(0);

        } else {

        uelogger.writeLogError("Couldn't find distribution channel in table SMOTVKOV");

        // return;

        }

      Author's profile photo Kiran Mamidipalli
      Kiran Mamidipalli

      Hi Sarath,

      Is there a transport mechanism for KB's in standard i.e. move KB's from DEV -> QA -> PROD. i know that if ECC is used as backend we shall replicate from ECC to CRM via Middleware. But in case of stand alone and requirements for moving the same KB across the landscape, is there any best practise recommendation?

      Regards,

      Kiran

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Kiran,

      I'm not Sure Kiran, let me check and comeback to you.

      Thanks.

      Sarath.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Kiran,

      Generally KB is generated in the Production system directly instead of tranports.

      Author's profile photo Kiran Mamidipalli
      Kiran Mamidipalli

      Thank you Sarath. May be XIF adapter is an option for customer, am checking.

      Author's profile photo Sachin Ghavghave
      Sachin Ghavghave

      Hi Sarath ery good blog. Thanks .

      Just a very basic question is that in which case / scenario /  business IPC can be implemented ? and why IPC ? What is the major benefit of IPC ?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Sachin,


      Hope below comments helps you.


      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 like CRM System.

      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.

      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.

      Author's profile photo Hamendra Kumar
      Hamendra Kumar

      Hi Sachin,

      IPC is recommended when you have your CRM implementation with shop which is used by external customers.

      Thanks,

      Hamendra

      Author's profile photo Baris Yalcin
      Baris Yalcin

      Hi Sarath,

      if you want you can also add here the new IPC stateless remote Pricing API for price determination and price calculation in SAP CRM.
      This API allows you to call the IPC Pricing Engine of SAP CRM from an external application (e.g. 3rd party web shop). The complete documentation of this new Stateless Pricing API, including a full source code example, is available in the SAP note 1849765. Maybe this information is helpful for you.

      Best regards,
      Baris Yalcin

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks Baris Yasin, I wil take my time to update the blog.

      Author's profile photo Vasu Gorli
      Vasu Gorli

      Hi Sarath,

      Very nice blog for getting knowledge in IPC.

      Can you pls confirm from which version of crm is available that IPC is inbuilt, CRM6.0 / CRM7.0

      Thanks,

      Vasu

      Author's profile photo Hamendra Kumar
      Hamendra Kumar

      Hi Vasu,

      It is available in CRM5.0, 6.0 & 7.0 where web Channel is implemented.

      Thanks,

      Hamendra

      Author's profile photo Vasu Gorli
      Vasu Gorli

      ThanQ Hamendra Kumar 🙂

      Thanks,

      Vasu

      Author's profile photo HEMANT BAVISKAR
      HEMANT BAVISKAR

      Hello Sarath,

      I am still confused between CRM_COND_COM_BADI and IPC, below are my queries....

      1) In IPC there are some restriction which are not supported in CRM like we cannot called item.setAttribute("key", "value")). so can we right this logic of ECC pricing routine in BADI CRM_COND_COM_BADI?

      2) In "How Pricing is Trigger" can you explain where the BADI comes in place in your flowchart. what i am trying to understand is if we code the ECC pricing routine in BADI and not in IPC will it first work????

      Regards,

      Jan

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      CRM_COND_COM_BADI is called all times and it will help you to pass data to your java routines as key/value pairs. If you want some logic that need to pull from ECC then develop in the BADI and pass the information to right routine and that routine can trigger the pricing for you in CRM.

      Author's profile photo Rainer Haupt
      Rainer Haupt

      Hi Sarath,

      Many thanks for this excellent compendium. There is one thing I do not get.

      Assumping we have in JAVA the statement:

      pricingItem.get.AttributeValue ("Pricing_Indicator"). I guesses to find this field also in the communication structure  for the item CS_ACS_I_COM in BADI  CRM_COND_COM_BADI. Same for your example with Hier_CAT_ID which is also not available there. Might it be possible for you to explain to me what is wrong with my assumptions.

      Many thanks in advance.

      Best regards

      Rainer

      Author's profile photo Former Member
      Former Member

      Hi Sarath,

      Below URL you shared is only available for authorized people and not for everyone. Please suggest how to access this.

      Pricing Configuration Guide with Used Cases

      http://scn.sap.com/docs/DOC-36366


      Regards,

      Hemant

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      HI Hemant,

      I dont have access too for this document. will check and let you know if I find something on that document.

      Thanks.

      Sarath.

      Author's profile photo Karlheinz Lehmann
      Karlheinz Lehmann

      Hi Sarath,

      I think this is a very good blog to get some insights into IPC.

      Question: do you plan to enhance this blog with some information about the Sales Solution Configuration (SSC) which is nowadays also called "SAP CPQ for SSC"?

      Regards, Karlheinz

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Karlheinz,

      Unfortunately I didn't got a chance to work on "SAP CPQ for SSC". I can't update the blog with that.

      Thanks.

      Sarath.

      Author's profile photo Sun 197895
      Sun 197895

      Hi Sarath,

      I am SAP EP Java developer and my employer wants me to work on IPC Java pricing routines as well. I am very much interested. So recently I have contacted some functional guys and understoos Condition pricing technique on a high level...I mean the config tables, Pricing Procedure-->Condition Types-->Access Sequense --> Condition Tables

      Now for me to write new java routines, I am finding it difficult. I understand choosing the correct user exit is the most important part for writing a routine. For a beginner like me, the SAP Note provided by you doesn't provide a detailed info on when to go for which user exit.... Is there any doc which can help me understand basically about the different user exits and also detailed explanation of API ... thanks.

      And also, how difficult would it be for me to start working on IPC Java routines assuming I am a good java developer and how useful it would be for a EP developer career wise. Thanks

      Author's profile photo Baris Yalcin
      Baris Yalcin

      Hi Sun 197895,

      the IPC User Exit guide (SAP note 809820) contains in general everything you need to know when writing new IPC java routines like condtion value formulas. Further the SCN contains many helpful postings/discussions regarding IPC User Exits.

      What exactly is missing from your point of view?

      Best regards,
      Baris Yalcin

      Author's profile photo Former Member
      Former Member

      Hi Sarath,

      Wonderful blog! Have a question - is it possible to call the IPC configuration screen(no pricing) from a third party NONSAP CPQ system? Its the same screen when the Knowledge base simulation happens. Scenario is IPC connected to ERP 6.0 directly

      Thanks,

      PG