cancel
Showing results for 
Search instead for 
Did you mean: 

How to add pricing condition via PriceCalculatorCRMIPC ?

Former Member
0 Kudos

Hi colleagues,

I have an interesting requirement for which I have to add manual pricing condition for an item under specific circumstances.
The pricing condition (for example "ZZPR") was defined in the pricing procedure and VMC was reset.
I know we can add  condition for an item in the sales order from tx "CRMD_ORDER". What I want to do is to add the condition in the web shop (while browsing the catalog or viewing the shopping basket).
Since we use custom version of PriceCalculatorCRMIPC to send additional properties for the pricing procedure I decided to try adding the pricing condition through it too.

I see that IPCItem.getPricingConditions() has a method for adding pricing condition.
I tried this in exits customerExitBeforeIpcItemsCreate and customerExitAfterIpcItemsCreate, but none of them changed the pricing conditions:

items[i].getPricingConditions().addPricingCondition("ZZPR", "1234", "EUR", "1", "ST", "1234", ",", ".");

Does anybody knows how to do this? Maybe I am not using the correct modification place.

Best regards,

Marian

Accepted Solutions (1)

Accepted Solutions (1)

daniel_ruiz2
Active Contributor
0 Kudos

Hi Marian,

You usually assign a PrincingProcedure in SPRO which is used in the e-Commerce App. In the e-Commerce (and I believe it's the same or very much the same on ISA and WCEM) you setup which Procedure to use for the shop.

Have you tried adding your custom Formula Number in there?

Case you need extra fields, you can also extend the Field Control and push the stuff you need implementing a BADI - but I'm not too sure if this would fit your requirement since you did a different approach (and I believe you must have your reasons for the path you chose)

Also remember that most things is IPC/VMC are cached on first run (to improve performance) so this could also be the cause why your custom code does not seem to work. There is a function module you can execute to refresh the cache, maybe something else you may try after your addPricingCondition call.

Cheers,

D.

Former Member
0 Kudos

Hi Daniel,

Everything in SPRO is set up correctly.

The requirements can have two implementation approaches. The first one is what I have explained in the question. This is more simple in terms of customizing in ERP and CRM for the pricing procedure. We just create the manual condition that holds the price and we add it to the procedure when needed.

The other option is to create condition with pricing table. The unpleasant thing there is that we need to introduce custom property for pricing determination. This goes through functional customizing and implementation of BADIs in ERP and CRM to make the custom property available for pricing. However, the rest is obvious - we pass the value of this property in customerExitBeforeIpcItemsCreate and this should work.

I'll check the cache that you mention, but I doubt about that. I see that IPC is creating new IPCItem after each item creation. I would expect the old items to be sort of cached items, but the new item is missing the new condition also. This is despite the fact that I see that the new condition is in the array "conditionsToBeAdded" after executing items[i].getPricingConditions().addPricingCondition("ZZPR", "1234", "EUR", "1", "ST", "1234", ",", ".");.

If I do not find a way to make the 1st approach working soon I'll have to go for the second option. Anyway, I am quite curios about how to implement the 1st.

Former Member
0 Kudos

I found the answer.

After adding conditions to the conditions set of the IPCItem a commit() has to be called.

This is working at the user exit for getPrices, otherwise NullPointerException is thrown due to the fact that _conditions collection is empty before that.

Answers (0)