Skip to Content
-1

SQL Script error: column store error: [34011] failed to save calculation scenario

Sep 11, 2017 at 03:50 PM

69

avatar image
Former Member

Hi, I'm encountering an error when executing an AMDP Report.

From the error log:

"column store error: [34011] failed to save calculation scenario : The following errors occurred: Inconsistent calculation model (34011)#Details (Errors):#- calculationNode (_SYS_SS_CE_13762267_140390762610688:3_TMP_CALL) -> operation (CalcScenarioTempalte"

As our system does not support debugging yet, I tried to isolate the issue by commenting the codes out and here's where the error occurs.

    ex_result = SELECT a.vbeln,
                       a.kunrg,
                       a.kunag,
                       a.vkorg,
                       a.vtweg,
                       a.fkart,
                       a.fkdat,
                       a.erdat,
                       a.vbtyp,
                       a.knumv,
                       a.xblnr,
                       a.zuonr,
                       a.waerk,
                       a.zznettax,
*                       CASE WHEN a.vbtyp = 'N' OR a.vbtyp = 'O'
*                            THEN  ( a.zznettax * -1 )
*                            ELSE a.zznettax
*                            END AS zznettax,
                       a.spart,
                       a.vkgrp,
                       a.vstel,
                       a.werks,
                       a.lgort,
                       a.posnr,
                       a.matnr,
                       a.fkimg,
                       a.vrkme,
                       a.meins,
                       a.ntgew,
                       a.brgew,
                       a.aubel,
                       a.aupos,
                       a.vgbel,
                       a.vgpos,
                       a.prctr,
                       a.wavwr,
                       a.kzwi1,
                       a.kzwi4,
                       a.mwsbp,
*                       CASE WHEN a.vbtyp = 'N' OR a.vbtyp = 'O'
*                            THEN a.mwsbp * -1
*                            ELSE a.mwsbp
*                            END AS mwsbp,
                       a.prsdt,
                       a.maktx,
                       a.matkl,
                       a.mvgr1,
                       a.mvgr2,
                       a.mvgr3,
                       a.mvgr4,
                       a.mvgr5,
                       a.vkbur,
                       a.bzirk,
                       a.vwerk,
                       a.zterm,
                       a.kvgr1,
                       a.kvgr2,
                       a.bezei,
                       a.pernr,
                       a.rufnm,
                       a.ename,
                       a.name1,
                       a.sh_kunnr,
                       a.sh_name1,
                       a.bt_kunnr,
                       a.bt_name1,
                       CASE WHEN a.mc_kunnr = ' '
                            THEN a.bt_kunnr
                            ELSE a.mc_kunnr
                        END AS mc_kunnr,
*                       a.mc_kunnr,
                       a.mc_name1,
                       a.lgmng,
                       a.mctxt,
                       a.kvgr5,
                       a.augru,
                       a.pstyv,
                       a.route,
                       a.kwmeng,
                       a.dvstel,
                       a.vtext,
                       a.ordes,
                       a.sgdes,
                       a.mwst,
                       a.kbetr,
                       a.wavwr2,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z100 * -1
*                            ELSE a.disc_z100
*                            END
                      '0' AS disc_z100,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z110 * -1
*                            ELSE a.disc_z110
*                            END
                      '0' AS disc_z110,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z120 * -1
*                            ELSE a.disc_z120
*                            END
                      '0' AS disc_z120,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z200 * -1
*                            ELSE a.disc_z200
*                            END
                      '0' AS disc_z200,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z210 * -1
*                            ELSE a.disc_z210
*                            END
                      '0' AS disc_z210,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z220 * -1
*                            ELSE a.disc_z220
*                            END
                      '0' AS disc_z220,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z230 * -1
*                            ELSE a.disc_z230
*                            END
                      '0' AS disc_z230,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z300 * -1
*                            ELSE a.disc_z300
*                            END
                      '0' AS disc_z300,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z310 * -1
*                            ELSE a.disc_z310
*                            END
                      '0' AS disc_z310,
*                       CASE WHEN a.vbtyp = 'M' OR a.vbtyp = 'S'
*                            THEN a.disc_z320 * -1
*                            ELSE a.disc_z320
*                            END
                      '0' AS disc_z320,
*                       CASE WHEN a.vbtyp = 'M' or a.vbtyp = 'S'
*                            THEN a.disc_z400 * -1
*                            ELSE a.disc_z400
*                            END
                      '0' AS disc_z400,
*                       CASE WHEN a.vbtyp = 'M' or a.vbtyp = 'S'
*                            THEN a.disc_z500 * -1
*                            ELSE a.disc_z500
*                            END
                      '0' AS disc_z500,
                       a.di_fre,
                       a.di_addl,
                       a.netwr,
                       CASE WHEN a.pstyv = 'TANN' OR   a.pstyv = 'BVNN'
                            THEN '0'
                            ELSE a.kbetr
                            END AS pr01,
