select sum(AccountingCurrencyAmount) as NETSALE, GeneralJournalAccountEntry.LedgerDimension,GeneralJournalAccountEntry.LedgerAccount from GeneralJournalAccountEntry
join GeneralJournalEntry on GeneralJournalAccountEntry.GeneralJournalEntry = GeneralJournalEntry.RecId
join MainAccount on GeneralJournalAccountEntry.MainAccount = MainAccount.RecId
join DimensionAttributeLevelValueView on GeneralJournalAccountEntry.LedgerDimension = DimensionAttributeLevelValueView.ValueCombinationRecId
join DimensionAttribute on DimensionAttributeLevelValueView.DimensionAttribute = DimensionAttribute.RecId
join FiscalCalendarPeriod on FiscalCalendarPeriod.RecId = GeneralJournalEntry.FiscalCalendarPeriod
where GeneralJournalEntry.AccountingDate >= '2019-10-01' and GeneralJournalEntry.AccountingDate <= '2019-10-31'
and GeneralJournalEntry.SubledgerVoucherDataAreaId = 'apl'
and GeneralJournalAccountEntry.LedgerDimension = DimensionAttributeLevelValueView.ValueCombinationRecId
and DimensionAttribute.Name = 'BusinessUnit'
and DimensionAttributeLevelValueView.DisplayValue >= '20311' and DimensionAttributeLevelValueView.DisplayValue <= '20311'
and FiscalCalendarPeriod.Type = '1'
and MainAccount.MainAccountId = '510001010' or MainAccount.MainAccountId = '510001020'
group by GeneralJournalAccountEntry.LedgerDimension, GeneralJournalAccountEntry.LedgerAccount
Here is my Sql query and I have to implement the same logic in x++.
Thanks in advance.