sqlcrystal-reportssapb1crystal-reports-8.5

Actual vs Budget variance Crystal Reports repeating columns


I am new to Crystal reporting. I am trying to join multiple tables I have properly working queries but when I try to add them in SAP CR editor. One of the column shows up fine but others start repeating values.

I am using the following tables:

Report format list of columns I want to display:

What I have done:

    SELECT
    sum (T1.DebLTotal) actual,
    SUM(T3.Debit) budget,
    **OACT.AcctName ?**

    from
    OBGT T0  INNER JOIN BGT1 T1 ON T0.[AbsId] = T1.[BudgId], 
    OJDT T2 INNER JOIN JDT1 T3 ON T2.[TransId] = T3.[TransId]

    group by T3.Account  -- Some how i want to join OACT to get account names from AcctName 
                         -- field of budget relevant accounts Join on acctcode field

Solution

  • Finally i have completes a portion

    select
    
      T3.[AcctCode],sum(T1.[Debit]) as Actual, sum(T5.[DebLTotal]) as Budget
      into #abc
      from 
    
      [dbo].[JDT1]  T1 INNER JOIN [dbo].[OJDT]  
      T2 ON T1.[TransId] = T2.[TransId] INNER JOIN 
      OACT T3 ON T1.[Account] = T3.[AcctCode], OBGT T4 
      INNER JOIN BGT1 T5 ON T4.[AbsId] = T5.[BudgId]
    
      group by T3.AcctCode
    
      select OACT.AcctName, #abc.Actual, #abc.Budget 
     from OACT ,#abc where #abc.AcctCode=OACT.AcctCode 
    
      Drop table #abc