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: 

How to redetermine Pricing on adding ZI partner

Former Member
0 Kudos

Hi Champs,

My requirement is to trigger new pricing in va02 when ZI partner is added.

Manually, On adding the SVO item ZI partner is triggered. ( VA02-> HEader -> partners)

Then on clicking an item and new pricing pricing is redetermined.

Now, We have to redetermine this pricing automatically on adding this ZI partner.

I tried with exit userexit_new_pricing_vbap, but since there is no change related to VBAP , pricing is not redetermined.

Could anybody help me with some idea or user exits where this has to be triggerred?

Thanks in advance,

Ramya

1 ACCEPTED SOLUTION

Former Member

You need to add the Partner of ZI partner function as a new field (say ZI_PARTNER) to pricing field catalog (KOMG structure). KOMG inherits new fields from KOMKAZ or KOMPAZ structures and it is not directly modified but through KOMKAZ and KOMPAZ structures

If the ZI partner is going to be same for the whole order then you can consider it as a header attribute and add ZI_PARTNER field to header pricing communication structure KOMKAZ or if it can vary from item to item add it to item pricing communication structure KOMPAZ. Once KOMKAZ or KOMPAZ are added with new ZI_PARTNER field it will automaticall appear in pricing field catalog (KOMG)

Afterwards the ZI Partner field will then start to appear in the field catalog where you can create condition table (V/03) including the partner function as a field. Once done the rest is assigning the condition table to access sequence which is in turn assigned to the relevant condition type that you want to price based on partner function (all under IMG -> SD -> Basic functions -> Pricing -> Pricing control)

In the pricing user exit userexit_pricing_prepare_tkomk in MV45AFZZ (if you added ZI_PARTNER to KOMKAZ) or userexit_pricing_prepare_tkomp (if you added ZI_PARTNER to KOMPAZ), you will need a few lines of coding to read the ZI partner and pass it to tkomk or tkomp structure. This will then be used by system to read the new condition table that you created.

So if you populate special pricing for ZI partner in the condition table then that condition record will be read for the corresponding condition type.

You would of cours need a developer to modify KOMKAZ (or KOMPAZ) structures and code the user exit for moving the partner function to tkomk (or tkomp)

That is in short how you can achieve this

7 REPLIES 7

Former Member

You need to add the Partner of ZI partner function as a new field (say ZI_PARTNER) to pricing field catalog (KOMG structure). KOMG inherits new fields from KOMKAZ or KOMPAZ structures and it is not directly modified but through KOMKAZ and KOMPAZ structures

If the ZI partner is going to be same for the whole order then you can consider it as a header attribute and add ZI_PARTNER field to header pricing communication structure KOMKAZ or if it can vary from item to item add it to item pricing communication structure KOMPAZ. Once KOMKAZ or KOMPAZ are added with new ZI_PARTNER field it will automaticall appear in pricing field catalog (KOMG)

Afterwards the ZI Partner field will then start to appear in the field catalog where you can create condition table (V/03) including the partner function as a field. Once done the rest is assigning the condition table to access sequence which is in turn assigned to the relevant condition type that you want to price based on partner function (all under IMG -> SD -> Basic functions -> Pricing -> Pricing control)

In the pricing user exit userexit_pricing_prepare_tkomk in MV45AFZZ (if you added ZI_PARTNER to KOMKAZ) or userexit_pricing_prepare_tkomp (if you added ZI_PARTNER to KOMPAZ), you will need a few lines of coding to read the ZI partner and pass it to tkomk or tkomp structure. This will then be used by system to read the new condition table that you created.

So if you populate special pricing for ZI partner in the condition table then that condition record will be read for the corresponding condition type.

You would of cours need a developer to modify KOMKAZ (or KOMPAZ) structures and code the user exit for moving the partner function to tkomk (or tkomp)

That is in short how you can achieve this

0 Kudos

Hi ,

Thanks for your response.

But I am looking for something where i could automate clicking on new pricing button whenever there is a new item SVO_cretaion is added. In the sense triggerring new pricing for all the items once ZI partner is added.

Regards,

Ramya

0 Kudos

