Skip to Content
avatar image
Former Member

Simulate sales order creation regardless minimum item quantity

Hello experts,

I am simulating an order creation through FM BAPI_SALESORDER_SIMULATE. The input material has a minimun quantity of 2 units. If I use 2 units in the FM everything works fine. However, when I use 1 quantity, the function returns an error because of the minimum quantity. When I create an order with the same material via VA01 I can place 1 unit of this mateiral after a warning message. How can I simulate the order creation with 1 unit? Should I use another FM? I tried with SD_SALESDOCUMENT_CREATE and the result was the same. I also tried adding item category, but this was useless. I am interested in schedule lines and conditions.

Thank you in advance, regards.

Add comment
10|10000 characters needed characters exceeded

  • Not sure whether you want that restriction only in one process. For information, in material master, Sales Org.1 view, there is a field to set minimum order quantity where you can check and if some value is set and you dont want, you can remove and test. This will be applicable to all sales document types.

  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 28, 2016 at 08:52 AM

    I agree with you both Jalena and Ryan that is a strange case. Besides, I should have explained the item category type at the very beginning. I may contact to business. Anyway, I found the solution. Instead of using BAPI_SALESORDER_SIMULATE, I must use SD_SALESDOCUMENT_CREATE in test mode. I do not why but this function takes into account the manual item category input. Thank you for your help.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 27, 2016 at 05:07 PM

    It would've been helpful if this was mentioned in the original post. Essentially, your question now is whether simulation is possible using manual item category. If you Google "BAPI_SALESORDER_SIMULATE item category site:sap.com" you will find this SCN post, among others. See if this answers it.

    Technically, since PSTYV is included in ORDER_ITEMS_IN table, I'd believe it should be feasible to pass a manual item category to the BAPI and expect the same result as entering it in VA01. It might be worth opening an incident with SAP Support and asking why it's not working. You might not get a solution but at least an explanation (and perhaps they should update documentation then). Although there could be some configuration and other custom code is in your system that could influence this.

    I have to say though that using a different item category to bypass minimum order seems like a very odd solution. And how does it make sense for business? Minimum order is usually required when it's either not profitable or just impossible to sell less. If it is possible to sell 1 unit then why do you have minimum 2 in the first place? And what is the criteria for allowing 1 instead of 2? Really strange business process and configuration here. Maybe this is not even an ABAP problem...

    Add comment
    10|10000 characters needed characters exceeded

    • In my experiences the system will always take the manually entered item category value assuming no other configuration or custom code would override the value based on some specification (Although maybe there is an OSS note applicable to your case). In regards to Jelena's line of thought too - I'm not understanding why there is a need to calculate the price for something that cannot be ordered aside from maybe some special circumstance. I would generally push for the business process to handle the normal occurrence instead of the exception because if it's an exception then it is likely to happen very infrequently. Otherwise, it ceases to be an exception any longer and would become part of the normal process.

      Regards,

      Ryan Crosby

  • Oct 26, 2016 at 08:14 PM

    What you are asking is not possible by definition. "Simulation" is the imitation of the real-world process. In your case the order cannot be placed with less than 2 units, so the error message is the correct simulation result. What would be a point of "simulation" of something that does not exist or not possible in real life? That would no longer be a simulation.

    I'm quite confused what are you trying to achieve in this case. If you want to check the material availability in general then there is another BAPI for that. If you want to check a price then the price for 1 item won't be valid anyway if you can't order just 1 item. I hope you can see how this makes no sense.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 26, 2016 at 12:56 PM

    Thank you for your answer. I know about the minimum order quantity in material master. I would like to mantain that field and simulate a order creation with 1 unit to obtain pricing conditions of a single unit.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 27, 2016 at 07:50 AM

    Hello Jelena,

    Thank you for your answer. I see your point. Simulation is working properly because I get the same error message as if I were using VA01 (minimum quantity error).

    Let me show you an example to clarify the issue:

    I am creating a new sales order through VA01. Material used is Z12345 with quantity 1 unit. Line is created with material Z12345, quantity 1 unit and item category Z123. Material minimun quantity is 2 untis, so an error message appears saying that minimum quantity is 2 units. I change the quantity from 1 to 2 units. I guess the process is pretty clear so far. After this, I change the item category to Z456 and the quantity to 1 unit. Changing the item category I am allowed to introduce the quantity I want regardless the minimum (this is the special function of this item category).

    When I simulate the order via FM BAPI_SALESORDER_SIMULATE, I tried to change item category to Z456 in order to introduce quantity 1 unit and get schedule lines and pricing conditions. Unfotunately, I did not achive this goal, the FM does not take into account the new item category (Z456), but the automatically one (Z123).

    I hope this clarify the issue.

    Regrads.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 28, 2016 at 04:18 AM

    Minimum order qty based on Item category!!! I hope there was some enhancement done at your system..

    Have you tried by changing default item category to Z456 from Z123 in VOV4?

    Phanikumar

    Add comment
    10|10000 characters needed characters exceeded