Thursday, January 18, 2018

Ledger account is not among accounts in account group

In working with my customer, I found that they were needing to do a VAT adjustment for a customer invoice that shouldn't have charged VAT.  They were able to credit the customer, but didn't really do it the right way.

Here is how I achieved the adjustment via General Journal.

Here is the scenario:

1. Customer was invoiced and charged VAT on the invoice.
2. Customer should not have been charged VAT and therefore needed a credit of the VAT amount.
3. Due to the situation they were in at the time (Long store... ...), they created a Journal to get that credit to the customer.
4. The journal went from the 'Customer' to an offset account.  This is some sort of holding account. (NON VAT account).
5. Now, we are trying to create a journal that will move the refund from that holding account into the proper VAT account.
6. When adding in the 'VAT COde' on the 'General' tab, we get the following error:
Ledger account [holding account] is not among the accounts in account group [Ledger Posting Group] that are used for VAT code [VAT Code]
This was true as my 'holding account' was not part of my Ledger Posting Profile under VAT in GL.
However, it still didn't  make sense.  To get this to work I had to:
1. Make the 'Account' in the journal line be the VAT account
2. Make the 'Offset account' in the journal line be the non-VAT 'holding account'.
3. Set my amount as a debit.
4. Set my VAT code.
5. POST!

Worked great!

Wednesday, January 17, 2018

Cannot execute a data definition language command on

While posting a timesheet, one of my users received the following error:

Cannot execute a data definition language command on Source document line (SourceDocumentLineTmpJournalize). Reference table ID: 0, None.
The record already exists.

INSERT INTO tempdb."DBO".t101281_3FFE3B67AFC840C6A35FBD063AF9DA46 (ISFINAL,TYPEENUMNAME,TYPEENUMVALUE,STATUS,SOURCEDOCUMENTHEADER,PARENTSOURCEDOCUMENTLINE,SOURCERELATIONTYPE,EXCHANGERATEDATE,SOURCEDOCUMENTLINE,ACCOUNTINGDATE,RECVERSION,PARTITION) SELECT T1.ISFINAL,T1.TYPEENUMNAME,T1.TYPEENUMVALUE,T1.ACCOUNTINGSTATUS,T1.SOURCEDOCUMENTHEADER,T1.PARENTSOURCEDOCUMENTLINE,T1.SOURCERELATIONTYPE,T1.EXCHANGERATEDATE,T1.RECID,T2.ACCOUNTINGDATE,1,5637144576 FROM SOURCEDOCUMENTLINE T1 CROSS JOIN tempdb."DBO".t100010_A652A6A3D1EF4EE9A039F442E3BCEC58 T2 WHERE ((T1.PARTITION=5637144576) AND (T1.SOURCEDOCUMENTHEADER=5638078273)) AND ((T2.PARTITION=5637144576) AND (T2.SOURCEDOCUMENTLINE=T1.RECID))

Very interesting error.  Based on this blog post, it seems an AOS restart may fix the issue.  I will try it here shortly...

UPDATE:
AOS Restart did not fix the issue.... Continuing on...

UPDATE:
Not sure why, but creating a new time sheet did the trick.  Posted perfectly.

Friday, December 29, 2017

Illegal entry in an array.

I have an issue that is returning a very strange error from Enterprise Portal.
Initially I receive the following in my browser:

An unhandled error has occurred. To view details about this error, enable debugging in the web.config file or view the Windows event logs.

Upon checking the event viewer on the EP IIS machine, I see the following:

An unhandled error has occurred. To view details about this error, enable debugging in the web.config file or view the Windows event logs.

Error executing code: Illegal entry in an array.

Stack trace

(C)\Data Dictionary\Tables\myTable\Methods\label - line 34


Microsoft.Dynamics.AX.ManagedInterop

   at Microsoft.Dynamics.AX.ManagedInterop.Record.CallWithReturnType(String methodName, Type returnType, Object[] paramList)
   at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsRecordAdapter.Call(String methodName, Object param1)

As of this writing, I have no idea what 'Illegal entry in an array' means.

Stay tuned...

UPDATE
Temporary Solution:
Well, I couldn't find a good solution for this. So here is the work around.
Original code throwing the error:

