SSRS Report Error "RunTask: Value cannot be null."

TLDR: SSRS gives me an error of:
RunTask: Value cannot be null.
Parameter name: key

I have a BAQ that is a modified version of the stock BAQ named “zHomepage_APAgedPayables”.

My modified BAQ looks like this:

Show BAQ SQL & Phrase Build
with [APInvSchedLastDueDate] as 
(select 
	[APInvSched].[Company] as [APInvSched_Company],
	[APInvSched].[VendorNum] as [APInvSched_VendorNum],
	[APInvSched].[InvoiceNum] as [APInvSched_InvoiceNum],
	(max( APInvSched.PayDueDate )) as [Calculated_LastPaymentDueDate]
from Erp.APInvSched as APInvSched
group by [APInvSched].[Company],
	[APInvSched].[VendorNum],
	[APInvSched].[InvoiceNum])

select 
	[APInvHed].[Company] as [APInvHed_Company],
	[Vendor].[VendorID] as [Vendor_VendorID],
	[Vendor].[Name] as [Vendor_Name],
	[Vendor].[GroupCode] as [Vendor_GroupCode],
	[VendGrup].[GroupDesc] as [VendGrup_GroupDesc],
	[APInvHed].[InvoiceNum] as [APInvHed_InvoiceNum],
	[APInvHed].[LegalNumber] as [APInvHed_LegalNumber],
	[APInvHed].[PrePayment] as [APInvHed_PrePayment],
	[Country].[Description] as [Country_Description],
	[APInvHed].[InvoiceDate] as [APInvHed_InvoiceDate],
	[APInvHed].[DueDate] as [APInvHed_DueDate],
	[APInvHed].[ApplyDate] as [APInvHed_ApplyDate],
	[APInvSchedLastDueDate].[Calculated_LastPaymentDueDate] as [Calculated_LastPaymentDueDate],
	(CASE
         WHEN DATEDIFF(DAY, APInvSchedLastDueDate.Calculated_LastPaymentDueDate, GETDATE()) < 0 THEN APInvHed.InvoiceBal
         WHEN DATEDIFF(DAY, APInvSchedLastDueDate.Calculated_LastPaymentDueDate, GETDATE()) = 0 THEN APInvHed.InvoiceBal
         ELSE 0
     END) as [Calculated_CURRENT],
	(CASE
         WHEN DATEDIFF(DAY, APInvSchedLastDueDate.Calculated_LastPaymentDueDate, GETDATE()) BETWEEN 1 AND 30 THEN APInvHed.InvoiceBal
         ELSE 0
     END) as [Calculated_Aged_1_30],
	(CASE
         WHEN DATEDIFF(DAY, APInvSchedLastDueDate.Calculated_LastPaymentDueDate, GETDATE()) BETWEEN 31 AND 60 THEN APInvHed.InvoiceBal
         ELSE 0
     END) as [Calculated_Over_30],
	(CASE
         WHEN DATEDIFF(DAY, APInvSchedLastDueDate.Calculated_LastPaymentDueDate, GETDATE()) BETWEEN 61 AND 90 THEN APInvHed.InvoiceBal
         ELSE 0
     END) as [Calculated_Over_60],
	(CASE
         WHEN DATEDIFF(DAY, APInvSchedLastDueDate.Calculated_LastPaymentDueDate, GETDATE()) BETWEEN 91 AND 120 THEN APInvHed.InvoiceBal
         ELSE 0
     END) as [Calculated_Over_90],
	(CASE
         WHEN DATEDIFF(DAY, APInvSchedLastDueDate.Calculated_LastPaymentDueDate, GETDATE()) > 120 THEN APInvHed.InvoiceBal
         ELSE 0
     END) as [Calculated_Over_120],
	[VendCnt].[Name] as [VendCnt_Name],
	[VendCnt].[PhoneNum] as [VendCnt_PhoneNum],
	[APInvHed].[Plant] as [APInvHed_Plant],
	[APInvHed].[Plant_c] as [APInvHed_Plant_c]
from Erp.APSyst as APSyst
inner join Erp.AgingRptFmt as AgingRptFmt on 
	APSyst.Company = AgingRptFmt.Company
	and APSyst.FmtCode = AgingRptFmt.FmtCode
inner join Erp.APInvHed as APInvHed on 
	AgingRptFmt.Company = APInvHed.Company
	and ( APInvHed.OpenPayable = true  and APInvHed.Posted = true  and APInvHed.InvoiceDate <= Constants.Today  and APInvHed.InvoiceBal <> 0  )

inner join Erp.Vendor as Vendor on 
	APInvHed.Company = Vendor.Company
	and APInvHed.VendorNum = Vendor.VendorNum
left outer join Erp.Country as Country on 
	Vendor.Company = Country.Company
	and Vendor.CountryNum = Country.CountryNum
left outer join Erp.VendGrup as VendGrup on 
	Vendor.Company = VendGrup.Company
	and Vendor.GroupCode = VendGrup.GroupCode
