Temporary Table processing failure during allocation phase.

Facing the following error ?
Temporary Table processing failure during allocation phase.
Description: The Application abended due to a problem encountered during the internal housekeeping of Temporary Tables.
The possible failure points are as follows:
C++ memory allocation for adding new temp tables to the existing internal array.

The reason for this error will be mainly due to temp tables which are not built. The no.of instances mentioned in the AE Program properties is more than the actual Physical number of the temp tables in present in the database. During the allocation phase it allocates the next temp table which not existed physically in the data base and will cause the above all problem.

To find the no.of the temp table instances that will be built query this following record
pstemptblcntvw. This will include the table no.of instance count across all the application engine and online temp table instance.

Missing temp table instance can be found by the following query

SELECT r.recname , n.n instance , c.temptblinstances +o.temptblinstances temptblinstances FROM pstemptblcntvw c , psrecdefn r , (SELECT rownum-1 n
FROM psrecdefn WHERE rownum <= 100) n , psoptions o WHERE r.recname = c.recname AND n.n <= c.temptblinstances+o.temptblinstances AND NOT EXISTS( SELECT 'x' FROM user_tables t WHERE t.table_name = DECODE(r.sqltablename, ' ', 'PS_'||r.recname, r.sqltablename) ||DECODE(n.n,0,'',n.n) ) ORDER BY 1,2