Performing total of a column in a temporary column in SAP


You need to perform select again on your query. Here is the sample

SELECT DATE, FUND_ID, PPT_ID, SOURCE_ID, AMOUNT, SUM (AMOUNT) as TOTAL
FROM (
   SELECT
   AD.CHV_DATE.DATE,
   AD.CHV_FUND.FUND_ID,
   AD.CHV_PARTICT.PPT_ID,
   AD.CHV_PARTICT.SOURCE_ID,
   SUM (AD.CHV_PARTICT.AMOUNT),
FROM
   AD.CHV_DATE,
   AD.CHV_FUND,
   AD.CHV_PARTICT,
   AD.CHV_SOURCE
WHERE
   DC.CHV_SOURCE.FUND_ID=AD.CHV_FUND.FUND_ID
AND (DC.CHV_SOURCE.DATE=AD.CHV_DATE.DATE)
AND (DC.CHV_PARTICT.PPT_ID=AD.CHV_SOURCE.PPT_ID)
AND (
   AD.CHV_DATE.DATE IN ('2017-08-02')   
   AND
   AD.CHV_PARTICT.PPT_ID IN ('PPT0449')
)
GROUP BY
   AD.CHV_DATE.DATE,
   AD.CHV_FUND.FUND_ID,
   AD.CHV_PARTICT.PPT_ID,
   AD.CHV_SOURCE.SOURCE_ID)
GROUP by DATE, FUND_ID, PPT_ID, SOURCE_ID, AMOUNT
raja
Published on 12-Dec-2017 11:33:26
Advertisements