Error adding an item to a sales order

I have created a C# web service suing the Sage 300 objects, and all is working well except when I try to add another line to an existing order I get:

"Order Detail. Attempt to modify a different record than was retrieved." 

This occurs on the code 

oeOD.Update();

ORDUNIQ, ITEM, QTYORDERED, CUSTOMER, LINENUM have been set successfully.

If I send a POST instead of PUT, I get a different error in the same place:

"Internal error.  Order Detail. Operation not allowed."

Anyway around this other than disallowing adding items to orders in the calling app?

  • 0

    Have you changed the .Order of any of the OE views?  What do your view compositions look like?

  • 0 in reply to Django

    The code works for adding an order, but errors when adding to an existing order.

    Composition:

    // Compose the Header and Detail views together.
    oeOH.Compose(new AccpacCOMAPI.AccpacView[] { oeOD, null, oeOHC, oeOHP, oeOHfq, oeOHOpt });
    oeOD.Compose(new AccpacCOMAPI.AccpacView[] { oeOH, oeODOpt, oeODB, oeODK, oeODS, oeODL });
    oeOHP.Compose(new AccpacCOMAPI.AccpacView[] { oeOH });
    oeOHC.Compose(new AccpacCOMAPI.AccpacView[] { oeOH, oeOD });
    oeOHfq.Compose(new AccpacCOMAPI.AccpacView[] { oeOH });
    oeOHOpt.Compose(new AccpacCOMAPI.AccpacView[] { oeOH });
    oeODS.Compose(new AccpacCOMAPI.AccpacView[] { oeOD });
    oeODL.Compose(new AccpacCOMAPI.AccpacView[] { oeOD });
    oeODOpt.Compose(new AccpacCOMAPI.AccpacView[] { oeOD });
    oeODK.Compose(new AccpacCOMAPI.AccpacView[] { oeOD, oeODKS, oeODKL });
    oeODKS.Compose(new AccpacCOMAPI.AccpacView[] { oeODK });
    oeODKL.Compose(new AccpacCOMAPI.AccpacView[] { oeODK });
    oeODB.Compose(new AccpacCOMAPI.AccpacView[] { oeOD });

  • 0 in reply to PhilMcIntosh

    What is your code for updating an existing order?  Specifically what calls are you making that involve oeOD?  How are you navigating to the order detail line view to update it?