Long time developer with intersystems technology, I'm working for InterSystems in Italy on the TrakCare side.
You need to change your cursors names, use two different names in your declare statements, try it.
Some considerations about embedded SQL cursors:
1) I think using embedded SQL Cursors is a practice to be avoided in favor of %SQL.Statement class usage:
https://docs.intersystems.com/iris20232/csp/docbook/Doc.View.cls?KEY=GSQ...
2) Genarally is not a good idea to have the same name in embedded SQL cursors, even if they are in different Methods, this because of the behaviour of the Stack separations used by the embedded SQL cursors.
3) Use a close statement before every open statement of embedded SQL cursors, this prevent problems if your process crash and in the same context you re execute it.
It works also for me... maybe it depends on how Michael Wood is passing the json object to the method...
If he is passing a string, there is a conversion needed from string to %DynamicAbstractObject like:
Set str="{""prio"":""2"",""code"":""A001""}"
Write str
{"prio":"2","code":"A001"}
Set obj=##Class(%DynamicAbstractObject).%FromJSON(str)
Write obj
1@%Library.DynamicObject
ZW obj
obj={"prio":"2","code":"A001"} ; <DYNAMIC OBJECT>
ObjectScriptObjectScript
The method GetSphereJauh work if called from terminal?
It's looks like there are some undefined variebles there , in main method from your comment of the Aug 4 the variable "ATTRDesc" seems to be undefined and in the called method I do not see any value for "repid" variable (but it depend if your class is procedureblock or not).