Exporting an Analysis as a Stored Procedure

You can export an SAP HANA analysis -- including a Demand Forecast analysis -- into the SAP HANA database. Any SAP HANA user can consume that analysis in SAP HANA Studio.

Before exporting an analysis as a stored procedure in SAP HANA database, ensure that your account is defined in SAP HANA. Afterwards, take the following steps:

  1. Create an analysis in Predict room.
  2. Run the analysis.
  3. Select the last algorithm component in the analysis and from the context menu, select Export as Stored Procedure.
  4. Select the schema name.
  5. Enter a procedure name.
  6. If you want to overwrite the existing procedure with the newly created procedure, select the checkbox, Overwrite, if exists.
  7. Optional: Enter a name for the view.
  8. Select Export.

The entire analysis chain is exported as a stored procedure. The exported procedure and the associated objects appear under the selected schema in the SAP HANA database.

The following objects generate in SAP HANA database under the selected schema:
  • Procedure with name specified.
  • If you decided to create a view, then a column view with name specified.
  • One or more procedures for each component in the analysis chain.
  • One column view for each component in the chain.
  • Table types needed by SAP HANA algorithms.
  • Tables required by these algorithms that may contain input parameters.

Example:

Consuming the Stored Procedure
Tip The following SQL snippet shows how you can consume the exported stored procedure:
CREATE TABLE  ResultTable like "TestProc_OUT_TYPE";
					
					call "TEST80"."TestProc"(ResultTable) WITH OVERVIEW;
					
					select * from ResultTable ;
				
TestProc_OUT_TYPE is the same as the table type that TestProc expects as out parameter.
Tip There is an additional feature available where the user can create column views on top of the stored procedure:
Select * from VIEW_TESTPROC