Skip to Content
avatar image
Former Member

Custom fields in sales order to fetch details from quotation


We have a requirement. We will first be creating a quotation. the quotation can have any number of line items. We will then create a stand alone sales order (with out ref to quot ).

In the sales order, we will have two custom fields on the screen at In the first custom field at item level. we will enter the quotation number and the quotation item number for which we are creating a sales order (we can create the SO with ref to Quot but we do not want to due to business reasons )

1) We want, as soon as user enters the quotation number and quotation item number in sales order custom fields above, we want system to check whether the material number in sales order line item matches with that of the material number in the quotation. How to achieve this ? Do we need to use BAPI to call Quotation ? I mean how to call quotation on entering quotation number in custom fields from sales order create mode ? if BAPI needs to be called, then can BAPI be called during sales order create mode only when entering information in custom fields from quotation ?

2) We want to compare some data in quotation with that of the sales order being created. How to enhance this ?

3) As soon as we enter the quotation number/item in sales order custom field, we want that the qty in sales order item be subtracted from the quotation qty ? for eg, if quotation is of 100 kg, then when sales order is created for 30 kg. Then the balance left in quotation should be 70 kg ?



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Sep 25, 2013 at 05:39 AM

    Hi Pamela

    This can be done through modifications and enhancements. If you are ABAPER then you should know this and if you are not ABAPER then discuss this with your ABAPER.

    For entering new custom fields you can use append structure and add fields in VBAP, VBEP  and VBAK tables.

    For validating material number, quotation number and quantity etc you can use MV45AFZZ program and USEREXIT_MOVE_FIELD_TO_VBAP to validate material number and quotation number/ item number. I think this can be done without calling any BAPI. Abaper will select the quotation  number from VBAK table and validate this with XVBAP quotation number. Same will be done with material, quantity etc. For quantity you need to add your logic in USEREXIT_MOVE_FIELD_TO_VBEP.

    I have done this before and it should work. Please test and update.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 25, 2013 at 06:32 AM

    Hi Pamela,

    The above requirement is possible but will need fair bit of changes at technical level. The new fields will have to be added in the append structure in VBAP, say VBAP-ZQUOTNO and VBAP-ZQUOTPOS for the Quotation number and Position number. You will also have to get the screen for Sales Order modified- and therefore need to decide as to which tab you want it to be displayed. Inlcuding whether you want these new columns to  be displayed based on certain conditions only-else it will be visible globally for all the users.

    Then the validation will have to be added based on the FCODE assigned to the new field and when the Quotation number is entered and user presses Enter, the PAI Module modifications will be needed to verify few things before fetching the details from the Quotation. For example-the Sold-to-Party, Sales Area, etc. And then the screen fields will have to be populated.

    Now regarding the reducing of the quantity from the Quotation-you will have to call a BAPI for Quotation change in the Update Task to ensure that the quantity is reduced only when the Sales order has been saved successfully. Which also means that you will have to add logic to trigger this even if some user reduces or increases this quantity. So calling the BAPI in create mode only is not an option. In order to ensure consistency-you will also have to code to Lock the Quotation the moment it has been referred and keep the lock till the time the sales Order has not updated it as else some other user referencing to the same Quotation will have incorrect results.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Shashi,

      We have implemented the code and the qty is getting redcued in quotation through BAPI sales order change.

      But we have an issue. When the qty is getting reduced in Quotation, the availability check is not gettign trigerred.  why ?

      for eg, in the original quotation, 100 kg was the qty  with  requested delivery date of 16.10.13 and confirmed  date of 20.10.13 in the schedule lines. so we have two schedule lines , one eith zero confirmed qty and the other with 100 kg.

      As soon as the qty is reduced in quotation by BAPI to 80 kg, we have   80 kg shown in schedule line for requested delivery date with a confiremd qty of 0 and a confirmed qty of 100 kg in the 2nd schedule line which is wrong . We should have 80 kg in the confirmed schedule line too.

      Clearly that means the availibility check is not happening ?

      Other question is which standard code in SD triggers availability check ?

      any suggestion ?