Application Development 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 ( Bapi Problem )

Former Member
0 Kudos

Hi,

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.

Thanks,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Are you calling BAPI_TRANSACTION_COMMIT after the BAPI create?

data: ret_text type BAPIRET2.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

ORDER_HEADER_IN = hdr

convert = 'X'

IMPORTING

SALESDOCUMENT = salesdoc

TABLES

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'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = ret_text.

This second BAPI MUST be called to save the order.

10 REPLIES 10

Former Member
0 Kudos

Are you calling BAPI_TRANSACTION_COMMIT after the BAPI create?

data: ret_text type BAPIRET2.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

ORDER_HEADER_IN = hdr

convert = 'X'

IMPORTING

SALESDOCUMENT = salesdoc

TABLES

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'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = ret_text.

This second BAPI MUST be called to save the order.

0 Kudos

Call <b>'BAPI_TRANSACTION_COMMIT'</b>after <b>'BAPI_SALESORDER_CREATEFROMDAT2'</b>

Former Member
0 Kudos

Hi Pradeep,

The problem is in SAP.

Take a look at the OSS note and implement this and it should resolve your problem.

603131 - BAPI SD: Incorrect incompleteness messages

Symptom

In the return table of a BAPI, you find warning message V1555 "The sales document is not yet complete: Edit data" although the document is complete.

Other terms

VBAK-NETWR, vbuv, xvbuv

BAPI_CUSTOMERINQUIRY_CHANGE, BAPI_INQUIRY_CREATEFROMDATA2, BAPI_QUOTATION_CREATEFROMDATA2, BAPI_CUSTOMERQUOTATION_CHANGE, BAPI_SALESORDER_CHANGE, BAPI_SALESORDER_CREATEFROMDAT2, BAPI_CONTRACT_CREATEFROMDATA, BAPI_CUSTOMERCONTRACT_CHANGE

Reason and Prerequisites

The problem is caused by a program error.

Solution

Implement the attached corrections.

Cheers

VJ

Mark Helpful Answers

Former Member
0 Kudos

Pradeep,

Has the issue been resolved?

If so, please reward points accordingly.

Thanks.

Former Member
0 Kudos

Hi John,

I am trying to do in the same way however u hv suggested. Off course you will get your marks.

Thanks,

Former Member
0 Kudos

Pradeep,

Also note that you MUST fill in the schedule line table as well. This schedule line data MUST contain the ordered qty.

Example:

  • Build schedule line as well.

move l_number to schd_lin-itm_number. "line number

schd_lin-req_qty = i_vbap-kwmeng. "ordered qty

append schd_lin.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

ORDER_HEADER_IN = hdr

convert = 'X'

IMPORTING

SALESDOCUMENT = salesdoc

TABLES

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.

0 Kudos

when iam calling BAPI_SALESORDER_CREATEFROMDAT2 in programe

iam getting error message as

SALES_HEADER_IN has been processed successfully

SALES_ITEM_IN has been processed successfully

Order receipt/delivery not possible, credit customer blocked

what should i do to correct the error and to create sales order.

Former Member
0 Kudos

Hi John,

Pls could you let me know why do we need to fill table (schd_lin-req_qty ) even though without this table also it is storing data correctly. is there any specific reason behind it??

By the way thanks alot for your suggestion.

Pradeep

0 Kudos

It is simply a requirement of the BAPI and the SD module, in general.

The schedule line info is the "true" data that is passed to the delivery doc.

Former Member
0 Kudos

i had got the problem in sales order creatrion