cancel
Showing results for 
Search instead for 
Did you mean: 

Using PAL Procedures embeded in SQL Script (anonymous blocks)

dirk_meyer2
Participant
848

Hi all,
I stumbled over a change in behaviour of PAL Procedures after i embedded them in an anonymous srip blog.
My idea is to make certain procedure with dynamic programing easier to us/reuse.

As an exampel serves PAL_MULTIVARIATE_ANALYSIS
In the documentation example it is fed with local temporary table and the result table can be defined relativly flexibe. The column names do not have to be identical with the input cols.

As soon as I use "Do Begin - End" the behaviour completely changes.
This seems necessary for usage of DECLARE.
Only table variables are accepted in and out. The naming of outtab has to be exactly like the intab (plus the first col).  With that necessity the hole thing gets more complicated in order to declare tabs dynamicly.
With APL I think its the same drama.

Why is that so and is there a propper not tinker work arround. 
Maybe its just my limited experience with SQL sripting and as so as it is again stored as procedure its all diffenrent again.

Very gratefull for all helpful clues.
Dirk

View Entire Topic
marc_daniau
Product and Topic Expert
Product and Topic Expert
0 Kudos

Here is the code to prepare the tables:

create view SERIES_IN as select * from APL_SAMPLES.OZONE_RATE_LA order by "Date" asc;

create table SERIES_OUT (
	"Date" DAYDATE,
	"OzoneRateLA" DOUBLE,
	"kts_1" DOUBLE,
	"kts_1_lowerlimit_95%" DOUBLE,
    "kts_1_upperlimit_95%" DOUBLE
);

create local temporary table #HEADER_APL       like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.FUNCTION_HEADER";
create local temporary table #CONFIG_APL       like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_CONFIG_EXTENDED";
create local temporary table #DESCCRIPTION_APL like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_DESC_OID";
create local temporary table #ROLES_APL        like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.VARIABLE_ROLES_WITH_COMPOSITES_OID";
create local temporary table #LOG_APL          like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.OPERATION_LOG";
create local temporary table #SUMMARY_APL      like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.SUMMARY";
create local temporary table #INDICATORS_APL   like "SAP_PA_APL"."sap.pa.apl.base::BASE.T.INDICATORS";

insert into #HEADER_APL values ('Oid', 'My Forecast');
insert into #CONFIG_APL values ('APL/Horizon', '3',null);
insert into #CONFIG_APL values ('APL/TimePointColumnName', 'Date',null);
insert into #CONFIG_APL values ('APL/ForcePositiveForecast', 'true',null);
insert into #CONFIG_APL values ('APL/ApplyExtraMode','Forecasts and Error Bars', null);
insert into #ROLES_APL  values ('Date', 'input',NULL,NULL,NULL);

Marc