Application Development and Automation 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: 

Sales order creation error with reference to quote using BAPI

Enzo_Chen
Discoverer
0 Kudos
900

My user created a quote with an irregular line number like 10/15/20/30. When creating a sales order with reference to this quote using bapi BAPI_SALESORDER_CREATEFROMDAT2, It will prompt an error that the material in item 000020 cannot be modified. I debug the standard program and find that the codes of bapi and va01 are inconsistent. When bapi is executed, 15 lines will be modified to 20 lines.But everything works fine with VA01. Is there any way or notes to fix this problem?

5 REPLIES 5

Abinathsiva
Active Contributor
0 Kudos
876

Hi Enzo_cc

For Quote creation use below BAPI.

CALL FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA'
    EXPORTING
      order_header_in = order_header_in
*     without_commit  = ‘ ‘
     convert_parvw_auart = 'X'
    IMPORTING
      salesdocument   = salesdocument
      sold_to_party   = sold_to_party
      ship_to_party   = ship_to_party
*     billing_party   =
      return          = li_return
    TABLES
      order_items_in  = order_items_in
      order_partners  = order_partners
*      order_items_out = order_items_out
     order_cfgs_ref  = order_cfgs_ref
*     order_cfgs_inst = order_cfgs_inst
*     order_cfgs_part_of  = order_cfgs_part_of
*     order_cfgs_value    = order_cfgs_value.
    .

0 Kudos
872

Hi Abinathsiva,

I'm not mean to create quote,just want to create SO with existing quote for reference.The key point is how to deal with inconsistent item numbers.

RaymondGiuseppi
Active Contributor
0 Kudos
869

Which value did you pass to INT_NUMBER_ASSIGNMENT parameter

  • space, no value, external numbering, so your values are kept
  • X, abap_true, internal numbering, so BAPI assigns the item numbers internally.

0 Kudos
865

Hi Raymond,

I set parameter INT_NUMBER_ASSIGNMENT with default space,if I mark this parameter as X, sales order can be created,but if my quote item numbers are 10/15/20/40/50,the SO line number would be 10/20/30/40/50/60/70,with two duplicate lines.So there is still a problem with the created order.

0 Kudos
801

Check that there are no items in the quotation that need to be exploded in the sales order (e.g. bill of materials)

  • In this case, it would be normal to obtain a different number of items.