Wednesday, 14 July 2010

BRAIN 441 (query) error

Herewith some explanation regarding the BRAIN441 error which can occur when using formula variables in a query.
When a query uses a formula variable of the type "replacement path", it can, for example, replace the occurrence of a characteristic with another value.



The BRAIN441 error will occur when the query doesn't "know" how to replace the characteristic as it might occur in several InfoProviders, when using a query created on top of a Multiprovider.
As shown in the screengrab below, characteristic SSC_COKY occurs in all 3 Infoproviders (contained in the Multiprovider)



When you tick on all 3 checkboxes when identifying/assigning, the BRAIN441 error will occur when executing the query as it doesn't "know" which characteristic to replace.
Should it replace SSC_COMPL__SSC_COKY (the green boxes) or should it replace SSC_COKY (the red box).
As long as both characteristics differ, the BRAIN441 error will keep on occurring.
The solution for the BRAIN441 error, in this case, is to only tick on the checkboxes which refer to the same characteristic. In this case, to tick on the characteristics in the green boxes.

Friday, 9 July 2010

Using STATICS command

It is commonly known not to read from database tables in fieldroutines. Otherwise you will meet performance problems. The most usual approach is to fill an internal table in the startroutine and do a binary search on internal table in fieldroutine.

It is difficult to catch such a procedure in a function module or include, not having bits of coding sitting at different places (data declaration, startroutine, fieldroutine). Below example makes use of the STATICS command, which loads an internal table in memory during LUW execution.
The data is read once into memory and can be accessed quickly using READ TABLE statements.