croezen
1st April 2011, 16:02
hi guys,
I am using "stpapi.change.view" when i want to check if the bom already exists and i want to insert.


stpapi.put.field(l.ses, "tibom010.mitm", i.mitm)
stpapi.put.field(l.ses, "tibom010.opno", "0")

l.ret = stpapi.change.view(l.ses, o.errmess)

if l.ret <> 1 then
o.OK = false
o.errmess = "BOM present"
goto EndSession
endif


returnvalue : my docu says :
0 = no view found or error occurred and err.mesg is filled
1 = view found and err.mesg is empty
2 = another view found and err.mesg is empty

Now i have an item without BOM and when i use change.view it always returns 2 ????

Is my docu not correct or am i reading it wrong !? what's happening here ?

mark_h
4th April 2011, 15:59
If you want to check if the bom exists prior to inserting - just check the bom table directory. There is no reason for the overhead of stpapi calling a session. Just do a quick select on tibom010 and be done with it.

Besides if you have an item that does not have a BOM - then a return code of 2 is what I would expect. The reason being when I do a find manually - baan returns the first item after the one I entered. So 2 is the code I would expect to be returned.