Sales Order Creation ( Bapi Problem )
I am using BAPI_SALESORDER_CREATEFROMDAT2 to create sales order & noted a strange thing over there, system gives the following msg after call the bapi :
T ID NUM MESSAGE
S V4 233 SALES_HEADER_IN has been processed successfully
S V4 233 SALES_ITEM_IN has been processed successfully
<b>W V1 555</b> The sales document is not yet complete: Edit data
S V1 311 BFS Sales Order 105 has been saved
Even when I check tcode VA03 system says sales order 105 is not available, even though I am getting a msg (311 BFS Sales Order 105 has been saved). I could not understand the problem.
While using BAPI_SALESORDER_CREATEFROMDATA system is creating the record properly and we are able to see it via va03.
Since BAPI_SALESORDER_CREATEFROMDATA does not provide the facility to add the Text that's why we have to use BAPI_SALESORDER_CREATEFROMDAT2.
It will be highly appreciated if some body could suggest how to handle this issue or can we use some other bapi instead of BAPI_SALESORDER_CREATEFROMDAT2.
John Jakabcsin replied
Are you calling BAPI_TRANSACTION_COMMIT after the BAPI create?
data: ret_text type BAPIRET2.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
ORDER_HEADER_IN = hdr
convert = 'X'
SALESDOCUMENT = salesdoc
return = ret_tbl
ORDER_ITEMS_IN = itm
ORDER_PARTNERS = prtnr
ORDER_ITEMS_inx = itmx
ORDER_CONDITIONS_IN = conds
ORDER_CONDITIONS_INX = condsx
order_schedules_in = schd_lin.
if sy-subrc = 0
and not salesdoc is initial.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
WAIT = 'X'
RETURN = ret_text.
This second BAPI MUST be called to save the order.