return mytable.myFieldArray[_arrayIndex];

Instead I do:

switch (_arrayIndex)
    {
        case 1:
            retValue = this.AttrFieldLabel[1];
            break;
        case 2:
            retValue = this.AttrFieldLabel[2];
            break;
        case 3:
            retValue = this.AttrFieldLabel[3];
            break;
        case 4:
            retValue = this.AttrFieldLabel[4];
            break;
    }

return retValue;

Hardcoding the index numbers on the array call seems to have solved my issue for now.

Happy coding!

Friday, December 15, 2017

SSRS Reports don't show labels

SSRS Reports aren't showing labels. Only Labels!@SYSxxxxx

This suddenly showed up after a code move.  It was preceded by an 'XppBridgeException' when running a single report (Print Invoice Journal).  There are a few posts out there with potential solutions such as checking your reporting service account password.  Our password never changes so there is no issue there.
I tried restarting the AOS.  Didn't work.  Cleared all cache.  Didn't work. Deployed all reports.  Didn't work.

Solution, hopefully, forthcoming...

Solution:

A Full CIL and reboot of our AOS servers and our SQL server has solved this problem.

Monday, November 6, 2017

Determine if code is running in Batch

Recently I was tasked with fixing an issue where our Project invoice proposals were not posting while in batch. 
I discovered that 'WinAPI' was being called in some custom code and was able to fix it.
However, I also realized that the custom code that was being used need to be called in Batch ONLY.  Due to some issues with Citrix and the AX Client, I had to prevent the AX Client from running this code.

This proved to be difficult as I was about 4 classes deep into Proposal posting and the isRunningBatch() method isn't available. (Or at least I couldn't find a way to get back to the 'RunBaseBatch' class).

So, I found a quick little solution that appears to be working:

xSession xSession = new xSession();
xSession.AOSName();

Whereas our batch server is never used for the client, I can just check the the AOSName against my batch server name and run code if they match.

Probably not the best solution, but it seems to work.

Thursday, October 5, 2017

A call to SPPI failed, see inner exception.

Out of nowhere we started receiving the following error on our EP/Sharepoint server.  It didn't seem to coincide with any events such as Windows Updates, code deployment, etc.

After searching, I found the the .axc files that EP and SSRS were using had been updated the day before this error showed up.  Not sure who or what updated them but it appeared they had their WCF Regenerated, only incorrectly.

I had the original .axc files so we simply replaced the bad ones with the known working versions, rebooted the EP and SSRS servers, and everything has worked great since!

I suspect we could have also done the 'Refresh' from the Config utility and that would have also worked.

A call to SSPI failed, see inner exception.
Microsoft.Dynamics.AX.Framework.Services.Client.UserSessionServiceException
at Microsoft.Dynamics.AX.Framework.Services.Client.ServiceClientHelper.InvokeChannelOperation[TResult,TChannel](IServiceClient`1 client, Func`2 operationInvoker, Func`2 exceptionWrapper)
at Microsoft.Dynamics.AX.Framework.Services.Client.UserSessionClient.GetAccessRights(IEnumerable`1 keys)
at Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts.ReportMenuItemHelper.HasAccess(MenuItemKey menuItemKey)
at Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts.AxReportViewerInternal.HasAccessToOutputMenuItemIfRequired()
at Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts.AxReportViewerInternal.CanPreRender()
at Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts.AxReportViewerInternal.OnPreRender(EventArgs e)
A call to SSPI failed, see inner exception.
System.ServiceModel.Security.SecurityNegotiationException
Server stack trace: 
at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.OnInitiateUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity)
at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorBase.InitiateUpgrade(Stream stream)
at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection& connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Thursday, September 21, 2017

SSRS Error 'Report schema already contains a dataset with name"'

While working on the PSAProjInvoice report, I suddenly received this error.  Literally... I generated one report, then generated another 5 minutes later and the error showed up.

So far, all the suggestions here haven't worked.

Looks like the only way I could get out of this mess was to export out older versions of the Report and DP and import them into my dev.  Make sure you export our your DEV versions so you have all the code changes and report design changes.  Then import the old versions and it should be good to go!