lakoon
20th August 2004, 14:54
Hello

I have the following situation:

Inserting a sales order line with always starting the subprocess and ending at the end works perfectly.

If I try to insert serveral sales order lines without ending the subsession i get for the second position during the stpapi.insert() call the error message:

"Link on stack failed zero pointer pushed"
"Can not continue in tdsls4102s000 in DLL: ottstpstandard (get.company)"

What is the sequence of the stpapi calls that I am able to insert several lines at once?

My code (creates the error):


stpapi.put.field("tdsls4101m000", "tdsls040.orno", str$(orno$))
ret.find = stpapi.find("tdsls4101m000")
stpapi.handle.subproc("tdsls4101m000", "tdsls4102s000", "add")
stpapi.continue.process("tdsls4101m000", e.mess)
select mytyble_with_position
selectdo
stpapi.put.field("tdsls4102s000", "tdsls041.item", str$(item$))
...
ret.ins = stpapi.insert("tdsls4102s000", true, e.mess)
if not ret.ins then
ret.rec = stpapi.recover("tdsls4102s000", e.mess)
endif
endselect
stpapi.end.session("tdsls4102s000", e.mess)
stpapi.end.session("tdsls4101m000",e.mess)


Thanks for any hint.

/lakoon

mark_h
20th August 2004, 16:05
In theory you should be able to start a session, insert multiple records, then close the session. I have run into the same problem you have in the past, that is why I usually recommend always opening and closing a session between inserts.

I am also not sure why some of my function servers have to be limited to how many records they can process. My theory is that the back ground session is leaving something in memory and not really completely cleaning up after itself. Usually these get a base_extern error or something like that.

Mark

lakoon
20th August 2004, 16:20
Hello Mark

Thank you for your reply.

I see I have to open and close for each line. It's just that I loose in this way a lot of performance. At the moment a line needs appr. 7 seconds to insert. This is because a the end of the session all the discounts and cost item routines are executed, which would really not be necessary.

I have to look for a workaround....

/lakoon

mark_h
20th August 2004, 16:48
Well the good news is that I just check the last copy of "AFS Sessions" supported and these two session (tdsls4101m000 and tdsls4102s000) are on the list. Maybe if you report the problem to Baan they can fix it.

For grins and giggles you might want to try a stpapi.clear() before the first put on the subsession. Not sure this will help, but it is something to try.

Mark

lakoon
20th August 2004, 17:36
I tryed this already.
The stpapi.clear() just creats the same error message as soon it is executed.

Thanks for the hint, we will place a call at baan.

/lakoon