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

Update terminate during return sales order creation (Delivery processing)

roger_colaco2
Explorer
0 Likes
2,473

Hi,

I have having issues with a scenario while creating delivery in a 4.7 system. When creating a return order (using FM SD_SALESDOCUMENT_CREATE) our system is configured to automatically generate deliveries for the return SO.

The scenario we are facing an issue in is, during data processing, a delivery is created using FM W_FRM_DELIVERY_CREATE_GENERAL, delivery is then processed for picking and PGI using FM WS_DELIVERY_UPDATE.

For the next record, a return order is created using FM SD_SALESDOCUMENT_CREATE, which also automatically tries to create the delivery. At this point we get an update terminate upon COMMIT and dump says SAPSQL_ARRAY_INSERT_DUPREC pointing towards form VBFA_BEARBEITEN.

Based on my analysis, while updating table VBFA the internal table DA_XVBFAI also has document flow for the previously processed regular sales order for which the system tries to insert a record in VBFA. This is a duplicate record and the update is terminated. The buffer nees to be refreshed and I tried using FM SHP_DELIVERY_BUFFER_REFRESH and LE_DELIVERY_REFRESH_BUFFER. None of these seem to refresh the VBFA buffer.

I would appreciate if anyone can share their experience with this issue. Thanks for your help!

-Roger

7 REPLIES 7
Read only

jaideepsharma
Active Contributor
0 Likes
1,630

Hi,

Try using one of these function modules BUTX_FRG0010_CLEAR_BUFFER or CK_F_SHARED_BUFFER_DELETE or COM_IL_DB_RESET_BUFFER or SNC_USER_FLUSH_BUFFER .

KR Jaideep,

Read only

0 Likes
1,630

I checked these functions and none of these refresh the delivery buffer.

Read only

roger_colaco2
Explorer
1,630

This issue was resolved by calling function RV_DELIVERY_INIT

Read only

0 Likes
1,630

May I know how you used this fm as right now we also encountered the problem of SAPSQL_ARRAY_INSERT_DUPREC during the delivery processing.

Thank you.

Read only

0 Likes
1,630

Hi Roger, you resolved my question, thanks very much

Read only

0 Likes
1,630

This suggestion solve my problem too. I used FM BAPI_CUSTOMERRETURN_CREATE to create Sales Document and Delivery, But I was getting an error because delivery is saved in update tasking. I have tried a lot of solution and FM. But this one solved my problem. Tks.

Read only

Manuel_Hurtado
Discoverer
0 Likes
1,630

Me too, solved with RV_DELIVERY_INI just before of call bapi.