Jothilingam
26th September 2006, 14:18
Hi All

The following is the code I had written to automate the session
whinh5101s000., I get an error message while (stpapi.insert line) inserting the data
'Count Number' Not Found in table Cycle Counting / Adjustment Order
Is it any parameter setting or its a afs technical issue?
can any one help me to solve this issue.

Version - Baan5b
Service Pack - till 10

select whinh500.*
from whinh500
where whinh500._index1 = {:orno}
selectdo
endselect

stpapi.synchronize.dialog("whinh5501m000", "add", err.msg)
if isspace(err.msg) then
stpapi.put.field("whinh5101s000","whinh501.orno", orno)
stpapi.put.field("whinh5101s000","whinh501.cntn", "0")|str$(whinh500.cntn))
stpapi.put.field("whinh5101s000","whinh501.pono", str$(pono*10))
stpapi.put.field("whinh5101s000","whinh501.item", teinh230.item)
stpapi.put.field("whinh5101s000","whinh501.loca", teinh230.loca)
stpapi.put.field("whinh5101s000","whinh501.date", str$(teinh230.trdt))
stpapi.put.field("whinh5101s000","whinh501.stun", tcibd001.cuni)
stpapi.put.field("whinh5101s000","whinh501.vstr", str$(teinh230.astr))
stpapi.put.field("whinh5101s000","whinh501.cdat", str$(teinh230.trdt))
stpapi.put.field("whinh5101s000","whinh501.recd", "INVTRF")
stpapi.enum.answer("whinh5101s000","whinh501.csts", tcyesno.yes)
stpapi.insert("whinh5101s000", true,err.msg)
if not isspace(err.msg) then
message(err.msg)
stpapi.recover("whinh5101s000", recover.msg)
stpapi.end.session("whinh5101s000")
break
else
endif
stpapi.end.session("whinh5101s000")
stpapi.end.session("whinh5501m000")

