CRM and CX Blogs by Members
Find insights on SAP customer relationship management and customer experience products in blog posts from community members. Post your own perspective today!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor
ComponentSuuport Pachage


The Scenario

We want to copy only one specific manual condition if some info of target document meets a custom criteria.

The design

We will include a new field in the pricing field catalog, which will be informed in the communication BADI, where we will have our criteria.

Why this approach? the "correct" thing would be to include all the criteria in the field catalog and use all the data to determine what to do inside the java routine. Why I'm not doing this approach? because the transfer structures for pricing have the same limitation as a normal structure, if you start to add fields like crazy you will run out of fields, some field may be necessary for the routines or to define pricing tables, so is very important to be selective. Plus I prefer to do as much as I can the custom logic on the ABAP side and looks like I'm not the only one who follows that path :wink: you can check the cool blog from manuel.seeger Entering Java Userexits 01: Generic Requirements

Step 1 Add a transfer field into the pricing field catalog:

I already have created the data element which has a FLAG domain.

We save the changes.

Step 2 Create the Java User exit

I will skip the detail on this part as you already have all the information on the note Note 809820, the only thing to point is we will extend the standard class PricingCopyFormulaAdapter in order to use the pricing copy exit (pricingCopy), as I said further details in note  809820.

Step 3 Maintenance of User Exit Assignments

We will launch the transaction /SAPCND/UEASS with usage PR (our scenario) and select the CPY User Exit Type

On implementations, we define our new implementation and point it to the IPC directory

And we also define the custom attribute which will tell us what do do inside the Java routine

In the formula area (Application CRM, Usage PR in our scenario) we will assign Our user exit to a formula ID

We are using 601 as is our customer number range, for more info check the transaction /SAPCND/UERNG  and the note  809820.

Also, we need to map the Attribute of the implementation with the pricing transfer structure field

Caution!!! Here comes the weird part, the attribute won't be visible inside the copy routine unless you define a REQ or VAL void routine which has the parameter definition which you need it in the copy routine, so we need to create that and assign the routine in some condition in each pricing procedure which the copy control should apply, as it will be a dummy routine you can assign it anywhere, don't ask me why works like this, only SAP IPC engineers knows that :wink:

Don't forget to delete the VM cache (SM53) after the copy control changes.

Step 4 Set up de copy control for the document items

We will copy the standard one (01000) and replace the copy routine number for our own one (601)

Step 5 The ABAP Code

I will skip the ABAP side, as is the easiest one, we will implement or modify the implementation of the BADI CRM_COND_COM_BADI to put our custom logic and inform the field on the method ITEM_COMMUNICATION_STRUCTURE (changing parameter CS_ACS_I_COM) depending on our criteria.

Step 6 Java Code

I'm not an expert on Java so I'm sure this algorithm can be easily improved :smile:

package z***.pricing.userexits;
public class ZCopyOnlyZ**** extends PricingCopyFormulaAdapter {
public void pricingCopy(IPricingDocumentUserExit pricingDocument,
  IPricingItemUserExit pricingItem,
  IPricingConditionUserExit pricingCondition,
  IPricingType pricingType, ICopyType copyType,
  IQuantityValue sourceSalesQuantity) {
  String CopyZ = pricingItem.getAttributeValue("ZZ***_COPY_Z*****");
  if (pricingCondition.getConditionTypeName().equals("Z****")){
       if (!CopyZ.equals("X"))
//        Don't Copy condition Z***
//      We only copy manual conditions of type Z****

Before finish the blog I would like to thank baris.yalcin for his support and I hope you find this blog useful, looking forward for your feedback :smile: