cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to update Sales Order.

Former Member
0 Kudos

Dear All,

I wanted to edit a sales Order By Deleting its Item, Schedule, basic Price Details And reinserting the same.

I had written a program for that but it gives me an error while commiting the insert.

Hence I am trying to simulate the same by running the BAPI_SALESORDER_CHANGE.

I made a test sequence of the below to maintain the transaction in a single LUW

1.BAPI_SALESORDER_CHANGE-For Deletion

I am filling the OrderHeaderInx, OrderLineItems, OrderLineItemsX, ScdeduleLines,ScdeduleLinesX with UpdateFlag = D

2.BAPI_TRANSACTION_COMMIT-For Commitng the Delete

I am filling Wait=X

3.BAPI_SALESORDER_CHANGE-For Insert

I am filling the OrderHeaderInx, OrderLineItems, OrderLineItemsX, ScdeduleLines,ScdeduleLinesX, condtypes, condtypesX with UpdateFlag = I

4.BAPI_TRANSACTION_COMMIT-For Commitng the Insert

I am filling Wait

Everything works fine but at step 4, I get error 150 in the return structure of BAPI_TRANSACTION_COMMIT.

(Updating could not be completed)

Also the server puts a Message 'Updating was terminated ' in the inbox.

what could be the reason?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi All,

Thanx for ur help and support.Actually the problem was with a user exit code which had a Modify vbap statement because of which it updation took place in a separate LUW and after commit the same row was getting added.

Thanx for the support.This Forum is the best I have ever encountered.Keep it up guys.

Jamie_Costa
Discoverer
0 Kudos

Hi Samson,

Can you tell me the name of the user-exit, because occurs me the same error. And i need to see the user-exit.

Thanks

Jamie Costa

Former Member
0 Kudos

Hi Samson,

When you get the update error can you find any update records (transaction SM13)?

Kind regards,

John.

Former Member
0 Kudos

Hi John,

Thanx for the reply,

Actually I checked SM13 and it shows that the error occurs in RV_SALES_DOCUMENT_UPDATE.

Now I also checked each table(VBAK,VBAP,VBEP,KONV).Assume the table has an Entry for SO xxx .I will show u the sequence,

1.BAPI_SALESORDER_CHANGE-For Deletion

<b>No Change</b>

2.BAPI_TRANSACTION_COMMIT-For Commitng the Delete

<b>VBAK-Netamount becomes 0

VBAP-Items are Deleted

VBEP-Schdule lines are Deleted

KONV-Cond Types Deleted.</b>

3.BAPI_SALESORDER_CHANGE-For Insert

<b>VBAK-Netamount remains 0

VBAP-Items are Added

VBEP-Blank

KONV-Blank</b>

4.BAPI_TRANSACTION_COMMIT-For Commitng the Insert

<b>Error-Updatin terminated.</b>

The Problem is the insertion of VBAP DAta before Commit Transaction and the VBEP,KONV Data remaining Blank.

The same program is running correctly in a different server.Its sequence is,

1.BAPI_SALESORDER_CHANGE-For Deletion

<b>No Change</b>

2.BAPI_TRANSACTION_COMMIT-For Commitng the Delete

<b>VBAK-Netamount becomes 0

VBAP-Items are Deleted

VBEP-Schdule lined are Deleted

KONV-Cond Types Deleted.</b>

3.BAPI_SALESORDER_CHANGE-For Insert

<b>VBAK-Netamount remains 0

VBAP-Blnak

VBEP-Blank

KONV-Blank</b>

4.BAPI_TRANSACTION_COMMIT-For Commitng the Insert

<b>VBAK-Netamount changes appropriately

VBAP-Items are Added

VBEP-Schedules are Added

KONV-Condition TYpes are Added

Blank</b>

Please help me out urgently.I am pretty new to ABAP.My email ID is samson.m@cvsit.com.

Thanx in advance.

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Samson,

glad to here, at a specific server your program runs successfully.

What's exactly the error in SM13? You might have a dump (ST22), too.

Regards,

Christian

Former Member
0 Kudos

Hi Christian,

As per your suggestion I checked the ST22 Transaction.There I found the short Dump for SAPSQL_ARRAY_INSERT_DUPREC. As I said When I Add New Data using BAPI_SALESORDER_CHANGE it inserts the row in VBAP before the Commit Work is called using BAPI_TRANSACTION_COMMIT.I guess When I actually call BAPI_TRANSACTION_COMMIT It tries to again insert the same record in VBAP because the Error has occured at the SQL Command INSERT VBAP FROM TABLE DA_XVBAPI in LV45UFOV.I am not sure what the Problem might be.

Thanx in advance,

Former Member
0 Kudos

There are 2 ways to do the commit.

Make sure you set the flag to commit and wait on your commit after delete.

This means you will not get control before the commit is actually processed. Thus you will avoid sending an update with the same key before the key has effectively been deleted....

If this should not be the case make sure your internal table being passed has a unique key combination for each row. As you have seen the system does not care for dupplicates...

Addendum

As for the delete did you check to make sure the entries in the tables have been deleted? I seem to remember that some bapis require an additional table to be filled that show which fields have been changed on the record...

Enjoy