cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating VPRS values from Puchase order

Former Member
0 Kudos

Hi Expert

ECC 6

I have configured a 3rd party order and included VPRS condition type in pricing procedure with all recommended settings.

It is working fine at sales order level, picking a standard price from the Material Master --> Accounting View.

This Sales order created a Purchasing Requisition automatically.

Above Purchase Requisition was converted into a Purchase order and refering to the above sale order.

The purchase order --> Item --> Pricing Condition contains Basic Material price, Custom Duty and Freight.

When I create a Billing Document, system only picks up the Basic Material Price in VPRS.

I need all three components (Basic Material Price + Custom Duty + Freight) in VPRS.

please provide your expert advice to achieve this requirement.

Thanks

Venkat

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello Ramachandran,

I have implemented this. Below I indicate the different steps.

In fact, some companies may need to calculate the exact margin rate performances by a particular sales person for instance. This includes taking into account the way the products are sold. What are their freight charges and other additional costs.

This can be fulfilled by making some modification in relevant user exits. Depending on your ABAP skills you may need the help of an Abaper.

Pricing user exits are included in function group V61A. Particularly in include RV61AFZB and RV61AFZA. In our particular case, we'll use include RV61AFZB (FORM USEREXIT_XKOMV_BEWERTEN_END).

Then, you need to first mention in user exit RV61AFZB the name the direct delivery item category that will have VPRS amount coming from purchase order. We'll do this by the following line of code.

IF komp-pstyv = 'TAS'.

Then, based in the customer order we are able to search for the purchase order number and relevant item numbers via table VBFA.

SELECT SINGLE * FROM vbfa into l_vbfa WHERE
     vbelv = komp-vgbel
     and posnv = komp-vgpos
     and vbtyp_n = 'V'.

Now, you can browse the purchase order details from the purchase order table header (EKKO).

SELECT SINGLE * FROM ekko into l_ekko WHERE
     ebeln = l_vbfa-vbeln.

With the purchase order number we are able to get all price conditions from this purchase order. We use table konv for this purpose.

   SELECT * FROM konv INTO TABLE w_konv WHERE
     knumv = l_ekko-knumv.

Now, we need to loop at internal table recently created w_konv to get all cost price conditions. At this stage you can filter which condition type (H, G etc...), characteristics (statistical etc...) you wish to take into account in your VPRS calculations. In my example I did not filter any conditions particularly.

LOOP AT w_konv INTO l_konv. 
  ADD l_konv-kwert TO z_kwert.
  CLEAR l_konv-kwert.
    ENDLOOP.

Finally, here is an example of the VPRS new valuation.

LOOP AT xkomv WHERE kschl = 'VPRS'.
        z_sign = -1.
        xkomv-kbetr = z_kwert.
        xkomv-kwert = ( ( xkomv-kbetr * komp-mgame / 1000 ) ) * z_sign.
        xkomv-kwert_k = ( ( xkomv-kbetr * komp-mgame / 1000 ) ) * z_sign.
        MODIFY xkomv.
   ENDLOOP.

Be careful with the calcultation because in my example I did not took into account the price per sales unit (KPEIN field). Then you may need to amend this part of the code accordingly. Also refer to note 24832, 900089 for further details.

I have posting this quite lately but I hope it will help you.

Below is my full example of the implementation of user exit (notice the code may not be perfect I did not revised it) FORM USEREXIT_XKOMV_BEWERTEN_END

FORM USEREXIT_XKOMV_BEWERTEN_END.
                                   

TABLES: vbfa, ekko.

DATA : l_vbfa TYPE vbfa.
DATA : l_ekko TYPE ekko.
DATA : w_konv LIKE STANDARD TABLE OF konv WITH HEADER LINE.
DATA : l_konv LIKE LINE OF w_konv.
DATA : n_vprs type komv-kbetr.
DATA : z_sign type i.
DATA : z_kwert type konv-kwert.


IF komp-pstyv = 'TAS'.

   SELECT SINGLE * FROM vbfa into l_vbfa WHERE
     vbelv = komp-vgbel
     and posnv = komp-vgpos
     and vbtyp_n = 'V'.

IF sy-subrc = 0.
   SELECT SINGLE * FROM ekko into l_ekko WHERE
     ebeln = l_vbfa-vbeln.

IF sy-subrc = 0.
   SELECT * FROM konv INTO TABLE w_konv WHERE
     knumv = l_ekko-knumv.

  LOOP AT w_konv INTO l_konv.

  ADD l_konv-kwert TO z_kwert.
  CLEAR l_konv-kwert.

    ENDLOOP.


IF sy-subrc = 0.
   LOOP AT xkomv WHERE kschl = 'VPRS'.
        z_sign = -1.
        xkomv-kbetr = z_kwert.
        xkomv-kwert = ( ( xkomv-kbetr * komp-mgame / 1000 ) ) * z_sign.
        xkomv-kwert_k = ( ( xkomv-kbetr * komp-mgame / 1000 ) ) * z_sign.
        MODIFY xkomv.

   ENDLOOP.
 

   ENDIF.
   ENDIF.
   ENDIF.
   ENDIF.

*}   INSERT
ENDFORM.


Former Member
0 Kudos

Hi Hervé DUCLOS

Thanks a lot.  It helped me a lot to design a solution as I required.

Venkat

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

I need SAP Note  390532 to understand the solution.  SAP is saying it is internal and not released. If anybody or SAP can share this note.  It is very urgent and I would like to provide a solution to client.

Moderator:  Could you provide a link to this note?  if not, could please email me?  My email id is rvsubhu@vsnl.com.

Thanks

Venkatasubramanian R

Former Member
0 Kudos

Dear,

Against VPRS condition 'Condition Category' should be 'G' in that case cost will be taken by PO. Maintain ‘S’ or ‘T’ in the Valuation segment of material master. Condition must be flagged as 'Statistical' in the pricing procedure. In addition to this, maintain requirement as '4' and subtotal field as ‘B’ in your pricing procedure. Check out the detailed display of VPRS condition. If the condition control KSTEU = 'H', the cost has been taken from goods

issue. If it = 'A', it was redetermined from the valuation segment of the material master and in case of 'D' or 'E' it's copied rom the preceding document. Check the same and revert with updates. Thanks and have a good day.

former_member186385
Active Contributor
0 Kudos

Hi,

In the standard pricing procedure, VPRS is assigned with the Requirement Routine 4 which will determine the cost from Material master accounting view

If you want to have different value to be determined, then you have to write a new routine in VOFM according to the requirement

but do you need the value to be determined only in the Billing document VPRS ?

regards,

santosh