Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Intercompany GL journal uploads via X++

$
0
0

background:  AX 2012 CU3

I could use some advice as to next steps in troubleshooting this problem:  We have a custom GL journal upload written in X++ that processes an Excel or CSV file.  The accounting team wants to perform intercompany transaction uploads via a single batch.

When the user opens the ax client, they pick the legal entity (company), then launch the custom GL transaction upload.  When the AX client current company is the same as found in the CSV file, then the transactions with the same company are uploaded correctly.  If the company from the transaction in the file is different, then the upload may not capture all of the dimensions associated with the account in that transaction.  The upload finishes fine, but the journal will not validate.

Example:

User opens AX client and sets company to ABC (source).  Then the user uploads batch transactions and one of the transactions is an intercompany transaction to XYZ (destination).  The account in XYZ has 2 dimensions - Location and XYZ_Project with LC001 and XY0039 values respectively.  The transaction for XYZ loads successfully but strips off the Location dimension.

What we should see in the journal after upload - 15789 - LC001 - XY0039

What we really see in the journal - 15789 - XY0039.  No Location dimension.  

Validation raises this error:

"The combination 15789-XY0039 cannot be loaded because the Leasing chart of accounts has been updated and the combination is not valid for any account structures in this chart of accounts."

To add confusion, I can create a manual journal entry and it accepts the account configuration of the destination company without error.

Here is a section of the upload X++ code performing the journal line insert:

public void ProcessJournalLine(container header, container record)

{

   real                            amount;

   LedgerAccountContract           ledgerAccountContract;

   DimensionStorage                dimensionStorage;

   DimensionAttributeValueContract attributeValueContract;

   MainAccountNum                  mainAccount;

   _LedgerJournalTrans.clear();

   _LedgerJournalTrans.initValue();

   _LedgerJournalTrans.JournalNum = _LedgerJournalTable.JournalNum;

   _LedgerJournalTrans.Company = 'XYZ';

   _LedgerJournalTrans.AccountType = LedgerJournalACType::Ledger;

   if (mainAccount::findByMainAccountId('15789').RecId > 0)

   {

       ledgerAccountContract = new LedgerAccountContract();

       ledgerAccountContract.parmValues(new List(Types::Class));

       ledgerAccountContract.parmMainAccount('15789');

       // Location dimension

       attributeValueContract = new DimensionAttributeValueContract();

       attributeValueContract.parmName('Location');

       attributeValueContract.parmValue('LC001');

       ledgerAccountContract.parmValues().addEnd(attributeValueContract);

       // XYZ_Project dimension

       attributeValueContract = new DimensionAttributeValueContract();

       attributeValueContract.parmName('XYZ_Project');

       attributeValueContract.parmValue('XY0039');

       ledgerAccountContract.parmValues().addEnd(attributeValueContract);

       dimensionStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(ledgerAccountContract);

       _LedgerJournalTrans.parmLedgerDimension(dimensionStorage.save());

   }

   else

   {

       info("Main Account Id 15789 is Not available");

   }

   _LedgerJournalTrans.Txt = conPeek(record,5);

   _LedgerJournalTrans.TransDate = str2Date(conPeek(record,3),213);

   amount = conPeek(record,6);

   if (amount < 0.0)

   {

       amount = abs(amount);

       _LedgerJournalTrans.AmountCurDebit = 0;

       _LedgerJournalTrans.AmountCurCredit = amount;

   }

   else

   {

       _LedgerJournalTrans.AmountCurDebit = amount;

       _LedgerJournalTrans.AmountCurCredit = 0;

   }

   _LedgerJournalTrans.CurrencyCode = 'USD';

   _LedgerJournalTrans.Voucher = _voucher;

   if (_LedgerJournalTrans.AmountCurDebit == 0 && _LedgerJournalTrans.AmountCurCredit == 0) {

       info("Record skipped due to zero amounts");

   } else {

       _LedgerJournalTrans.insert();

   }

}


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>