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

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Getting JE validation warning "account structure management ........"

    Hi Mav,

    You can use either of these. At the end table buffer insert is called for record insertion.

    Normally, I would prefer using AxLedgerJournalTrans classe as we have to write less code. For an example, while creating a LedgerJournalTrans record, I don't need to write code for generating the voucher number. It will be done automatically on on calling AxLedgerJournalTrans.save().

  • Mav Profile Picture
    on at
    RE: Getting JE validation warning "account structure management ........"

    Hi Gunjan ,

    It did worked.

    Btw when creating JE line items which of the following should be used and why.

    1. Use ledger journal trans table buffer and insert(). Or

    2.Use axledgerjournaltrans class and save().

    Thanks

    Mav

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Getting JE validation warning "account structure management ........"

    Hi Mav,

    Can you use a changeCompany and try creating the LedgerDimension in that call? Something like this maybe -

    public createJE(_CreateJEDC,_voucher,_CreateJETmp)
    {
        DimensionDynamicAccont ledgerDimension;
    
        changeCompany (_CreateJETmp.LegalEntityDimVal)
        {
            ledgerDimension = this.getLedgerDimension(dim1,dim2,dim3);
        }
        ledgerJournalTrans.LedgerDimension   = ledgerDimension;
        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
    RE: Getting JE validation warning "account structure management ........"

    Hi Gunjan,

    Ok so here is the latest findings.

    1>Creating JE via code for company B in company A

    JE line item for company B is created in company A.

    However there is a validation error while validating the journal.

    2>Creating JE in company B directly via form using same ledger dimension as above

    It gives no validation error

    3>Investigation findings

    The recids for DIMENSIONATTRIBUTEVALUECOMBINATION & DIMENSIONHIERARCHY are different when comparing code vs directly via form.

    Could you suggest a code fix which would ensure that DIMENSIONATTRIBUTEVALUECOMBINATION  & DIMENSIONHIERARCHY  recid for code as similar to recid when creating it directly via form.

    Thanks

    Mav

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Getting JE validation warning "account structure management ........"

    Hi Mav,

    Do you mean that if you try validate the journal from the UI, are you able to do it without any issues? Only while validating and posting using code you are getting this error.

  • Mav Profile Picture
    on at
    RE: Getting JE validation warning "account structure management ........"

    Hi Gunjan,

    Ok so here is comparison 

    1>Creating JE via code for company B in company A 

    JE line item for company B is created in company A.

    However there is a validation error while validating the journal.

    2>Creating JE in company B directly via form using same ledger dimension as above

    It gives no validation error 

    3>Investigation findings

    The recids for DIMENSIONATTRIBUTEVALUECOMBINATION & DIMENSIONHIERARCHY are different when comparing code vs directly via form.

    Could you suggest a code fix which would ensure that DIMENSIONATTRIBUTEVALUECOMBINATION  & DIMENSIONHIERARCHY  recid for code as similar to recid when creating it directly via form.

    Thanks

    Mav

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Getting JE validation warning "account structure management ........"

    Hi Mav,

    I think I know the issue. When legal entities B and C have different account structures. When you enter the main account and dimensions from the form, please check the LedgerDimension value generated. Please compare that with that generated from the method. They would be referring to DimensionAttributeValueCombination records with same DisplayValue, but different AccountStructure values.

  • Mav Profile Picture
    on at
    RE: Getting JE validation warning "account structure management ........"

    Hi Gunjan,

    Appreciate your response  .

    I have tried this code with both table buffer ledgerjournaltrans & journaltrans class instance followed by compile forward + incremental CIL & unfortunately the JE validation warning keeps showing up.  

    What i really find strange is that if i merely reenter the same account combination in the journal & then re validate the journal , the warning for that account combination goes away.

    Thanks

    Mav

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Getting JE validation warning "account structure management ........"

    Hi Mav,

    Could you please try this method -

    public RecId getLedgerDimension(Mainaccount _mainaccount, str dim1,dim2,dim3, DataAreaId _dataAreaId)
    {
       container 								conData;
        int                                     hierarchyCount;
        int                                     hierarchyIdx;
        LedgerRecId                             ledgerRecId;
        MainAccount                             mainAccount;
        RefRecId                                recordvalue;
        DimensionAttribute                      dimensionAttribute;
        DimensionAttributeValue                 dimensionAttributeValue;
        DimensionSetSegmentName                 DimensionSet;
        DimensionStorage                        dimStorage;
        DimensionAttributeValueContract         ValueContract;
        LedgerAccountContract                   LedgerAccountContract;
        DimensionAttributeValueCombination  	dimensionAttributeValueCombination;
        List                                    valueContracts;
    
    	#define.MainAccount('MainAccount')
        #define.Dim1('Dim1')
        #define.Dim2('Dim2')
        #define.Dim3('Dim3')
    	
    	LedgerAccountContract   = new LedgerAccountContract();
        valueContracts          = new List(Types::Class);
    
    	changeCompany (_dataAreaId)
    	{
    		conData =[_mainAccountId];
    
    		mainAccount     =   MainAccount::findByMainAccountId(_mainAccountId);
    		recordvalue     =   DimensionHierarchy::getAccountStructure(mainAccount.RecId,Ledger::current());
    		hierarchyCount  =   DimensionHierarchy::getLevelCount(recordvalue);
    		DimensionSet    =   DimensionHierarchyLevel::getDimensionHierarchyLevelNames(recordvalue);
    
    		if (recordvalue)
    		{
    			for(hierarchyIdx = 1; hierarchyIdx <= hierarchyCount; hierarchyIdx  )
    			{
    				if(hierarchyIdx == 1)
    				continue;
    
    				dimensionAttribute = DimensionAttribute::findByLocalizedName(DimensionSet[hierarchyIdx]);
    
    				if (dimensionAttribute.Name == #Dim1)
    				{
    					conData  = [dim1];
    				}
    				if (dimensionAttribute.Name == #Dim2)
    				{
    					conData  = [dim2];
    				}
    				if (dimensionAttribute.Name == #Dim3)
    				{
    					conData  = [Dim3];
    				}
    				
    				if(dimensionAttribute)
    				{
    					dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,conPeek(conData,hierarchyIdx));
    
    					if(dimensionAttributeValue)
    					{
    						ValueContract = new DimensionAttributeValueContract();
    						ValueContract.parmName(dimensionAttribute.Name) ;
    						ValueContract.parmValue(dimensionAttributeValue.CachedDisplayValue);
    						valueContracts.addEnd(ValueContract);
    					}
    				}
    			}
    
    	   LedgerAccountContract.parmMainAccount(_MainAccount);
    	   LedgerAccountContract.parmValues(ListValueContract);
    
    	   dimStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(LedgerAccountContract);
    	   dimensionAttributeValueCombination = DimensionAttributeValueCombination::find(dimStorage.save());
    	}
    
       return dimensionAttributeValueCombination.RecId;
    }

  • Mav Profile Picture
    on at
    RE: Getting JE validation warning "account structure management ........"

    Hi Gunjan,

    I tried changing from buffer to  journaltrans instance, comple, compile forward & incremental CIL , unfortunately same results :-( the warning still continues to be there.

    Thanks

    Mav

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,013 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans