0
votes

Could anybody help me create a Shipment by adding a Sales Order in Acumatica (Version 4 or higher). I have tried the following code with no success:

SO302000Content SO302000 = context.SO302000GetSchema();
context.SO302000Clear();

Command[] commands = new Command[] {
  new Value { Value = "ABCSTUDIOS", LinkedCommand = SO302000.ShipmentSummary.Customer },
  new Value { Value = "09/01/2015", LinkedCommand = SO302000.ShipmentSummary.ShipmentDate },
  new Value { Value = "MAIN", LinkedCommand = SO302000.ShipmentSummary.Location },
  new Value { Value = "RESALE", LinkedCommand = SO302000.ShipmentSummary.WarehouseID },

  new Value { Value = "SO", LinkedCommand = SO302000.AddSalesOrderOperation.OrderType },
  new Value { Value = "000211", LinkedCommand = SO302000.AddSalesOrderOperation.OrderNbr },
    
  SO302000.AddSalesOrder.InventoryID,
  SO302000.AddSalesOrder.Location,
  SO302000.AddSalesOrder.OpenQty,
  SO302000.AddSalesOrder.OrderQty                
};

var results = context.SO302000Submit(commands);
if (results != null && results.Length > 0)
{
  int line = 0;
  List<Command> cmds = new List<Command>();
  foreach (var row in results)
  {
    cmds.Add(new Value { 
                 Value = line.ToString(), 
                 LinkedCommand = SO302000.AddSalesOrder.ServiceCommands.RowNumber }
            );
    cmds.Add(new Value { 
                 Value = "True", 
                 LinkedCommand = SO302000.AddSalesOrder.Selected, 
                 Commit = true }
            );
    line++;
  }

  cmds.Add(SO302000.Actions.AddSO);
  context.SO302000Submit(cmds.ToArray());                

  cmds.Clear();                
  cmds.Add(SO302000.Actions.Save);
  cmds.Add(SO302000.Actions.ActionConfirmShipment);                
  results = context.SO302000Submit(cmds.ToArray());                
}

The result is an error from Acumatica saying something like "View AddSOFilter Doesn't Exist" as described below:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> PX.Data.PXException: Error #97: View addsofilter doesn't exist. at PX.Data.PXViewCollection.get_Item(String key) in c:\Builders\4_10-2013_12_2-4_0_9-Auto\Scripts\BuildTemp\NetTools\PX.Data\Graph\Collection.cs:line 806 at PX.Api.SyImportProcessor.SyStep.SelectRows(String viewName, PXFilterRow[] filters, Int32 topCount, Boolean bypassInserted) in c:\Builders\4_10-2013_12_2-4_0_9-Auto\Scripts\BuildTemp\NetTools\PX.Data\Api\Export\SyImport\ImportProcessor.cs:line 2521 at PX.Api.SyImportProcessor.ExportTableHelper.a(SyStep A_0, GrowingTable A_1, SyCommand A_2, PXFilterRow[] A_3, Int32 A_4) in c:\Builders\4_10-2013_12_2-4_0_9-Auto\Scripts\BuildTemp\NetTools\PX.Data\Api\Export\SyImport\ImportProcessor.cs:line 1212 at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable() in c:\Builders\4_10-2013_12_2-4_0_9-Auto\Scripts\BuildTemp\NetTools\PX.Data\Api\Export\SyImport\ImportProcessor.cs:line 675 at ScreenApi.ScreenGate.Submit(Command[] commands, SchemaMode schemaMode, PXGraph graph) in c:\Builders\4_10-2013_12_2-4_0_9-Auto\Scripts\BuildTemp\NetTools\PX.Data\Api\Export\ScreenGate.cs:line 1323 at ScreenApi.ScreenGate.Submit(Command[] commands) in c:\Builders\4_10-2013_12_2-4_0_9-Auto\Scripts\BuildTemp\NetTools\PX.Data\Api\Export\ScreenGate.cs:line 1027 --- End of inner exception stack trace ---

Thanks, G

1
Can you post the exact error you're getting? - Reinstate Monica
I have now included the error message in the question (as it was too long for a comment) :P - GaGa

1 Answers

0
votes

try next one example

            SO302000Content SO302000 = context.SO302000GetSchema();
        context.SO302000Clear();

        SO302000.Actions.AddSO.Commit = true;
        //SO302000.AddSalesOrder.Selected.LinkedCommand = null;
        //SO302000.DocumentDetails.InventoryID.LinkedCommand = null;

        var result2 = context.SO302000Submit(new Command[]
            {
                new Value { Value = "000332", LinkedCommand = SO302000.ShipmentSummary.ShipmentNbr }, //navigate

                new Value { Value = "SO", LinkedCommand = SO302000.AddSalesOrderOperation.OrderType },                    
                new Value { Value = "000531", LinkedCommand = SO302000.AddSalesOrderOperation.OrderNbr, Commit = true  },                      

                new Value { Value = "OK", LinkedCommand = SO302000.AddSalesOrderOperation.ServiceCommands.DialogAnswer, Commit = true },
                new Value { Value = "OK", LinkedCommand = SO302000.AddSalesOrder.ServiceCommands.DialogAnswer, Commit = true },
                new Key { Value = "='CPU00004'", FieldName = SO302000.AddSalesOrder.InventoryID.FieldName, ObjectName = SO302000.AddSalesOrder.InventoryID.ObjectName },                    
                new Value { Value = "True", LinkedCommand = SO302000.AddSalesOrder.Selected, Commit = true },                    
                SO302000.Actions.AddSO,                     
                SO302000.Actions.Save
            });