AP - Invoice Posting Error

Hello,

Anyone able to help me with this error?

Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Nullable object must have a value.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at Erp.Internal.Lib.IntrastatFunc.UpdateAPIStatTran(IStatTrn& IStatTrn, APInvDtl APInvDtl, APInvHed APInvHed, Boolean isGermanyLocalization, String defISRegion) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\Lib\IntrastatFunc\IntrastatFunc.cs:line 125
   at Erp.Internal.PE.AP_InvoicePost_Post.CreateIStatTran(Boolean& bIStatTrnExists) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\AP_Invoice\AP_InvoicePost_Post.cs:line 665
   at Erp.Internal.PE.AP_InvoicePost_Post.UpdateRelatedTables(String inAbtUID) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\AP_Invoice\AP_InvoicePost_Post.cs:line 2913
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at Erp.Internal.PE.ReviewJournal.ConfirmGL(String inABTUID, PostingMode inMode) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\ReviewJournal\ReviewJournal.cs:line 2812
   at Erp.Internal.PE.PostBase.Post() in C:\_Releases\ERP\ERP10.2.400.0\Source\Server\Internal\PE\PostBase\PostBase.cs:line 224
Stack Trace:
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Erp.Internal.PE.PEError.ProcessExceptionList(PostingStage peStage, Exception ex, Boolean suppressRethrow) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\PEData\PEError.cs:line 269
   at Erp.Internal.PE.PostBase.Post() in C:\_Releases\ERP\ERP10.2.400.0\Source\Server\Internal\PE\PostBase\PostBase.cs:line 228
   at Erp.Internal.PE.PEABT.Post() in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\PEABT\PEABT.cs:line 283
   at Erp.Internal.PE.AP_InvoicePre_Post.Post() in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\AP_Invoice\AP_InvoicePre_Post.cs:line 377
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Erp.Internal.PE.Pre_PostBase._RunProcess(Int64 instance_TaskNum, String groupID, PostingMode mode, Boolean skipPEDataInit) in C:\_Releases\ERP\ERP10.2.400.0\Source\Server\Internal\PE\Pre_PostBase\Pre_PostBase.cs:line 148
   at Erp.Internal.PE.AP_InvoicePre_Post.Pre_Post(Int64 instance_TaskNum, String groupID, PostingMode mode) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\AP_Invoice\AP_InvoicePre_Post.cs:line 324   at Ice.Hosting.TaskCaller.InnerExecuteTask(IceDataContext newContext) in C:\_Releases\ICE\ICE3.2.400.38\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 114
   at Ice.Hosting.TaskCaller.ExecuteTask() in C:\_Releases\ICE\ICE3.2.400.38\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 57
   at Ice.Lib.RunTask.BpmFriendlyTaskLauncher.Run(String sessionIdPrefix, IceContext db, Action taskRunner) in C:\_Releases\ICE\ICE3.2.400.0\Source\Server\Services\Lib\RunTask\BpmFriendlyTaskLauncher.cs:line 63
   at Ice.Services.Lib.RunTaskSvc.InnerRunTask(Int64 ipTaskNum, Boolean suppressTransaction) in C:\_Releases\ICE\ICE3.2.400.0\Source\Server\Services\Lib\RunTask\RunTask.cs:line 592
Inner Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Nullable object must have a value.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at Erp.Internal.Lib.IntrastatFunc.UpdateAPIStatTran(IStatTrn& IStatTrn, APInvDtl APInvDtl, APInvHed APInvHed, Boolean isGermanyLocalization, String defISRegion) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\Lib\IntrastatFunc\IntrastatFunc.cs:line 125
   at Erp.Internal.PE.AP_InvoicePost_Post.CreateIStatTran(Boolean& bIStatTrnExists) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\AP_Invoice\AP_InvoicePost_Post.cs:line 665
   at Erp.Internal.PE.AP_InvoicePost_Post.UpdateRelatedTables(String inAbtUID) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\AP_Invoice\AP_InvoicePost_Post.cs:line 2913
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at Erp.Internal.PE.ReviewJournal.ConfirmGL(String inABTUID, PostingMode inMode) in C:\_Releases\ERP\UD10.2.400.38\Source\Server\Internal\PE\ReviewJournal\ReviewJournal.cs:line 2812
   at Erp.Internal.PE.PostBase.Post() in C:\_Releases\ERP\ERP10.2.400.0\Source\Server\Internal\PE\PostBase\PostBase.cs:line 224
Stack Trace:

Kind regards,
Aaron.

This one is odd, based on the code it looks like data corruption.

The system finds a receipt header for this invoice line with ReceiptDate null.

Try to confirm it using below sql query or using an equivalent BAQ, the values come from the Invoice Line trying to be processed by Intrastat logic.
select ReceiptDate, * from Erp.RcvHead where Company = <Company> and VendorNum = <VendorNum> and PurPoint = <PurPoint> and PackSlip = <PackSlip>

1 Like

Hi Jonathan,

It seems there is one without a ReceiptDate.

How would we go about resolving this?

Resolved it.

Just received that packing slip number