*                       ( a.disc_z100 + a.disc_z110 + a.disc_z120 +
*                         a.disc_z200 + a.disc_z210 + a.disc_z220 +
*                         a.disc_z300 + a.disc_z310 + a.disc_z320 +
*                         a.disc_z400 + a.disc_z500 )
                       '0' AS di_dis,
*                       CASE WHEN a.vbtyp = 'N' or a.vbtyp = 'O'
*                            THEN ( ( a.netwr - a.mwst ) * -1 )
*                            ELSE ( a.netwr - a.mwst )
*                            END AS netv,
*                       ( a.netwr - a.mwst ) AS netv,
                       '0' AS netv,
                       '0' AS unitp,
*                        ( SELECT (name1 || char(32) || name2 || char(32) || name3 ) AS names
*                            FROM kna1
*                            WHERE kunnr = a.kunag
*                            AND   mandt = :im_mandt ) AS sold_name,
                       ( SELECT (name1 || name2 || name3 ) AS names
                            FROM kna1
                            WHERE kunnr = a.kunag
                            AND   mandt = :im_mandt ) AS sold_name,
*                       ( SELECT  (name1 || char(32) || name2 || char(32) || name3 ) AS names
*                            FROM kna1
*                            WHERE kunnr = a.sh_kunnr
*                            AND   mandt = :im_mandt ) AS ship_name,
                       ( SELECT  (name1 || name2 || name3 ) AS names
                            FROM kna1
                            WHERE kunnr = a.sh_kunnr
                            AND   mandt = :im_mandt ) AS ship_name,
*                       ( SELECT  (name1 || char(32) || name2 || char(32) || name3 ) AS names
*                            FROM kna1
*                            WHERE kunnr = a.bt_kunnr
*                            AND   mandt = :im_mandt ) AS bill_name,
                       ( SELECT  (name1 || name2 || name3 ) AS names
                            FROM kna1
                            WHERE kunnr = a.bt_kunnr
                            AND   mandt = :im_mandt ) AS bill_name,
                       vbrk_f.knrze,
                       ( SELECT bezei FROM tvkbt
                                      WHERE vkbur = a.vkbur
                                        AND spras = 'E'
                                        AND mandt = :im_mandt) AS dvkbur,
                       CASE WHEN a.vkgrp = ''
                            THEN ' '
                            ELSE ( SELECT bezei FROM tvgrt
                                                WHERE vkgrp = a.vkgrp
                                                  AND spras = 'E'
                                                  AND mandt = :im_mandt )
                            END AS dvkgrp,
                       t001w.name1 AS dwerks,
                       t001l.lgobe AS dlgort,
                       vbrk_f.kdgrp,
                       CASE WHEN vbrk_f.kdgrp = ''
                            THEN ' '
                            ELSE ( SELECT ktext FROM t151t
                                                WHERE spras = 'E'
                                                  AND kdgrp = vbrk_f.kdgrp
                                                  AND mandt = :im_mandt )
                            END AS dkdgrp,
                       CASE WHEN a.kvgr1 = ''
                            THEN ' '
                            ELSE ( SELECT bezei FROM tvv1t
                                                WHERE spras = 'E'
                                                  AND kvgr1 = a.kvgr1
                                                  AND mandt = :im_mandt )
                            END AS dkvgr1,
                       CASE WHEN a.kvgr2 = ''
                            THEN ' '
                            ELSE ( SELECT bezei FROM tvv2t
                                                WHERE kvgr2 = a.kvgr2
                                                  AND spras = 'E'
                                                  AND mandt = :im_mandt)
                            END AS dkvgr2,
                       tvzbt.vtext AS dzterm,
                       tvfkt.vtext AS dfkart,
                       CASE WHEN a.kvgr5 = ''
                            THEN ' '
                            ELSE ( SELECT bezei
                                     FROM tvv5t
                                     WHERE spras = 'E'
                                       AND kvgr5 = a.kvgr5
                                       AND mandt = :im_mandt )
                            END AS dkvgr5,
                       vbfa.rfmng AS pikmg,
                       ( SELECT umrez
                            FROM marm
                            WHERE matnr = a.matnr
                            AND   meinh = 'KAR'
                            AND   mandt = :im_mandt )  AS kar_meinh,
                       ( SELECT umrez
                            FROM marm
                            WHERE matnr = a.matnr
                            AND   meinh = 'GA'
                            AND   mandt = :im_mandt ) AS ga_meinh,
                       '' AS sales_uom,
                       CASE WHEN a.matkl = ''
                            THEN ''
                            ELSE (SELECT wgbez
                                    FROM t023t
                                    WHERE matkl = a.matkl
                                      AND spras = 'E'
                                      AND mandt = :im_mandt)
                            END AS dmatkl,
                       CASE WHEN a.mvgr1 = ''
                            THEN ' '
                            ELSE ( SELECT bezei
                                     FROM tvm1t
                                     WHERE mvgr1 = a.mvgr1
                                       AND spras = 'E'
                                       AND mandt = :im_mandt)
                            END AS dmvgr1,
                       CASE WHEN a.mvgr2 = ''
                            THEN ' '
                            ELSE ( SELECT bezei
                                      FROM tvm2t
                                      WHERE mvgr2 = a.mvgr2
                                        AND spras = 'E'
                                        AND mandt = :im_mandt)
                            END AS dmvgr2,
                       CASE WHEN a.mvgr3 = ''
                            THEN ' '
                            ELSE ( SELECT bezei
                                     FROM tvm3t
                                     WHERE mvgr3 = a.mvgr3
                                     AND spras = 'E'
                                     AND mandt = :im_mandt )
                            END AS dmvgr3,
                       CASE WHEN a.mvgr4 = ''
                            THEN ' '
                            ELSE ( SELECT bezei
                                     FROM tvm4t
                                    WHERE mvgr4 = a.mvgr4
                                      AND spras = 'E'
                                      AND mandt = :im_mandt)
                            END AS dmvgr4,
                       CASE WHEN a.mvgr5 = ''
                            THEN ' '
                            ELSE (  SELECT bezei
                                      FROM tvm5t
                                      WHERE mvgr5 = a.mvgr5
                                        AND spras = 'E'
                                        AND mandt = :im_mandt)
                            END AS dmvgr5,
                       ( SELECT kwert
                            FROM :it_konv
                           WHERE knumv = a.knumv
                             AND kposn = a.posnr
                             AND kschl = 'VPRS' ) AS vprs,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z100' ) / 10
                        '0' AS rdisc_z100,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z110' ) / 10
                        '0' AS rdisc_z110,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z120' ) / 10
                        '0' AS rdisc_z120,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z200' ) / 10
                        '0' AS rdisc_z200,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z210' ) / 10
                        '0' AS rdisc_z210,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z220' ) / 10
                       '0' AS rdisc_z220,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z230' )
                        '0' AS rdisc_z230,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z300' ) / 10
                        '0' AS rdisc_z300,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z310' ) / 10
                        '0' AS rdisc_z310,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z320' ) / 10
                        '0' AS rdisc_z320,
