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: 
Read only

problem for bapi: BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Likes
2,456

Hi all,

when creating sales order via BAPI_SALESORDER_CREATEFROMDAT2 in the testing mode,

it returns a sales order no successfully.

But when a veiw it via VA03, the system says that this sales order doesn't exist.

What's wrong? Thanks

7 REPLIES 7
Read only

Former Member
1,312

You cannot do a single test from SE37 for this BAPI as it requires a commit. You will have to do this using the feature 'Test Sequence' in SE37. In the initial screen of SE37, enter 'BAPI_SALESORDER_CREATEFROMDAT2' and then in the menu, 'Function Module-->Test Sequences'. In the pop-up, enter 'BAPI_SALESORDER_CREATEFROMDAT2' in the first line, and then enter 'BAPI_TRANSACTION_COMMIT' in the second. Then Execute and follow the test. It will bring the 'BAPI_SALESORDER_CREATEFROMDAT2' first for testing. Enter test data, execute and then it will bring the next function module. Execute that and your sales order will be saved.

Read only

Former Member
0 Likes
1,312

Macy,

The Sales order will not get generated when you execute the BAPI in testing mode. It will only tell you whether processing will go through fine or not. Although it returns a order number, the order is never created.

However, if you take out the testing mode, you should be able to see the order in VA03.

Regards,

Ravi

Note : Reward the posts that help you.

Read only

Former Member
0 Likes
1,312

u need to use

You have to call the bapi BAPI_TRANSACTION_COMMIT after the first bapi is succesful or BAPI_TRANSACTION_ROLLBACK for not success.

Read only

Former Member
0 Likes
1,312

Hi Macy,

The Sales order will not be saved in the database till the time you call the bapi from an ABAP Program.

Also you have call the FM BAPI_TRANSACTION_COMMIT after the calling the BAPI BAPI_SALESORDER_CREATEFROMDAT2.

If you are simply testing the BAPI from SE37, no Sales Order will be saved in the database tables and hence will not be seen in VA03. Testing BAPI from se37 is simply a simulation of the sales order.

So create a test program, call the bapi

BAPI_SALESORDER_CREATEFROMDAT2.. pass all the required data.

Then if sy-subrc = 0

call FM BAPI_TRANSACTION_COMMIT....

It will work...

Lokesh

Pls. reward appropriate points

Read only

0 Likes
1,312

Thanks all for your help.

It works when I test with the bapi_transaction_commit in R/3.

But could I call it via my VB after calling the BAPI_SALESORDER_CREATEFROMDAT2?

it gives me error in the VB program:

Additional information: Method SAPProxy1.Bapi_Transaction_Commit can not be reflected.

Read only

0 Likes
1,312

Hi,

there also call the <b>BAPI_TRANSACTION_COMMIT</b>.

after the BAPI Call.

Regards

vijay

Read only

0 Likes
1,312

Ok, that is something else. RFC connections are tricky in that they open new tasks whenever you go back and forth unless you put everything in a single call.

So, you may have to combine the two calls into one LUW. Then it will work.

Srinivas