I was able to get mine to work just fine by using the Local array with the code I originally provided. My problem was unrelated to the array scoping or the recursion.
I was making a bone headed mistake of passing the wrong number of arguments to my subroutine that wrote to the cursor. Instead of passing three parameters to the subroutine, in one of the calls I was only passing two parameters.
For example,
DO WriteBOM WITH laArray(lncounter,1), laArray(lncounter,2)
Procedure WriteBOM
Parmeters lcItem, lnQty, lcUM
RETURN
>I have had the same problem. I try uniquely naming the array in ever child call. Try using your lnCounter parameter and declare your array name in a macro to make it unique in every call.
>
>lcArrayName = "laArray" + alltrim(str( lnCounter ) )
>
>LOCAL ARRAY &lcArrayName (1)
>
>other code...
>
> * access array like this, make sure and put in a TYPE() or VARTYPE() check
> * to ensure the array exists
> FOR lnCounter = 1 to ALEN( &lcArrayName, 1 )
> Variable = &lcArrayName[ lnCounter ]
> ENDFOR
>
>
>* at end of function release array
>RELEASE &lcArrayName
>
>...
>
>RETURN