‎2006 Feb 23 4:40 AM
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
‎2006 Feb 23 4:54 AM
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.
‎2006 Feb 23 4:55 AM
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.
‎2006 Feb 23 4:57 AM
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.
‎2006 Feb 23 5:06 AM
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
‎2006 Feb 23 7:13 AM
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.
‎2006 Feb 23 7:29 AM
Hi,
there also call the <b>BAPI_TRANSACTION_COMMIT</b>.
after the BAPI Call.
Regards
vijay
‎2006 Feb 23 5:29 PM
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