mark_h
26th September 2006, 15:38
Only one other post on this session - check this out (http://www.baanboard.com/baanboard/showthread.php?t=9467&highlight=whinh5101s000). The only reason I posted it was because it mentioned segmented item and it does not look like you are doing that. Since I do not work on Baan 5 I am not sure if this is important or not.

Jothilingam
27th September 2006, 14:53
Hi All

Still the problem not solved, Can someone help me

mark_h
27th September 2006, 22:50
Did you try order number and count followed by the change.view? Just like the other post. It may also be that you need new objects for the session or stpapi.

Jothilingam
28th September 2006, 17:12
Mark

I tried even that, but still not solved...
As you told, it might be because of the object too..
or to have the latest objects of afs....

lakoon
11th October 2006, 14:19
Hello

Start with calling the main session first.
Below an example how I solved the task.

/lakoon



#define INV.MAIN "whinh5500m000"
#define INV.SUB "whinh5501m000"
#define INV.SUB.2 "whinh5101s000"

stpapi.put.field(INV.MAIN, "whinh500.orno", orno)
stpapi.put.field(INV.MAIN, "whinh500.cntn", str$(cntn))
ret.find = stpapi.find(INV.MAIN, err.msg)
if ret.find = 1 then
ret.mark = stpapi.mark(INV.MAIN, err.msg)
if ret.mark then
stpapi.handle.subproc(INV.MAIN, INV.SUB, "add")
stpapi.form.command(INV.MAIN, 5, "exec.user.0", err.msg)
if not isspace(err.msg) then
|Not o.k.
get.api.messages(INV.MAIN,
orno & "|" & str$(cntn))
ret.reco = stpapi.recover(INV.MAIN, rec.msg)
else
|o.k.
if pono <> 0 then
|existing position
update.inventory.quantity()
else
|new posistion
insert.inventory.quantity()
endif
endif
else
get.api.messages(INV.MAIN, "")
ret.reco = stpapi.recover(INV.MAIN, rec.msg)
endif
else
get.api.messages(INV.MAIN, "")
ret.reco = stpapi.recover(INV.MAIN, rec.msg)
endif
stpapi.end.session(INV.MAIN, err.msg)

function update.inventory.quantity()
{
stpapi.put.field(INV.SUB, "whinh501.pono", str$(pono))
ret.find = stpapi.find(INV.SUB, err.msg)
if ret.find = 1 then
ret.sync = stpapi.synchronize.dialog(INV.SUB, "modify", err.msg)
if ret.sync then
stpapi.put.field(INV.SUB.2, "whinh501.cstr", str$(qstr))
stpapi.put.field(INV.SUB.2, "whinh501.cdat", str$(cdat))
stpapi.put.field(INV.SUB.2, "whinh501.cadj", str$(cadj))
ret.upd = stpapi.update(INV.SUB, true, err.msg)
if ret.upd then
trans.result(1) = "Update O.K."
send.data.to.client(0,1)
else
get.api.messages(INV.SUB, "")
ret.reco = stpapi.recover(INV.SUB, rec.msg)
endif
else
get.api.messages(INV.SUB, "")
ret.reco = stpapi.recover(INV.SUB, rec.msg)
endif
else
get.api.messages(INV.SUB, "")
ret.reco = stpapi.recover(INV.SUB, rec.msg)
endif
stpapi.end.session(INV.SUB.2, err.msg)
stpapi.end.session(INV.SUB, err.msg)
}

Jothilingam
12th October 2006, 08:33
Hi Lakoon

Thanks a lot., I will try it and let you know...

ajay_vishal
28th February 2007, 20:02
Hi Lakoon
I am trying to automate Cycle Counting order generation. However, I am getting an error message "Item not allowed" upon saving. Do you have any idea about it? I believe my Item code is not populaing somehow, though I have checked AFS Log file and also through debugger that I am able to pass correct item code. Moreover, the same item code with the same value for other input fields are going fine when entered from front end. Please suggest.

Also, could you please provide the script of the function "insert.inventory.quantity()" as used in your code.

I am working on BaaN 5c.

thanks & regards,
ajay verma


Hello

Start with calling the main session first.
Below an example how I solved the task.

/lakoon



#define INV.MAIN "whinh5500m000"
#define INV.SUB "whinh5501m000"
#define INV.SUB.2 "whinh5101s000"

stpapi.put.field(INV.MAIN, "whinh500.orno", orno)
stpapi.put.field(INV.MAIN, "whinh500.cntn", str$(cntn))
ret.find = stpapi.find(INV.MAIN, err.msg)
if ret.find = 1 then
ret.mark = stpapi.mark(INV.MAIN, err.msg)
if ret.mark then
stpapi.handle.subproc(INV.MAIN, INV.SUB, "add")
stpapi.form.command(INV.MAIN, 5, "exec.user.0", err.msg)
if not isspace(err.msg) then
|Not o.k.
get.api.messages(INV.MAIN,
orno & "|" & str$(cntn))
ret.reco = stpapi.recover(INV.MAIN, rec.msg)
else
|o.k.
if pono <> 0 then
|existing position
update.inventory.quantity()
else
|new posistion
insert.inventory.quantity()
endif
endif
else
get.api.messages(INV.MAIN, "")
ret.reco = stpapi.recover(INV.MAIN, rec.msg)
endif
else
get.api.messages(INV.MAIN, "")
ret.reco = stpapi.recover(INV.MAIN, rec.msg)
endif
stpapi.end.session(INV.MAIN, err.msg)

function update.inventory.quantity()
{
stpapi.put.field(INV.SUB, "whinh501.pono", str$(pono))
ret.find = stpapi.find(INV.SUB, err.msg)
if ret.find = 1 then
ret.sync = stpapi.synchronize.dialog(INV.SUB, "modify", err.msg)
if ret.sync then
stpapi.put.field(INV.SUB.2, "whinh501.cstr", str$(qstr))
stpapi.put.field(INV.SUB.2, "whinh501.cdat", str$(cdat))
stpapi.put.field(INV.SUB.2, "whinh501.cadj", str$(cadj))
ret.upd = stpapi.update(INV.SUB, true, err.msg)
if ret.upd then
trans.result(1) = "Update O.K."
send.data.to.client(0,1)
else
get.api.messages(INV.SUB, "")
ret.reco = stpapi.recover(INV.SUB, rec.msg)
endif
else
get.api.messages(INV.SUB, "")
ret.reco = stpapi.recover(INV.SUB, rec.msg)
endif
else
get.api.messages(INV.SUB, "")
ret.reco = stpapi.recover(INV.SUB, rec.msg)
endif
stpapi.end.session(INV.SUB.2, err.msg)
stpapi.end.session(INV.SUB, err.msg)
}

mark_h
2nd March 2007, 19:06
Hi Lakoon
I am trying to automate Cycle Counting order generation. However, I am getting an error message "Item not allowed" upon saving. Do you have any idea about it? I believe my Item code is not populaing somehow, though I have checked AFS Log file and also through debugger that I am able to pass correct item code. Moreover, the same item code with the same value for other input fields are going fine when entered from front end. Please suggest.

Also, could you please provide the script of the function "insert.inventory.quantity()" as used in your code.

I am working on BaaN 5c.

thanks & regards,
ajay verma

I take it you saw this post (http://www.baanboard.com/baanboard/forumdisplay.php?f=59).