Nicole
26th October 2011, 12:10
Hi all,

I try the following statement:

stpapi.put.field ("tswty3102m000", "tswty102.nlhl", e.nlhl)
stpapi.put.field ("tswty3102m000", "tswty102.idat", str$(e.idat))
stpapi.put.field ("tswty3102m000", "tswty102.ddat", str$(e.idat))
stpapi.put.field ("tswty3102m000", "tswty102.cins", e.cins)
stpapi.put.field ("tswty3102m000", "tswty102.clot", e.cins)
stpapi.put.field ("tswty3102m000", "tswty102.ctyp", tswty102.citg)
stpapi.put.field ("tswty3102m000", "tswty102.cloc", e.cloc)
stpapi.put.field ("tswty3102m000", "tswty102.ilog", logname$)
stpapi.put.field ("tswty3102m000", "tswty102.iidt", str$(date.num()))
stpapi.put.field ("tswty3102m000", "tswty102.iitm", str$(time.num()))
retval1 = stpapi.insert ("tswty3102m000", true, err.msg)
if not retval1 then
retval2 = stpapi.recover ("tswty3102m000", rec.msg)
endif

stpapi.end.session ("tswty3102m000")



Variable err.msg contains the message "Session not available". No record was inserted. What can be the reason for this message?

Thanks.

Nicole

mark_h
26th October 2011, 15:44
It looks simple enough and there can be multiple reasons that "Session not available" pops up. Also make sure all the input fields are strings - usually something like ctyp is an enumerated domain. So you can use str$(tcyesno.yes) or str$(tswty102.citg) on something like it.

If the above does not work and this is a session you developed or one you have source code for. What I would recommend is putting tswty3102m000 in debug mode. The very first stpapi.put should start the session in debug mode. You can step thru both the session and the stpapi code to see where the issue is.