cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a calculated view subquery from another calculated view

Former Member

Hello,

I explain my doubt.

I have a query in SQL:

("MAC_Pedido_Factura" is a view created by me in SAP)

SELECT b."DocEntry", a."DocStatus",b."LineStatus", a."DocNum", b."LineNum"
FROM OPOR a  LEFT OUTER JOIN POR1 b ON a."DocEntry" = b."DocEntry" 
WHERE (a."DocEntry" NOT IN (SELECT "DocEntry" FROM "MAC_Pedido_Factura"                                 WHERE ("DocEntry" =b."DocEntry")
                            AND ("DocStatus" = 'C')                                                     AND (CANCELED = 'N')                                                   AND (IFNULL("DocentryFC",IFNULL("DocentryE",0))= 0)))

And I'm trying to do it with the SAP HANA Studio in graphical mode. For this I have created two calculated views, CV_1 and CV_2,

CV_1 would be:

SELECT  b."DocEntry", a."DocStatus",
b."LineStatus", a."DocNum", b."LineNum"FROM OPOR a  LEFT OUTER JOIN POR1 b ON
a."DocEntry" = b."DocEntry"

And in the graphical mode I have it like this: CV_1

And CV_2 would be:

SELECT "DocEntry" FROM "MAC_Pedido_Factura" 
WHERE ("DocEntry" = b."DocEntry") 
AND ("DocStatus" = 'C') 
AND (CANCELED = 'N') 
AND (IFNULL("DocentryFC",IFNULL("DocentryE",0)) = 0))

And in graphical mode I did it like this: CV_2

The question I have is how do I make the CV_2 view the subquery of the CV_1 view,

 WHERE (a. "DocEntry" NOT IN (SELECT "DocEntry" FROM "MAC_Form") .... 

What should another JOIN do between the two views? Is there any other way?

Can anyone help me in this?

Regards, Alfonso

Accepted Solutions (0)

Answers (0)