Você está na página 1de 3

Procedure:

PROCEDURE "0000CDC"."___DEVPKG::SALES_PROC" (p_material VARCHAR(15))


LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER

READS SQL DATA AS


BEGIN

SELECT
VK."MANDT" AS "CLIENT"
,VK."VBELN" AS "SALES_ORDER"
,VP."POSNR" AS "SALES_DOC"
,VP."MATNR" AS "MAT_NO"
,VK."NETWR" AS "NET VALUE"
,VK."WAERK" AS "CURRENCY"

FROM "0000CDC"."VBAK_SP" AS VK
LEFT OUTER JOIN "0000CDC"."VBAP_SP" AS VP LEFT OUTER JOIN

ON
VK.MANDT=VP.MANDT
AND
VK.VBELN=VP.VBELN

WHERE VP."MATNR" = :p_material; where column =:inputparameter;

END;

CALL "0000CDC"."___DEVPKG::SALES_PROC"('PROD319') (‘value’)

Stored Proc’s are mainly used for INSERT, UPDATE, DELETE operations

To write to a table remove READ SQL DATA

Create a table; write the data to a temporary table and then insert into the Column table.

Data is written into the Table

SAP HANA stored procedures are reusable snippets of code which would be used in other development objects like
Calculation views, other stored procedures, table functions and more

Stored Procedures w/ Input Parameters:

You have to create a Table Type to Store the Result of the Output Parameter
Table Type:

 Using table type inside procedure to send output data.


 For output parameter type :-> CALLl proc_name(null) null or ? Is same thing
 For input and output parameters CALL Proc_name(input,?)
 CALL Proc(IN discount integer,output “schema”.”TT_Sales”)

You reference the input variable by :

Return Output Fields, must MATCH with Select Fields

“return” keyword between BEGIN and END BLOCK

After, activating the Table Function; Go to Modeler perspective and it should show up under the selected package;

If it doesn’t showup then you have to make sure all the hidden objects are listed option

WindowsPreferencesModeler check option, show hidden objects


Table Functions:

If you don’t get the results by graphical calculation views, then go for Table Functions as final resort

Create the Table Function and consume that in a calculation view

If you add an input parameter in the Table Function; then you create one in the graphical calculation view –
preferably with same name and data type, length and map the input parameters

Note:

 Table functions can be executed in the FROM clause of your SELECT statements.
 You can pass the input parameters as well. You can call the function from the SQL Console

Você também pode gostar