Blog

Microsoft Dynamics AX Blog

2

If you have ever used the General Ledger AIF service of the Microsoft Dynamics AX 2009, you might have noticed the limitation of not integrating other than Ledger transactions. For example, you cannot send Customer and Vendor transactions through that AIF Service.

I came across a requirement where I needed to integrate external Vendor and Bank transactions through AIF. After spending sometime on testing as well as on X++ code tracing… I came to know that Microsoft is putting some restrictions on the code to not to accept the Ledger Journal transactions of types other than Ledger.

The following code is a standard X++ code that was written to prevent such integration.

37
38
39
40
41
42
43
44
45
46
47
48
49
//LedgerJournalTableType (class) -- initializeLedgerJournalName (method) -- Line number 37
/*Commented to disable the Non-Ledger type restriction*/
    if (!true /*this.isJournalNameValidJournalType()*/)
/*Commented to disable the Non-Ledger type restriction*/
    {
        AifFaultContext::setGlobalContextField(tableId, fieldId);
        AifFault::checkFailedLogFault(strfmt("@SYS114718", axLedgerJournalTable.parmJournalName(), axLedgerJournalTable.parmJournalType()), #InvalidJournalNameJournalTypeCombination);
        throw AifFault::faultList("@SYS98197", #ValidationFailed);
    }
/*Initilizing the journal type from the journal name*/
    ledgerJournalTable.JournalType = ledgerJournalName.JournalType;
/**/
}

Also I have changed:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//Amer Atiyah, http://www.amerax.net/
//LedgerJournalTransType (class) -- validateAccountType (method) -- Line Number 1
protected boolean validateAccountType()
{
    boolean         isValid = true;
    ;
 
    switch (ledgerJournalTable.JournalType)
    {
        case LedgerJournalType::Daily :
                /* I had to comment this code to prevent the validation
                if (ledgerJournalTrans.AccountType != LedgerJournalACType::Ledger)
                {
                    if (this.isConsumerStateTracked())
                    {
                        // AX5 service limitation
                        isValid = AifFault::checkFailedLogFault("@SYS117885", #AccountTypeMustBeLedger);
                    }
                }*/
            break;
 
        default :
            break;
    }
 
    return isValid;
}

What I like to mention in here is that Microsoft Dynamics AX 2012 now supports integrating Vendor, Customer, and Bank transactions out-of-the-box. I copied the following code from the LedgerJournalTransType class in Dynamics AX 2012 without doing any changes to it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
protected boolean validateAccountType()
{
	boolean isValid = true;
 
	this.initializeLedgerJournalTable();
 
	switch (ledgerJournalTable.JournalType)
	{
		case LedgerJournalType::Daily :
			if(LedgerJournalTrans.AccountType != LedgerJournalACType::Ledger &&
			   LedgerJournalTrans.AccountType != LedgerJournalACType::Bank &&
			   LedgerJournalTrans.AccountType != LedgerJournalACType::Vend &&
			   LedgerJournalTrans.AccountType != LedgerJournalACType::Cust)
			{
				if(this.isConsumerStateTracked())
				{
					isValid = AifFault::checkFailedLogFault("@SYS117885", #AccountTypeIsNoSupported);
				}
			}
			break;
		default;
			break;
 
	}
 
	return isValid;
}

Dynamics AX 2012 Event

Recent Posts

Tags

Archives

Random Testimonial

  • ~ Shibu Purushothaman, Sr. Programmer at WorleyParsons

    0bd63bf"Working with Amer was a pleasure. He is a true professional with in depth knowledge of Dynamics AX, .Net and other Microsoft Technologies. His professional approach to design, implementation and training made our migration to Axapta easy, and with very little down time. Another quality that I think deserves a special mention is that working with him is a pleasure, not even once did we feel uncomfortable with Axapta even though we were from a .net platform. He took time to attend to our doubts, and made the transition from .net to Axapta a very smooth ride. I highly recommend Amer and cant wait to work with him again."

  • Read more testimonials »