talha.quadri
8th November 2021, 11:00
I am trying to call the same funtion after incrementing the counter value. below is my code.

function extern check.next.approver(domain hrgen.desg hold.desg.local)
{

on case counter
case 1:
select hrper001.*
from hrper001
where hrper001.emno = :hrgen520.init
selectdo
select hrper103.*
from hrper103
where hrper103.desg = :hrper001.desg
selectdo
if hrgen520.nxta <> hrper103.dmgr then
hold.nxta = hrper103.dmgr
counter = counter + 1
else
counter = counter + 1
check.next.approver(hold.desg.local)
endif
endselect
endselect
break
case 2:
select hrper001.*
from hrper001
where hrper001.emno = :hrgen520.init
selectdo
select hrper103.*
from hrper103
where hrper103.desg = :hrper001.desg
selectdo
if hrgen520.nxta <> hrper103.hodp then
hold.nxta = hrper103.hodp
counter = counter + 1
else
counter = counter + 1
check.next.approver(hold.desg.local)
endif
endselect
endselect
break
}

talha.quadri
8th November 2021, 11:08
i am getting error,
recursion not possible refcount 2

can anyone help me with this

vahdani
9th November 2021, 11:49
Hi,

it is not allowed to use select statements in a recursion. I had posted a reply ith my solution for the same problem but using dynamic sql. Take a look at it here.

http://www.baanboard.com/baanboard/showthread.php?t=72471