Thursday, June 15, 2023

How to get opening balance for ledger dimension in D365 X++

                         LedgerBalanceDimAttrValueComboAmounts   ledgerBalance;

                         AmountMST   opSum ;

DimensoinAttributevalueCombination dim;

select dim where dim.RecId == 68719651018;

                        ledgerBalance = LedgerBalanceDimAttrValueComboAmounts::construct();

                        ledgerBalance.parmIncludeRegularPeriod(true);

                        ledgerBalance.parmIncludeOpeningPeriod(true);

                        ledgerBalance.parmIncludeClosingPeriod(false);

                        ledgerBalance.parmAccountingDateRange(mkdate(01,01,2017), mkdate(31,12,2017));

                        ledgerBalance.calculateBalance(dim);

                        opSum = ledgerBalance.getAccountingCurrencyBalance();

info(strfmt("Opening Balance %1", opSum));

No comments:

Post a Comment