*                       ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z400' ) / 10
                        '0' AS rdisc_z400,
*                        ( SELECT kbetr
*                            FROM :it_konv
*                           WHERE knumv = a.knumv
*                             AND kposn = a.posnr
*                             AND kschl = 'Z500' ) / 10
                        '0' AS rdisc_z500,
                       ( SELECT kwert
                            FROM :it_konv
                           WHERE knumv = a.knumv
                             AND kposn = a.posnr
                             AND kschl = 'Z910' ) AS net_vat,
*                       ( a.netwr + a.kzwi4 ) AS net_sales,
                       '0' AS net_sales,
                       '' AS stat,
                       '' AS uname,
                       '' AS datum,
                       '' AS month,
                       '' AS year,
                       '' AS item_code,
                       '' AS sku,
                       '' AS flag
                  FROM :it_result3 AS a
                  LEFT OUTER JOIN :ex_result AS vbrk_f ON vbrk_f.vbeln = a.vbeln
                  LEFT OUTER JOIN :it_mc_kunnr AS mc_kunnr ON mc_kunnr.kunnr = a.kunag
                                                          AND mc_kunnr.vbeln = a.vbeln
                                                          AND mc_kunnr.posnr = a.posnr
                  LEFT OUTER JOIN t001l AS t001l ON t001l.werks = a.werks
                                                AND t001l.lgort = a.lgort
                                                AND t001l.mandt = :im_mandt
                  LEFT OUTER JOIN t001w AS t001w ON t001w.werks = a.werks
                                                AND t001w.mandt = :im_mandt
                                                AND t001w.spras = 'E'
                  LEFT OUTER JOIN tvzbt AS tvzbt ON tvzbt.spras = 'E'
                                                AND tvzbt.zterm = a.zterm
                                                AND tvzbt.mandt = :im_mandt
                  LEFT OUTER JOIN tvfkt AS tvfkt ON tvfkt.spras = 'E'
                                                AND tvfkt.fkart = a.fkart
                                                AND tvfkt.mandt = :im_mandt
                  LEFT OUTER JOIN vbfa AS vbfa ON vbfa.vbeln = a.vgbel
                                                AND vbfa.posnn = a.vgpos
                                                AND ( vbfa.vbtyp_n = 'J' OR vbfa.vbtyp_n = 'T' )
                                                AND vbfa.mandt = :im_mandt 

;

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Horst Keller
Sep 11, 2017 at 04:07 PM
0

Well, the problem occurs inside the SQLScript implementation of the AMDP method. It is not an AMDP or ABAP problem, but an error in Hana programming. Maybe it is a good idea to test your code step by step in Hana studio first and then copy an error free version to AMDP or post your question under tag SQLScript.

B.t.w., what is "an AMDP Report"?

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi,

Okay sorry for getting mixed-up with the terms. I also think the error lies within the sql script. I tried commenting that script out and it posts no errors when executing in abap side.

There is also no error in Eclipse HANA Studio when I checked for errors.

Thanks for your response!
Keith

0