cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sales Order Create BAPI

Former Member
0 Likes
37,226

Hi,

I know this question has been asked before but I've searched the forums and have tried all the suggestions and nothing worked.

I'm creating a sales order using BAPI_SALESORDER_CREATEFROMDAT2 populating all the mandatory fields and I get 3 success messages, 1 warning message (saying the data in incomplete) and a Sales Order number at the end.

After finding no error messages I run BAPI_TRANSACTION_COMMIT which comes back with no messages at all in the return table.

But if I go to VA03 to view the sales order I get 'Sales Order xxxx is not available'. Can anyone tell me what I'm doing wrong?

Thanks,

Gill

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi Gill,

Are you executing the BAPI_SALESORDER_CREATEFROMDAT2 and the BAPI_TRANSACTION_COMMIT in the same Logical Unit of Work (LUW)?

ie in one program (if being called from ABAP) do you execute both functions?

Also, another thing that might be happening is that the sales order takes some time to be actually updated to the database (update task has to finish). Have you checked again in 5 or so minutes to see whether the sales order is there?

Brad

Answers (4)

Answers (4)

Former Member
0 Likes

Hi Gill,

Please check user authorization when you call it externally.

VijayasekarK
Active Participant
0 Likes

Hi ,

You can try with 'BAPI_SALESORDER_CREATEFROMDATA'.

We have used the above bapi , for creating SO from bc.

Regards,

Vijay

Former Member
0 Likes

Hello Gill,

Have you created a flow service in Business connector and called the maps for these BAPIs one after another?

Former Member
0 Likes

Could you send us the actual messages, sometimes you get some weird message which is not obvious immediately. Though the error is related to master data not being maintained properly.

Former Member
0 Likes

Hi Gill,

If your are calling BAPI_SALESORDER_CREATEFROMDAT2 in Se37 , you need to call with Test Sequence combing with

Another FM BAPI_TRANSACTION_COMMIT.

If it is in a Report call BAPI_TRANSACTION_COMMIT to commit the work (recommended to have a WAIT flag set).

Regards,

Manohar

Former Member
0 Likes

Thanks for your suggestions. I've found a part solution, I did test the sequence BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_TRANSACTION_COMMIT and this worked from SAP. However I'm need to run both these from Business Connector which still doesn't work. I've created a FM which calls both BAPIs one after the other in the hope that this will solve my problem.

If anyone has had a similar problem or can suggest a solution, anything would be welcome. Thanks.

Former Member
0 Likes

Gill,

When connecting externally, you need to maintain the same session. I'm not sure exactly how this is handled from Business Connector, but its important that your process goes something like:

- Open connection

- ...

- Call sales order BAPI

- Call commit work

- ...

- Close connection

If the connection is maintained you are still operating within one LUW and then the Commit will apply to the call of the sales order BAPI. If the commit is issued via a seperate connection then it will have no effect.

I think it would be fruitfull to dig a little bit further on the Business Connector side on how this can be achieved.

Cheers,

Brad

Former Member
0 Likes

In case someone is still interested ...

Here are the specifics of how the process outlined by Brad Williams works in the BC

- Open connection

> run the function sap:createTID which is inlcuded in the SAP package.

This function returns a transaction ID

- Call sales order BAPI

> Call the BAPI_SALESORDER_CREATEFROMDAT2 and pass the TID retrieved in the previous step along with the call (parameter $tid)

- Call commit work

> If you are successful call BAPI_TRANSACTION_COMMIT, passing along the same TID

- ...

- Close connection

> Done

I created a service consisting of this three step flow (create TID, create sales order, commit). I then was able to expose it as a Web service and had a number of different client applications leverage this service.

Now my quest is to do the same in XI with the RFC adapter, let me know if you have the answer! (mhaines@uwm.edu)

Regards,

Marc

Former Member
0 Likes

Hi Brad,

I am also working on same type of scenario, changing salesorder and calling commit bapi one by one in XI-BPM not in ABAP program. This type call to two bapi's in XI comes under same LUW. Could you throw ur ideas on this?

Thanks,

Yaseen.