left outer join Erp.VendorPP as VendorPP on 
	Vendor.Company = VendorPP.Company
	and Vendor.VendorNum = VendorPP.VendorNum
	and Vendor.PurPoint = VendorPP.PurPoint
left outer join Erp.VendCnt as VendCnt on 
	VendorPP.Company = VendCnt.Company
	and VendorPP.VendorNum = VendCnt.VendorNum
	and VendorPP.PurPoint = VendCnt.PurPoint
	and VendorPP.PrimPCon = VendCnt.ConNum
inner join  APInvSchedLastDueDate  as APInvSchedLastDueDate on 
	APInvSchedLastDueDate.APInvSched_Company = APInvHed.Company
	and APInvSchedLastDueDate.APInvSched_VendorNum = APInvHed.VendorNum
	and APInvSchedLastDueDate.APInvSched_InvoiceNum = APInvHed.InvoiceNum

image

I then tried to create a BAQ Report based off of that BAQ with no filters, no options, no anything. I created a new Report Style under the existing one of APAgng, selected the new Data Definition created by the BAQ Report Designer, added a quick field to display on the RDL for testing, and then tried to Preview the report. It errors out almost instantly and has this error:

Show Error

Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask: Value cannot be null.
Parameter name: key
Stack Trace:
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary2.FindEntry(TKey key) at System.Collections.Generic.Dictionary2.TryGetValue(TKey key, TValue& value)
at Epicor.Utilities.DictionaryExtensions.GetOrAdd[TKey,TValue](IDictionary2 dictionary, TKey key, Func2 valueFactory) in C:_Releases\ICE\ICE3.2.400.0\Source\Shared\Framework\Epicor.ServiceModel\Utilities\DictionaryExtensions.cs:line 24
at Ice.Core.RptBase.ReportDataBuilderBase.XMLDumpTable(IRow row, String rptTableId) in C:_Releases\ICE\ICE3.2.400.22\Source\Server\Internal\Lib\TaskLib\RptBase\ReportDataBuilderBase.cs:line 336
at Erp.Internal.AP.APAgedPayableReport.RunProcess(Int64 instanceTaskNum, String outputFileName) in C:_Releases\ERP\ERP10.2.400.0\Source\Server\Internal\AP\APAgedPayableReport\APAgedPayableReport.cs:line 662
at Ice.Core.TaskBase`1.StartProcess(Int64 instanceTaskNum, String outputFileName) in C:_Releases\ICE\ICE3.2.400.22\Source\Server\Internal\Lib\TaskLib\TaskBase\TaskBase.cs:line 47
at Ice.Hosting.TaskCaller.InnerExecuteTask(IceDataContext newContext) in C:_Releases\ICE\ICE3.2.400.22\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 98
at Ice.Hosting.TaskCaller.ExecuteTask() in C:_Releases\ICE\ICE3.2.400.22\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

Not to be defeated, I went and deleted that BAQ Report, and the RDD it created behind the scenes. I then created an RDD using a different name (just to be safe) and added the BAQ to it.

I went back and deleted the RDL, the Report Style, etc., and recreated all of them and tried to run the new report. The same error happens this way as well.

Looking around on the forums here, I have seen a few others with issues similar to this, but no solutions I have found seem to resolve my issue.

I have made BAQ Reports in the past, and have never had any issues. So I am a bit stumped on this one.

I have a crazy question…
Are you getting results when you run the query on its own?

1 Like

I am. And the results are correct. I can run the BAQ directly in the designer and it returns the expected results, and when I run the SQL directly in SSMS, I also get the expected results.

What’s the criteria on APInvHed? Its not looking for a parameter is it?

It is not looking for any parameters, no. The criteria is for

  • OpenPaytable = True
  • Posted = True
  • InvoiceDate <= Constants.Today
  • InvoiceBal <> 0

1 Like

Did you see the above thread? I was looking through this one…

Per that thread…

It sounds like, even though YOUR BAQ and report doesn’t require parameters, the stock APAging report may have them.

Take a look at the stock APAging .rdl file and see if there are parameters in there. If so, you may need to recreate those.

@jkane may have some other thoughts as he was able to help in the previous example.

I’m thinking if you COPIED the existing APAging report but then reassigned it to your custom RDD… those parameters may come along for the ride.

1 Like

I do not believe you can add a BAQ Report Style to an already existing report because they do not use the same service. As an example, the 1099 report uses ERP:RPT:Prcs1099 and BAQ reports use the dynamic query service (or something like that). Have you tried creating a new Report Style for the BAQ Report and see if that works?

2 Likes

Amazing how I always miss the ground floor of the issue.

So you’re saying you can’t take a stock erp report and use a BAQ-based RDD? Can’t say I’ve ever tried… so, that’s good to know! :+1:

I do not believe so. The service needs to be the same as that is what is calling all of the moving parts.

2 Likes

Much like @dcamlin, I was not aware that you can’t drop a BAQ RDD into a new report style for a stock report.

That was indeed the issue, and my AP Aging Report is now running properly.

Thanks, all!

4 Likes