Skip to Content

Userexit for insert new sales order item in VA01 / VA02

Dear all,

The user's requirement is:

In VA01/VA02, when user entered a certain material, let say material ID is 100011, request sales quantity 10, the system will automatically split it into 2 items lines, one is 100011 for qty 9 and the other one is 100011 for qty 1.



item material qty

10 100011 10


item material qty

10 100011 9

20 100011 1

Now, i have 2 questions:

1. How to change the item quantity in exits?? i have try MV45AFZZ -> USEREXIT_MOVE_FIELD_TO_VBAP, but seems not work....

2. How to add a new item? (just like the item 20 in the above case)

Thanks for your help and valuable time in reading it....

Thanks a lot!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Dec 21, 2004 at 09:55 AM


    1) Exit MV45AFZB-USEREXIT_CHECK_VBAP is called after user's maintenance: that's the correct time (even when it's not designed for changes).

    2) Sounds dangerous. If you are in a VBAP-Exit, then it's in a loop - adding a new VBAP line by coding, won't call all the necessary routines to get a consistent new entry in sales order. If you try header-level exits (or prepare save), then you might have a change to call all necessary routines - difficult.

    A different process seems to be easier to handle:

    - make an own maintenance transaction and create sales order via BAPI; checks and additional value reading might be done by 'simulate' flag of BAPI (lot of work)

    - help by customizing: check usage of follow-on materials, component lists, packing materials...

    I guess, discussion with consultants will be most successfull.



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 21, 2004 at 10:29 AM


    1. You need to ensure the right structure is updated. I think XVBAP is the one to use.

    2. Very risky as how would you invoke any necessary checking for the new item ? Why do you want to do this - what is the business reason ?



    Message was edited by: Colin Bickell

    Add a comment
    10|10000 characters needed characters exceeded

    • In fact our team has come out such approach catering for the following user requirement:

      My company will luanch a promotion for selling certain materials. for example:

      A material '100011' is set the selling price at $100@pcs.

      If the material is sold at the 10th pcs, 20th pcs, etc (a multiple of 10) from certain sales org., the customer will get a special price at $20 for that piece of material.

      if accumulated qty = 3pcs, customer buy 5 pcs:

      5 x $100 = $500 (no promotion enjoyed)

      if accumulated qty = 8pcs, customer buy 5 pcs:

      4 X $100 + 1 X $20 = $420 (enjoy 10th pc)

      if accumulated qty = 8 qty, customer buy 13,

      11 X $100 + 2 X $20 = $1140 (enjoy 10th, 20th pc)

      So our approach is:

      a. calculated the quantity enjoying the promotion.

      b. split it into 2 item lines.

      c. assigned item category 'TAN' and ' ZABC' to these 2 lines.

      d. config the pricing procedure so that item with item cat. 'ZABC' will get the promotion price.

      Any comment/suggestion are very welcome and would be helpful!

      Thanks in advance.


  • Posted on Dec 21, 2004 at 12:20 PM

    Hi Winson,

    good idea to talk with a consultant 😊

    Much easier way: create a new promotion condition in pricing schema (I would suggest a discount, in your example with value of $80). In condition base formula you can calculate 'amount', which has to be applied to the discount. For your three examples: value 0, 1 and 2 would be the correct numbers (technical perhaps 1000, because of implicit decimal point).

    If accumulated quantity isn't available in pricing structure up to now, it should be filled via user-exit LWVK1002. Extend include KOMPAZ of structure KOMP (if necessary).

    You will get some: 'but we want to see (clearly, immediately...)' replies. Additions for printing or condition display in sales order are much easier to make, than new line creation in sales orders!



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 21, 2004 at 06:19 PM

    Hi Winson,

    This is a scenario that can typically be handled through configuration. Material determination, Sales BOMs, Pricing are some of the areas in SD that you need to be looking into.

    A technical solution is not always the best solution for such requirements(I am saying this even though I am a core technical person!!!).



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.