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: 

VA01/VA02 - multiple lines price determination

MariusStoica
Active Participant
0 Kudos

Hi gurus,

The client needs to add in the PO a few lines with new data.

Although this has been achieved with the help of this post (), I have a problem with the price determination.


       ls_xvbap-mandt = '300'.

       ls_xvbap-pstyv = 'TAN'.

       ls_xvbap-updkz = 'I'.

       ls_xvbap-werks = '4100'.

       ls_xvbap-lgort = '4101'.


       LOOP AT gt_stanga INTO ls_list WHERE cant <> 0.

         ls_xvbap-posnr  = ls_xvbap-posnr + 10.

         ls_xvbap-matnr  = ls_list-cod_material.

         ls_xvbap-matwa  = ls_list-cod_material.

         ls_xvbap-kwmeng = ls_list-cant.

         SELECT SINGLE charg

           FROM mseg

             INNER JOIN mbew ON  mbew~matnr = mseg~matnr

                             AND mbew~bwkey = mseg~werks

                             AND mbew~bwtar = mseg~charg

           INTO ls_xvbap-charg

           WHERE mbew~matnr = ls_xvbap-matnr

             AND mbew~lbkum <> 0.

         svbap-tabix = 0.

         PERFORM vbap_bearbeiten_vorbereiten(sapfv45p).

         svbep-tabix = 0.

         PERFORM vbep_bearbeiten_vorbereiten(sapfv45e).

         MOVE-CORRESPONDING ls_xvbap TO vbap.

         MOVE-CORRESPONDING ls_xvbap TO rv45a.

         PERFORM vbap_fuellen(sapfv45p).

         PERFORM vbap_bearbeiten(sapfv45p).

         PERFORM vbep_fuellen(sapfv45e).

         PERFORM vbep_bearbeiten(sapfv45e).

         PERFORM vbap_bearbeiten_ende(sapfv45p).

         PERFORM koein_ermitteln_n46(sapfv45p).

         PERFORM komv_bearbeiten_n46(sapfv45p).

       ENDLOOP.

       PERFORM preisfindung_nachbereiten_pos(sapfv45p) USING t185f t185 t185v.

       fcode = 'ENT1'.

       SET SCREEN syst-dynnr.

       LEAVE SCREEN.

It works only for the last line (in case I add more than one) using this method (VA02: Carry out new pricing by changing item category), but it needs to work for every line.


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.

I'm curious if there is something similar with the first issue (the determination for much of the data is done for each line due to the 2 variables set to
"0"), different forms called for each line but I didn't manage to find some.

Anyone can share some pointers to solve this issue?

Thank you in advance,

Marius

12 REPLIES 12

former_member1716
Active Contributor
0 Kudos

Hi Marius,

Why dont you try the enhancment point at user exit,

   FORM USEREXIT_NEW_PRICING_VBKD CHANGING NEW_PRICING.

try to understand the flow through debugging. Also I would request you to go through the SAP notes 24832. This will give you a good indepth understanding about the Repricing.

Regards,

Satish

0 Kudos

Hi Satish,

It doesn't help me.

The lines that are added to the PO are from a code. Not copied from another PO or same PO. That's why I need to (re)determine the price for each new line.

Thanks,

Marius

MariusStoica
Active Participant
0 Kudos

Hi guys,

I still require a solution or hint here.

Thank you in advance,

Marius

0 Kudos

Hi,

Did you go through the SAP Notes 24832, was it useful.

regards,

Satish

0 Kudos

Yes I did, it didn't help.

former_member1716
Active Contributor
0 Kudos

Hi Marius,

Can you please let us know how you are testing the New pricing for the value changed in route field.

It shouldbe done like this,

For each line item individually change the route field and press enter, now check for the amount value it should be changed. Similarly it should be changed for each line item. The user exit i suggested should work, its working for me. I would also  request you to put a breakpoint in the exit and see how and when it is called, also keep a count on number of times it is called.

Please let us know on the results.

Regards,

Satish

0 Kudos

I import 2 or more lines at a time, I can't press "enter" after each line and the program stops on my break point only once, even if I have 3 or more lines inserted.

0 Kudos

Did you try updating the line items with the new pricing from conditions tab using the standard procedure. What is the result.

Regards,

Satish

0 Kudos

Hi Satish,

I don't understand your question.

If I add the data manually, everything works fine.

The problem appears when I add them via code to the table XVBAP. I have no price to give to the program, I have to make the system react to the new lines and determine it from the price list (VK12) for each material.

Thanks,

Marius

0 Kudos

Hi Marius,

I was in an assumption that you are checking for manuall retriggering. In case of code i don have a proper solution now. However you can simply try looping the table and inside the loop simply assign the pricing procedure directly. Am not sure on this, please let us know on the results.

Regards,

Satish

0 Kudos

Hi Satish,

It didn't work. I either receive errors that the function does not exist in t185/T185F, or not hing is determined.

Thanks,

Marius

MariusStoica
Active Participant
0 Kudos

Hi gurus,

Any ideas here ?

Thanks,

Marius