vinceco252
20th July 2009, 19:43
Ok, I really hope I'm doing something obviously wrong here. I am creating a session to process a custom table populated from a text file into a sales order. Here is the code for the AFS portion of the session:
function domain tcbool process.tdair101.to.sales.order(ref domain tcorno h.orno, ref domain tcpono h.pono)
{
domain tcbool h.return
long count, ret
h.return = false
string error(100)
string error.mesg(100)
string value(6)
boi.call = "tdboidll0005"
|*tdsls4101m000
| Header
stpapi.put.field( "tdsls4101m000", "tdsls040.orno", "10") |SO Number/Series
stpapi.put.field( "tdsls4101m000", "tdsls040.cuno", tdair101.cuno) |Customer
stpapi.put.field( "tdsls4101m000", "tdsls040.cotp", tdair101.cwar) |Order Type
stpapi.put.field( "tdsls4101m000", "tdsls040.odat", str$(tdair101.date)) |Order Date
stpapi.put.field( "tdsls4101m000", "tdsls040.prdt", str$(tdair101.date)) |Planned Receipt Date
stpapi.put.field( "tdsls4101m000", "tdsls040.ddat", str$(tdair101.date)) |Planned Delivery Date
stpapi.put.field( "tdsls4101m000", "tdsls040.refa", tdair101.refa) |Reference A
stpapi.put.field( "tdsls4101m000", "tdsls040.refb", tdair101.refa) |Reference B
stpapi.put.field( "tdsls4101m000", "tdsls040.scom", str$(tcyesno.no)) |Ship Complete
stpapi.put.field( "tdsls4101m000", "tdsls040.eono", tdair101.refa) |Customer PO
ret = stpapi.insert( "tdsls4101m000", 1, error )
if ret = 1 then
stpapi.get.field( "tdsls4101m000", "tdsls040.orno", value )
h.orno = lval(value)
h.return = true
ret = 0
else
h.return = false
endif
|* Insert lines
stpapi.handle.subproc("tdsls4101m000", "tdsls4105s000", "add")
stpapi.continue.process("tdsls4101m000", error)
stpapi.handle.subproc( "tdsls4105s000", "mtdsls00009045", "10" )
| stpapi.handle.subproc("tdsls4105s000", "tdsls4504s000", "kill")
stpapi.enum.answer("tdsls4105s000", "tdsls4102l.01", tcyesno.yes) |Recalculate taxes?
stpapi.enum.answer("tdsls4105s000", "tdsls41043", tcyesno.yes)
stpapi.put.field("tdsls4105s000", "tdsls041.item", tdair101.item) |Item
stpapi.put.field("tdsls4105s000", "tdsls041.oqua", str$(tdair101.dqua)) |Ordered Qty
stpapi.put.field("tdsls4105s000", "tdsls041.cwar", tdair101.cwar) |Warehouse
| stpapi.put.field("tdsls4105s000", "tdsls041.drct", str$(tcyesno.no)) |Direct Delivery?
| stpapi.put.field("tdsls4105s000", "tdsls041.scom", str$(orno)) |Ship Complete
| stpapi.put.field("tdsls4105s000", "tdsls041.epos", tdair101.abid) |Customer PO Position
| stpapi.put.field("tdsls4105s000", "tdsls041.eseq", str$(orno)) |Customer PO Line
ret = stpapi.insert("tdsls4105s000", 1, error)
if strip$(error) <> "" then
message(error)
error.mesg = stpapi.get.mess.code("tdsls4105s000", error.mesg)
endif
if ret = 1 then
stpapi.save("tdsls4105s000", error)
stpapi.get.field( "tdsls4105s000", "tdsls041.pono", value)
h.pono = lval(value)
h.return = true
else
h.return = false
endif
| stpapi.end.session("tdsls4504s000")
stpapi.end.session("tdsls4105s000")
stpapi.end.session("tdsls4101m000")
return(h.return)
}
The sales order header gets created successfully. When I get to ret = stpapi.insert("tdsls4105s000", 1, error) in the debugger, it hangs. If I check the running processes, the process for tdsls4105s000 goes through a cycle of the ticks increasing to a very large number, turning to a negative number, then decreasing, then repeating the cycle. Also, the ntbshell process on the server consumes most of the CPU resources.
I have updated tdsls4102 to the latest objects, and have installed the latest stpapi objects.
Several statements are commented out. I have tried various combinations of these statements being active. I have also tried tdsls4105m000 with no luck. I cannot get the stpapi.change.view function to work in that session to get to the order I want to insert a line for.
Any suggestions/thoughts?
Thanks,
Vince :confused:
function domain tcbool process.tdair101.to.sales.order(ref domain tcorno h.orno, ref domain tcpono h.pono)
{
domain tcbool h.return
long count, ret
h.return = false
string error(100)
string error.mesg(100)
string value(6)
boi.call = "tdboidll0005"
|*tdsls4101m000
| Header
stpapi.put.field( "tdsls4101m000", "tdsls040.orno", "10") |SO Number/Series
stpapi.put.field( "tdsls4101m000", "tdsls040.cuno", tdair101.cuno) |Customer
stpapi.put.field( "tdsls4101m000", "tdsls040.cotp", tdair101.cwar) |Order Type
stpapi.put.field( "tdsls4101m000", "tdsls040.odat", str$(tdair101.date)) |Order Date
stpapi.put.field( "tdsls4101m000", "tdsls040.prdt", str$(tdair101.date)) |Planned Receipt Date
stpapi.put.field( "tdsls4101m000", "tdsls040.ddat", str$(tdair101.date)) |Planned Delivery Date
stpapi.put.field( "tdsls4101m000", "tdsls040.refa", tdair101.refa) |Reference A
stpapi.put.field( "tdsls4101m000", "tdsls040.refb", tdair101.refa) |Reference B
stpapi.put.field( "tdsls4101m000", "tdsls040.scom", str$(tcyesno.no)) |Ship Complete
stpapi.put.field( "tdsls4101m000", "tdsls040.eono", tdair101.refa) |Customer PO
ret = stpapi.insert( "tdsls4101m000", 1, error )
if ret = 1 then
stpapi.get.field( "tdsls4101m000", "tdsls040.orno", value )
h.orno = lval(value)
h.return = true
ret = 0
else
h.return = false
endif
|* Insert lines
stpapi.handle.subproc("tdsls4101m000", "tdsls4105s000", "add")
stpapi.continue.process("tdsls4101m000", error)
stpapi.handle.subproc( "tdsls4105s000", "mtdsls00009045", "10" )
| stpapi.handle.subproc("tdsls4105s000", "tdsls4504s000", "kill")
stpapi.enum.answer("tdsls4105s000", "tdsls4102l.01", tcyesno.yes) |Recalculate taxes?
stpapi.enum.answer("tdsls4105s000", "tdsls41043", tcyesno.yes)
stpapi.put.field("tdsls4105s000", "tdsls041.item", tdair101.item) |Item
stpapi.put.field("tdsls4105s000", "tdsls041.oqua", str$(tdair101.dqua)) |Ordered Qty
stpapi.put.field("tdsls4105s000", "tdsls041.cwar", tdair101.cwar) |Warehouse
| stpapi.put.field("tdsls4105s000", "tdsls041.drct", str$(tcyesno.no)) |Direct Delivery?
| stpapi.put.field("tdsls4105s000", "tdsls041.scom", str$(orno)) |Ship Complete
| stpapi.put.field("tdsls4105s000", "tdsls041.epos", tdair101.abid) |Customer PO Position
| stpapi.put.field("tdsls4105s000", "tdsls041.eseq", str$(orno)) |Customer PO Line
ret = stpapi.insert("tdsls4105s000", 1, error)
if strip$(error) <> "" then
message(error)
error.mesg = stpapi.get.mess.code("tdsls4105s000", error.mesg)
endif
if ret = 1 then
stpapi.save("tdsls4105s000", error)
stpapi.get.field( "tdsls4105s000", "tdsls041.pono", value)
h.pono = lval(value)
h.return = true
else
h.return = false
endif
| stpapi.end.session("tdsls4504s000")
stpapi.end.session("tdsls4105s000")
stpapi.end.session("tdsls4101m000")
return(h.return)
}
The sales order header gets created successfully. When I get to ret = stpapi.insert("tdsls4105s000", 1, error) in the debugger, it hangs. If I check the running processes, the process for tdsls4105s000 goes through a cycle of the ticks increasing to a very large number, turning to a negative number, then decreasing, then repeating the cycle. Also, the ntbshell process on the server consumes most of the CPU resources.
I have updated tdsls4102 to the latest objects, and have installed the latest stpapi objects.
Several statements are commented out. I have tried various combinations of these statements being active. I have also tried tdsls4105m000 with no luck. I cannot get the stpapi.change.view function to work in that session to get to the order I want to insert a line for.
Any suggestions/thoughts?
Thanks,
Vince :confused: