In attached files there is a procedure that returns quantity of available goods for sale.
Procedure is correct - when I try in SQL on my database to check the result with some three parameters - 'exec [procedure-name] , p1,p2,p3 '
it returns right result.
But when I write this procedure in SAP B1 in "Query manager" and then try it via Formatted Search in my desired field, I get the error message :
"Invalid cursor state".
If I comment in my procedure a fragment, where @qty is calculated , and then put any number instead of it - procedure works in SAP.
But @qty is calculated properly - it's just small number (I checked).
How to cope with this problem?
What will anybody advise?