Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with exit userexit_new_pricing_vbkd

denis_nakamoto
Participant
0 Kudos
509

Hello people!

I have a problem with this exit. When I change the incoterms in VA01/VA02, the pricing must be recalculated. I'm using this exit, I'm setting the variable NEW_PRICING to 'B', but it doesn't work...

Anyone help me!!!

Thanks in advance,

Denis Nakamoto

1 ACCEPTED SOLUTION

Former Member
0 Kudos
221

Put

NEW_PRICING to C, it should help.

Example

if vbak-auart eq 'ZTA0'.

new_pricing = 'C'.

endif.

      • Reward if helpful ***

Message was edited by: Manish Patil

19 REPLIES 19

Former Member
0 Kudos
222

Put

NEW_PRICING to C, it should help.

Example

if vbak-auart eq 'ZTA0'.

new_pricing = 'C'.

endif.

      • Reward if helpful ***

Message was edited by: Manish Patil

ferry_lianto
Active Contributor
0 Kudos
221

Hi Denis,

Please try to set NEW_PRICING = CHARG.

Regards,

Ferry Lianto

denis_nakamoto
Participant
0 Kudos
221

Thanks for the answer, but it doesn't work both the solutions.

Thanks a lot!

Denis Nakamoto

former_member534411
Participant
0 Kudos
221

can you post code.

Thanks

Suresh

denis_nakamoto
Participant
0 Kudos
221

if vbkd-inco1 ne *vbkd-inco1.

new_pricing = charb.

endif.

Only this

See ya

0 Kudos
221

have you tried to create watchpoint for your NEW_PRICING after you assigned it in this exit to see if it's changed by some other code (assuming the exit is triggered and the pricing is set to B) ?

0 Kudos
221

hello Siarhei!

The process pass many times in this exit. One time, execute correctly the code, but in other times, set the new_pricing = ''.

I tried to put new_pricing = 'B' with no validation, but it doesn't work!

Thanks!

Denis Nakamoto

0 Kudos
221

well, this code it hit many times.

the question is - are you changing incoterms on header level or on item level, do you have VBKD records on item level or not.

It may trigger pricing on header level if your VBKD-POSNR = 0 when your code is triggered and you set new_pricing to 'B'.

So, I would just check in debug if your new pricing is actually triggered on item or on header level ... just click single step several times after your code set new_pricing to 'B'.

One more question is - what exactly does nto work for you if you say that new_pricing is set to 'B' at least once when you change incoterms ?

0 Kudos
221

I'm changing the incoterms on header level.

On the first execution, VBKD-INCO1 = *VBKD-INCO1.

The other execution, the VBKD-INCO1 <> *VBKD-INCO1.

So, the code works correctly.

But the other times, the VBKD-INCO1 = *VBKD-INCO1!

And don't update the variable new_pricing.

I will try to look on item level.

- One more question is - what exactly does nto work for you if you say that new_pricing is set to 'B' at least once when you change incoterms ?

I've tried the this, but it doesn't work too!

Thanks!!!

0 Kudos
221

what exactly does not work ? I mean what result you are trying to achieve by setting new_pricing = 'B' ?

Set breakpoint to FM PRICING and PRICING_COMPLETE, are they triggered with your pricing type = 'B' ?

OR set breakpoint to any of the pricing requirement routines if they are assigned to your condition types and check preisfindungsart there.

I believe your pricing is triggered, but perhaps you just do not get the resutls you are expecting.

BTW, do you get the expected result when you call new pricing in the transaction manually after you updated incoterms ?

Former Member
0 Kudos
221

Hi,

take an example of one sales order.

change inco1 or inco2 what ever is requirement and go to condition tab of the item hit update and select B or C based on you requirement.

B only carry out new pricing

C and also manuval pricing.

If it is updating prices your code also should work otherwise put break-point on your code try to see value of inco1 or inco2 fields and new_pricing. As final step see the pricing data in MV45AFZZ exit ( mean before save order ).

***********Poorna**********

0 Kudos
221

Yeah...I understand.

If I understand the functionally of this exit, the pricing must be calculated if I set the variable new_pricing to 'B' or 'C'.

Should I have to complement this exit in another point?

Siarhei,

I did that you asked me to do, but this exit, runs many times before I can enter in conditions screen. but do the same thing. First, go with 'B', but the other times, go ''.

Thanks!

0 Kudos
221

Hi

No! U should insert your validation in that exit and set the flag to redeterminate the price.

Max

0 Kudos
221

Hi Max,

Yeah, I know, but it doesn't work!

see ya!

0 Kudos
221

Hi

Past your code

Max

0 Kudos
221

if vbkd-inco1 ne *vbkd-inco1.

new_pricing = charb.

endif.

0 Kudos
221

Denis,

I still have not received any response on how you determine that it does not work.

setting new_pricing to B in this userexit is actually the same as calling repricing and selecting pricing type B.

So, the question is :

1) you change incoterms and have your code in place to set new_pricing to B. Does it update pricing as you expect or not - if not why you think new pricing is not called, is it because some of your conditions are not re-calculated ?

2) remove your code, change incoterms, MANUALLY call repricing and select pricing type 'B', do you get desired result or not ?

Just compare these 2 cases, manual repricing without code and automatic repricing triggered by your code -> if there is no difference between these 2 cases -> the problem is not in this userexit but in your pricing logic/config. If there is a difference - try to compare these 2 cases to see where it goes wrong.

0 Kudos
221

Hi

Have you tried this?

if vbkd-inco1 ne *vbkd-inco1.

new_pricing = 'C'.

endif.

Max

0 Kudos
221

Slightly late, but I've spent a few days trying to work this one out.

The problem is that after the user exit, two different pricing routines are called PREISFINDUNG_GESAMT (for the header) and PREISFINDUNG (for the line items). The issue I had was that the pricing was being re-calculated, but it is all done in the in the first pass in the header routine. If you haven't modified the line items by this point, then the pricing is the same.

I used this exit to modify the pricing type VBKD-PLTYP, but in order to do this I had to update all the records in XVBKD on the first pass, when VBKD-POSNR eq '000000'.

I'm still testing this, but this seems to be the problem.