You can use user exit USEREXIT_NEW_PRICING_VBAP in MV45AFZB, whose very purpose is to trigger new pricing based on changes in item level fields from VBAP. You specify the condition where new pricing is to be triggered, i.e., when user adds ZI partner (will be available in XVBPA). Only thing you need to take care is that you set new pricing when XVBPA-UPDKZ = 'I' (new ZI partner record inserted). This is so that new pricing is carried when only some one adds ZI partner and not every time the order is opened.

As you can see below new pricing is triggered by setting variable new_pricing = 'B'.

Sorry, I got carried away last time and explained you configuring pricing based on custom field!

*&---------------------------------------------------------------------*
*&      Form  USEREXIT_NEW_PRICING_VBAP
*&---------------------------------------------------------------------*
*       This userexit can be used to perform new pricing, dependant   *
*       on the change of datafields.                                  *
*       This routine is not called, when the material number has been *
*       changed.                                                      *
*       Available data-fields:                                        *
*         vbak - header data                                          *
*         vbap - item data     (changed)                              *
*         *vbap - item data (old, before the change)                  *
*                                                                     *
*       Parameter new_pricing controls the new pricing in the calling *
*       form. It can be filled according the the allowed values       *
*       of domain KNPRS (Pricing type), for example:                  *
*       ' ' = no new pricing                                          *
*       B   = Carry out new pricing                                   *
*       C   = Copy manual pricing elements and redetermine the others
*---------------------------------------------------------------------*
FORM userexit_new_pricing_vbap CHANGING new_pricing.

* Example: new pricing, when field 'Route' is changed
* if vbap-route ne *vbap-route.
*   new_pricing = 'B'.
* endif.

ENDFORM.

If you want to trigger new pricing based on header data, then you can consider the below user exit from MV45AFZB and trigger your coding when VBKD-POSNR = '000000' (indicates header record)

*&---------------------------------------------------------------------*
*&      Form  USEREXIT_NEW_PRICING_VBKD
*&---------------------------------------------------------------------*
*       This userexit can be used to perform new pricing, dependant   *
*       on the change of datafields                                   *
*                                                                     *
*       Available data-fields:                                        *
*         vbak - header data                                          *
*         vbkd - business data (changed)                              *
*         *vbkd - business data (old, before the change)              *
*                                                                     *
*       Field vbkd-posnr is the item-number of the business data.     *
*       If the field is initial, then vbkd contains the business      *
*       header data.                                                  *
*                                                                     *
*       Parameter new_pricing controls the new pricing in the calling *
*       form. It can be filled according the the allowed values       *
*       of domain KNPRS (Pricing type), for example:                  *
*       ' ' = no new pricing                                          *
*       B   = Carry out new pricing                                   *
*       C   = Copy manual pricing elements and redetermine the others
*---------------------------------------------------------------------*
FORM userexit_new_pricing_vbkd CHANGING new_pricing.

* Example: new pricing, when Price list type is changed
* if vbkd-pltyp ne *vbkd-pltyp.
*   new_pricing = 'B'.
* endif.

ENDFORM.

0 Kudos

Hi,

Thanks for your prompt response.

I tried with USEREXIT_NEW_PRICING_VBAP , but for some reason it is not getting triggerred .

Though there is a new item added to xvbap internal table as a new item SVO _Creation is added there is not much impact on this exit.

But when USEREXIT_NEW_PRICING_VBKD is used,

I put new_pricing = 'B' new pricing is determined and condition record get satisfied. But i get an error message INXJ missing.

Could you please help me with this. Probably Iam missing something?

Thanks,

Ramya

0 Kudos

I need more technical details like error message number, message id and full message to understand

0 Kudos

I get an error as below :

"Pricing error: Mandatory condition INXJ is missing"

Also i could note that there is no INXJ condition maintained for this last aded item.

May be thats why it is redeterminig for all other items and showing an error message for this particular item.

0 Kudos

This is a pricing error. What it is saying is that the condition type INXJ that is declared as mandatory in the pricing procedure is missing during pricing.

Assuming you are in dev/test environment you can do the following quick check

What you can do is select the item -> Goto -> item -> Conditions -> Click on Analysis and search for INXJ condition type and check what values it is searching for that condition type. You can create condition record for that value combination in VK11, with validity as on pricing date. Then this error will go away.