Question

Create Purchase Receipt via REST Request

  • 25 July 2022
  • 6 replies
  • 189 views

Userlevel 4
Badge +2

Hi, 

Previously my request successfully worked with another acumatica instance for creating purchase receipts, now throws the following error : 

Here is my request : 

URL : https://test.acumatica.com/entity/ARTEndpoint/18.200.001/PurchaseReceipt?$expand=Details&$select=Branch,ReceiptNbr,CurrencyID,Details/InventoryID,Details/POOrderNbr,Details/POOrderType,Details/ReceiptQty,Details/TransactionDescription,Details/UnitCost,Details/UOM,Details/Warehouse

BODY :

{

  "Location": {

    "value": "MAIN"

  },

  "CreateBill": {

    "value": "false"

  },

  "VendorID": {

    "value": "PT"

  },

  "VendorRef": {

    "value": "PP414-kkk"

  },

  "PostPeriod": {

    "value": "11-2022"

  },

  "Details": [

    {

      "POOrderType": {

        "value": "Normal"

      },

      "POOrderNbr": {

        "value": "PO001200"

      },

      "ReceiptQty": {

        "value": "1"

      },

      "POLineNbr": {

        "value": "1"

      }

      

    }

  ]

}

Please suggest how to troubleshoot it

I attached stack of the error 

{

    "message": "An error has occurred.",

    "exceptionMessage": "Operation failed",

    "exceptionType": "PX.Data.PXInvalidOperationException",

    "stackTrace": "   at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext, Boolean throwOnError)\r\n   at PX.Api.ContractBased.Soap.SoapFacadeBase.PutImpl(EntityImpl entity, Boolean throwOnValidationError)\r\n   at PX.Api.ContractBased.SystemContracts.V2.RestController.PutEntity(EntityImpl entity, String select, String filter, String expand, String custom)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()",

    "innerException": {

        "message": "An error has occurred.",

        "exceptionMessage": "Exception has been thrown by the target of an invocation.",

        "exceptionType": "System.Reflection.TargetInvocationException",

        "stackTrace": "   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)\r\n   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)\r\n   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n   at PX.Api.ContractBased.EntityExportContextBuilder.<>c__DisplayClass88_1.<FindImplementations>b__3(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)\r\n   at PX.Api.SyImportProcessor.SyStep.ProcessLocateByNoteIdCommand(SyCommand cmd, SyView view, Boolean invokeCommand)\r\n   at PX.Api.SyImportProcessor.SyStep.ProcessCommand(SyCommand cmd, Boolean& needCommit)\r\n   at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()",

        "innerException": {

            "message": "An error has occurred.",

            "exceptionMessage": "The purchase order line was not found.",

            "exceptionType": "PX.Data.PXException",

            "stackTrace": "   at PX.Objects.DefaultEndpointImpl.PurchaseReceiptDetail_Insert(PXGraph graph, EntityImpl entity, EntityImpl targetEntity)"

        }

    }

}

 


6 replies

Userlevel 7
Badge +4

@Ivan, I see you have POOrderNbr in the Details section, which might not be valid in this instance. Did your replace the POOrderNbr from this instance for which you need to create the Purchase Receipt?

Userlevel 4
Badge +2

@Ivan, I see you have POOrderNbr in the Details section, which might not be valid in this instance. Did your replace the POOrderNbr from this instance for which you need to create the Purchase Receipt?

Hi @vigneshponnusamy89 

Thanks for the response

You mean value of the PO, it’s status or endpoint configuration ?

At endpoint it looks in this way and it worked with previous instance 

I misunderstood the part of POOrderNmb replacement for instance, you mean value or some endpoint configuration ?

Userlevel 7
Badge +4

@Ivan, I meant the value in the request body. Below is the request body and I have highlighted the value you can check.  Is the purchase order number valid?

Request Body:

{

  "Location": {

    "value": "MAIN"

  },

  "CreateBill": {

    "value": "false"

  },

  "VendorID": {

    "value": "PT"

  },

  "VendorRef": {

    "value": "PP414-kkk"

  },

  "PostPeriod": {

    "value": "11-2022"

  },

  "Details": [

    {

      "POOrderType": {

        "value": "Normal"

      },

      "POOrderNbr": {

        "value": "PO001200"

      },

      "ReceiptQty": {

        "value": "1"

      },

      "POLineNbr": {

        "value": "1"

      }

      

    }

  ]

}

Userlevel 4
Badge +2

@Ivan, I meant the value in the request body. Below is the request body and I have highlighted the value you can check.  Is the purchase order number valid?

Request Body:

{

  "Location": {

    "value": "MAIN"

  },

  "CreateBill": {

    "value": "false"

  },

  "VendorID": {

    "value": "PT"

  },

  "VendorRef": {

    "value": "PP414-kkk"

  },

  "PostPeriod": {

    "value": "11-2022"

  },

  "Details": [

    {

      "POOrderType": {

        "value": "Normal"

      },

      "POOrderNbr": {

        "value": "PO001200"

      },

      "ReceiptQty": {

        "value": "1"

      },

      "POLineNbr": {

        "value": "1"

      }

      

    }

  ]

}

Hi @vigneshponnusamy89 

Yes, at least I do not see any problems with it, status is Open

 

Userlevel 4
Badge +2

@Ivan, I see you have POOrderNbr in the Details section, which might not be valid in this instance. Did your replace the POOrderNbr from this instance for which you need to create the Purchase Receipt?

Hi @vigneshponnusamy89 

Any updates

Userlevel 7
Badge

Hi @Ivan - were you ever able to find a solution? Thank you!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved