Component | Suuport Pachage |
---|---|
BBPCRM | SAPKU70204 |
SAP_ABA | SAPKA73105 |
SAP_BASIS | SAPKB73105 |
WEBCUIF | SAPK-73105INWEBCUIF |
We want to copy only one specific manual condition if some info of target document meets a custom criteria.
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
I already have created the data element which has a FLAG domain.
We save the changes.
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.
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.
We will copy the standard one (01000) and replace the copy routine number for our own one (601)
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.
I'm not an expert on Java so I'm sure this algorithm can be easily improved :smile:
package z***.pricing.userexits;
import com.sap.spe.conversion.IQuantityValue;
import com.sap.spe.pricing.customizing.ICopyType;
import com.sap.spe.pricing.customizing.IPricingType;
import com.sap.spe.pricing.customizing.PricingCustomizingConstants;
import com.sap.spe.pricing.transactiondata.PricingTransactiondataConstants;
import com.sap.spe.pricing.transactiondata.userexit.IPricingConditionUserExit;
import com.sap.spe.pricing.transactiondata.userexit.IPricingDocumentUserExit;
import com.sap.spe.pricing.transactiondata.userexit.IPricingItemUserExit;
import com.sap.spe.pricing.transactiondata.userexit.PricingCopyFormulaAdapter;
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***
pricingCondition.setInactive(PricingCustomizingConstants.InactiveFlag.INVISIBLE);
}
}
else
{
// We only copy manual conditions of type Z****
pricingCondition.setInactive(PricingCustomizingConstants.InactiveFlag.INVISIBLE);
}
}
}
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:
Cheers!
Luis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |