I have this problem n hope someone came across such one...
We are using CRM 5.0, IC. we have a custom FM for all the calls to be diverted and to maintain order as a wrapper and the steps to the problem as follows -
1) create a sales order - each event triggers this custom FM we created
2) when the event is SAVE - the order is maintained (also order save is called) and commited...
3) after commiting a xml is generated and the saved data is sent over to another third party system.
4) upon successful sent - we generate a third party's order number which is a combination of CRM sales order number
5) this is maintained in External Reference field using the CRM_SALES_MAINTAIN_OW
6) CRM_OREDR_SAVE is called and transaction is commited. - but the value is not maintained.....
during the 5th step i get a dump in the system - SAPSQL_ARRAY_INSERT_DUPREC.
All these steps are done in one single call to SAVE the order from the interface.