web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Getting JE validation warning "account structure management ........"

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

I am trying to create JE line items for company B & C in journal created in company A.

My x++ code creates the line item with the required dimensions/account combination, however when i validate the journal i get below warning message.

What is weird is that when i select the problematic line item & merely re-enter the same values for account combinations  for which it was throwing the warning, the warning goes away .

Also when i change my code to create the same JE line items but in company A instead of B & C i get no validation warnings.

 Apparently i may to have  to  se crosscompany , but unable to figure out how to use cross company in my code as i am just inserting the values directly into ledgerjournaltrans without using select/while select.

and also not sure if that would fix this issue because i can see JE line items created with expected account combination in expected companies ,i.e company B & company C. 

Please suggest a solution so that i am able to create JE line items in company B & C for journal created in company A with no validation warnings.

pastedimage1603130306385v1.png

Thanks

Mav

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Mav,

    Could you please share the code you are using to create the entries?

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi Mav,

    Are the accounts that you want to post included in the account structure 'Management'?

    Best regards,

    Ludwig

  • Mav Profile Picture
    on at

    Thanks for replying

    @Gunjan

    public createJE(_CreateJEDC,_voucher,_CreateJETmp)
    {
    
            ledgerJournalTrans.LedgerDimension   = this.getLedgerDimension(dim1,dim2,dim3);
            ledgerJournalTrans.TransDate         = _CreateJEDC.TransactionDate();
            ledgerJournalName = LedgerJournalName::find(_ledgerJournalTable.JournalName);
            ledgerJournalTrans.Voucher = _voucher;
            ledgerJournalTrans.JournalNum = ledgerJournalId;
            ledgerJournalTrans.LineNum = LedgerJournalTrans::lastLineNum(ledgerJournalId)   1;
            ledgerJournalTrans.CurrencyCode = _CreateJEDC.TransactionCurrencyCode();
            ledgerJournalTrans.Txt = _CreateJETmp.desc;
            ledgerJournalTrans.Company = _CreateJETmp.LegalEntityDimVal;
            ledgerJournalTrans.BankDepositVoucher = NoYes::No;
            ledgerJournalTrans.ReverseEntry = NoYes::No;
            
            ttsbegin;
            ledgerJournalTrans.insert()
            ttscommit;
    }
            

    @lDr Ludwig

    Yes,  the configuration states that it should show all accounts with value greater than 000000

    pastedimage1603134332760v1.png

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Mav.

    Please share the code for the method - "getLedgerDimension" as well.

  • Mav Profile Picture
    on at

    Sure, here is the code.

    public RecId getLedgerDimension(Mainaccount _mainaccount, str dim1,dim2,dim3)
     {
    
       DimensionServiceProvider              DimensionServiceProvider = new DimensionServiceProvider();
       LedgerAccountContract                LedgerAccountContract = new LedgerAccountContract();
       DimensionAttributeValueContract         ValueContract;
       List                                    ListValueContract = new List(Types::Class);
       dimensionAttributeValueCombination     dimensionAttributeValueCombination;
       DimensionStorage                      dimStorage;
    
    
       if (dim1)
       {
         ValueContract = new DimensionAttributeValueContract();
         ValueContract.parmName('dim1') ;
         ValueContract.parmValue(dim1);
         ListValueContract.addEnd(ValueContract);
       }
    
       if (dim2)
       {
         ValueContract = new DimensionAttributeValueContract();
         ValueContract.parmName('dim2') ;
         ValueContract.parmValue(dim2);
         ListValueContract.addEnd(ValueContract);
       }
    
       if (dim3)
       {
         ValueContract = new DimensionAttributeValueContract();
         ValueContract.parmName('dim3') ;
         ValueContract.parmValue(dim3);
         ListValueContract.addEnd(ValueContract);
       }
    
    
    
       
       LedgerAccountContract.parmMainAccount(_MainAccount);
       LedgerAccountContract.parmValues(ListValueContract);
    
       dimStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(LedgerAccountContract);
       dimensionAttributeValueCombination = DimensionAttributeValueCombination::find(dimStorage.save());
    
       return dimensionAttributeValueCombination.RecId;
     }

    Thanks

    Mav

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Mav,

    Are you using the changeCompany keyword while creating the journals? Something like this -

    public createJE(_CreateJEDC,_voucher,_CreateJETmp)
    {
        changeCompany (_CreateJETmp.LegalEntityDimVal)
        {
            ledgerJournalTrans.LedgerDimension   = this.getLedgerDimension(dim1,dim2,dim3);
            ledgerJournalTrans.TransDate         = _CreateJEDC.TransactionDate();
            ledgerJournalName = LedgerJournalName::find(_ledgerJournalTable.JournalName);
            ledgerJournalTrans.Voucher = _voucher;
            ledgerJournalTrans.JournalNum = ledgerJournalId;
            ledgerJournalTrans.LineNum = LedgerJournalTrans::lastLineNum(ledgerJournalId)   1;
            ledgerJournalTrans.CurrencyCode = _CreateJEDC.TransactionCurrencyCode();
            ledgerJournalTrans.Txt = _CreateJETmp.desc;
            ledgerJournalTrans.Company = _CreateJETmp.LegalEntityDimVal;
            ledgerJournalTrans.BankDepositVoucher = NoYes::No;
            ledgerJournalTrans.ReverseEntry = NoYes::No;
            
            ttsbegin;
            ledgerJournalTrans.insert()
            ttscommit;
        }
    }

  • Mav Profile Picture
    on at

    I tried change company code  & still getting that validation warning

    It is really weird that when you re enter the same account combination & re validate the validation warning goes away.

    Or warning goes away  when you change your code for creating JE line item to below code

    ledgertranscompany =  _CreateJEDC.DataAreaId(); (Which provides values of company as company A in which the journal is created)

    from this code

    changeCompany(_CreateJETmp.LegalEntityDimVal)

    ledgertranscompany  =  _CreateJETmp.LegalEntityDimVal;  (Which provides values of company as company B or company C).

    Please suggest a fix so that i am able to create JE line items for ledgertranscompany = company B  or company C.

    Thanks

    Mav

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Mav,

    Did you use the changeCompany keyword for creating the journal header as well? What I mean is something like this -

    changeCompany(_company)
    {
        createLedgerJounalTable();
        createLedgerJournalTrans();
    }

    A quick test could be to try creating the journal when logged into company B to check if the lines get created properly (for company B) and can be posted without errors.

  • Mav Profile Picture
    on at

    Hi Gunjan

    I cannot use changeCompany while creating header because the journal has to be in company A with line items having ledgerjournaltrans.company as company B or company C.

    However for testing i did created a journal JB  in company B & in line item provided the account combination for which i was getting warning when using in company A & got no validation warning when using same account combination for journal JB.

    Thanks

    Mav

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Mav,

    Could you please try something?

    Instead of assigning values a buffer of LedgerJournalTrans, could you please try using AxLedgerJournalTrans class?

    AxLedgerJournalTrans    journalTrans;
    
    journalTrans = new AxLedgerJournalTrans();
    
    journalTrans.parmJournalNum(ledgerJournalTable.JournalNum);
    journalTrans.parmTransDate(_CreateJEDC.TransactionDate());
    journalTrans.parmCurrencyCode("USD");
    journalTrans.parmAmountCurDebit(200);
    
    journalTrans.parmCompany(_CreateJETmp.LegalEntityDimVal);
    journalTrans.parmAccountType(LedgerJournalACType::Ledger);
    journalTrans.parmLedgerDimension(this.getLedgerDimension(dim1,dim2,dim3);       
    
    // Fill in the remaining fields here.
    
    
    journalTrans.save();   

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans