vsevilla
24th September 2002, 23:30
Hi
I'm trying to make an AFS for session Material To Issue for Production Orders.

The insert doesn't keep the value of sitm and the error message say " Item not Allowed"

I'm in Baan Vc Sp8

Does anyone has an idea on what can be wrong here.

My code is.


function run.main.sess()
{
|*** This function invokes session tisct1501m000
pdno = "T31000046"
sitm = string.set$(" ",9) & "COBLE"
opno = "20"
issu = "400"
dris = "2"
stpapi.put.field("ticst1501mc00", "ticst001.pdno", pdno)
ret.code = stpapi.change.view("ticst1501mc00", err)

if ret.code <> 1 then
err = "Error en orden de fabricación"
err = err & pdno
write.err.record()
else
run.sub.sess()
stpapi.end.session("ticst1501mc00")
endif
}

function run.sub.sess()
{
|*** This function invokes session tcmcs0503m000

ret.code = stpapi.synchronize.dialog("ticst1501mc00", "add", err)
if ret.code then
stpapi.put.field("ticst0101sc00", "ticst001.sitm", sitm)
stpapi.get.field("ticst0101sc00", "ticst001.sitm", m.sitm)
stpapi.put.field("ticst0101sc00", "ticst001.opno", opno)
stpapi.put.field("ticst0101sc00", "ticst001.issu", issu)
stpapi.put.field("ticst0101sc00", "ticst001.dris", dris)
stpapi.get.field("ticst0101sc00", "ticst001.sitm", m.sitm)
ret.code = stpapi.insert("ticst1501mc00",false,err)
if ret.code then
ret.code1 = stpapi.save("ticst1501mc00",err)
endif
if not ret.code or not ret.code1 then
ret.code = stpapi.recover("ticst0101sc00",err)
else
stpapi.get.field("ticst0101sc00", "next.pono", pono)
stpapi.enum.answer("ticst0101sc00", "ticst01011", tcyesno.yes)
stpapi.handle.subproc("ticst0101sc00", "tisfc0207m000", "add")
stpapi.form.command("ticst0101sc00",5,"exec.cont.process", err)
stpapi.end.session("tisfc0207m000")

stpapi.handle.subproc("ticst0101sc00", "tisfc0207m000", "kill")
endif

endif
}

dbinderbr
25th September 2002, 23:07
Hello Sevilla,

I had a problem similar to yours. Have you already done sucessfully another sessions using stpapi functions before?

If you dont and you are sure that everything is right (your code appear to be correct), try to install the solution 115279 in your environment. It was what solved my problem.

I think it's the same problem because the message given "Item not allowed" means that the value sent to the item field was invalid and probably blank, as the item field does not accept an empty value, it is mandatory, you got this message.

vsevilla
3rd October 2002, 15:45
Hi

Thanks for your help but the problem was that i'm in Baan V and the domain of the item field is segmented so the correct call was

stpapi.put.field("session","table.item.segment.2",value)

Thanks again

VSevilla