Buenos días compañeros ante todo cordial saludo, Mi nombre es Alexander Cumana recurro a ustedes para una ayuda, actualmente trabajo con sap b1 9.3 pl5 en hana , estoy tratando de hacer una vista calculada con un script para sumar el inventarios de varias bases de datos , el codigo es el siguiente
/********* Begin Procedure Script ************/
BEGIN
var_out =
SELECT SUM(X."STOCK") AS "STOCK",
X."ItemCode",
MAX(X."ItemName") AS "ItemName",
sum(X."comprometido") AS "comprometido",
sum(X."ordenado") AS "ordenado"
FROM (
SELECT SUM(T1."OnHand") AS "STOCK",
T0."ItemCode",
T0."ItemName",
sum(T1."IsCommited") as "comprometido",
sum(T1."OnOrder") as "ordenado"
FROM "BASE DE DATOS A".OITM T0
INNER JOIN "BASE DE DATOS A".OITW T1 ON T0."ItemCode" = T1."ItemCode"
INNER JOIN "BASE DE DATOS A".OWHS T2 ON T1."WhsCode" = T2."WhsCode"
WHERE T0."ItemCode" = 'BLIARAP00000022'
GROUP BY T0."ItemCode", T0."ItemName"
UNION
SELECT SUM(T1."OnHand") AS "STOCK",
T0."ItemCode",
T0."ItemName",
sum(T1."IsCommited") as "comprometido",
sum(T1."OnOrder") as "ordenado"
FROM "BASE DE DATOS B".OITM T0
INNER JOIN "BASE DE DATOS B".OITW T1 ON T0."ItemCode" = T1."ItemCode"
INNER JOIN "BASE DE DATOS B".OWHS T2 ON T1."WhsCode" = T2."WhsCode"
WHERE T0."ItemCode" = 'BLIARAP00000022'
GROUP BY T0."ItemCode", T0."ItemName"
UNION
SELECT SUM(T1."OnHand") AS "STOCK",
T0."ItemCode",
T0."ItemName",
sum(T1."IsCommited") as "comprometido",
sum(T1."OnOrder") as "ordenado"
FROM "BASE DE DATOS C".OITM T0
INNER JOIN "BASE DE DATOS C".OITW T1 ON T0."ItemCode" = T1."ItemCode"
INNER JOIN "BASE DE DATOS B".OWHS T2 ON T1."WhsCode" = T2."WhsCode"
WHERE T0."ItemCode" = 'BLIARAP00000022'
GROUP BY T0."ItemCode", T0."ItemName"
) AS X
GROUP BY X."ItemCode"
;
END
/********* End Procedure Script *********
y al ejecutar la vista me genera el siguiente error:
Repository: Encountered an error in repository runtime extension;Model inconsistency. Deploy Calculation View: SQL: return type mismatch: Procedure CUBO_INVENTARIOS_BDPRUEBA/VISTA_CAL_INVENTARIOS/proc: Attribute name "ItemCode" different from Attribute name: "STOCK" : line 4 col 4 (at pos 304)
Set Schema DDL statement: set schema “SYSTEM”
Type DDL: create type
Agradecido con el apoyo que me puedan brindar
Muchas gracias
AC