Paul P
18th September 2006, 12:26
Hi guys,
We're in the process of making cycle counting data entry barcode-enabled by using BaanIV API. Before any physical count data fly from the warehouse to BaanIV, however, we'd like to "reset" all the counted inventory to zero (this feature is built-in in BaanERP). This is assuming that if they can't find the stuff in the actual warehouse, then the counted physical stock should be set to zero. We're implementing this "reset" function through API inside a new BaanIV session. We've debugged this script as well as looked through the API log (afs.log) and found nothing wrong with it. But somehow, when I go back to the session manually (not through API), only the first line in each "view" is reset properly to zero. Could you give me a hand on this, please? Thanks
|****************************** DECLARATION SECTION
declaration:
#pragma used dll ottstpapihand
extern domain tcorno cco
string TempStr(30)
|****************************** CHOICE SECTION
choice.cont.process:
on.choice:
stpapi.browse.view("tdilc5110m000","first.view")
stpapi.get.field("tdilc5110m000","tdilc501.orno",TempStr)
stpapi.enum.answer("tdilc5110m000","tdilc50001",tcyesno.yes)
while lval(TempStr)<>cco
NextView()
endwhile
ZeroAllSets()
NextView()
while lval(TempStr)=cco
ZeroAllSets()
NextView()
endwhile
stpapi.end.session("tdilc5110m000")
|****************************** FIELD SECTION
field.cco:
check.input:
select orno
from tdilc501
where orno=:cco
as set with 1 rows
selectempty
set.input.error("Order not present")
endselect
|****************************** FUNCTION SECTION
functions:
function ZeroCountedQty()
{
stpapi.put.field("tdilc5110m000","tdilc501.cstk","0")
stpapi.update("tdilc5110m000",TRUE,TempStr)
}
function ZeroAllSets()
{
stpapi.browse.set("tdilc5110m000","first.set")
ZeroCountedQty()
while stpapi.browse.set("tdilc5110m000","next.set")=1
ZeroCountedQty()
endwhile
}
function NextView()
{
stpapi.browse.view("tdilc5110m000","next.view")
stpapi.get.field("tdilc5110m000","tdilc501.orno",TempStr)
}
And here's the API log
LOGGING STARTED
18-09-2006
>tdilc5110m000 browse.view
3dll->serv (getxml)
3dll->serv (starttdilc5110m000100)
5serv<-4gl (api.child.startedtdilc5110m0003)
5serv<-4gl (init.ready)
tdilc5110m000(5)-RUNNING:
3dll->serv (first.view5)
tdilc5110m000(5)-RUNNING:first.view
5serv<-4gl (first.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700190
>tdilc5110m000 enum.answer tdilc50001:1
3dll->serv (enum.answertdilc5000115)
tdilc5110m000(5)-RUNNING:enum.answer
5serv<-4gl (enum.answer0)
tdilc5110m000(5)-RUNNING:
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700190
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700190
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700191
>tdilc5110m000 browse.set
3dll->serv (first.set5)
tdilc5110m000(5)-RUNNING:first.set
5serv<-4gl (first.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.setEOF)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 0 No record found
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700191
>tdilc5110m000 browse.set
3dll->serv (first.set5)
tdilc5110m000(5)-RUNNING:first.set
5serv<-4gl (first.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.setEOF)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 0 No record found
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700192
>tdilc5110m000 end.session
3dll->serv (end.program5)
tdilc5110m000(5)-RUNNING:end.program
5dll->serv (tdilc5110m000: exit(5))
3dll->serv (afsscript: exit(3))
Rgds,
Paul
We're in the process of making cycle counting data entry barcode-enabled by using BaanIV API. Before any physical count data fly from the warehouse to BaanIV, however, we'd like to "reset" all the counted inventory to zero (this feature is built-in in BaanERP). This is assuming that if they can't find the stuff in the actual warehouse, then the counted physical stock should be set to zero. We're implementing this "reset" function through API inside a new BaanIV session. We've debugged this script as well as looked through the API log (afs.log) and found nothing wrong with it. But somehow, when I go back to the session manually (not through API), only the first line in each "view" is reset properly to zero. Could you give me a hand on this, please? Thanks
|****************************** DECLARATION SECTION
declaration:
#pragma used dll ottstpapihand
extern domain tcorno cco
string TempStr(30)
|****************************** CHOICE SECTION
choice.cont.process:
on.choice:
stpapi.browse.view("tdilc5110m000","first.view")
stpapi.get.field("tdilc5110m000","tdilc501.orno",TempStr)
stpapi.enum.answer("tdilc5110m000","tdilc50001",tcyesno.yes)
while lval(TempStr)<>cco
NextView()
endwhile
ZeroAllSets()
NextView()
while lval(TempStr)=cco
ZeroAllSets()
NextView()
endwhile
stpapi.end.session("tdilc5110m000")
|****************************** FIELD SECTION
field.cco:
check.input:
select orno
from tdilc501
where orno=:cco
as set with 1 rows
selectempty
set.input.error("Order not present")
endselect
|****************************** FUNCTION SECTION
functions:
function ZeroCountedQty()
{
stpapi.put.field("tdilc5110m000","tdilc501.cstk","0")
stpapi.update("tdilc5110m000",TRUE,TempStr)
}
function ZeroAllSets()
{
stpapi.browse.set("tdilc5110m000","first.set")
ZeroCountedQty()
while stpapi.browse.set("tdilc5110m000","next.set")=1
ZeroCountedQty()
endwhile
}
function NextView()
{
stpapi.browse.view("tdilc5110m000","next.view")
stpapi.get.field("tdilc5110m000","tdilc501.orno",TempStr)
}
And here's the API log
LOGGING STARTED
18-09-2006
>tdilc5110m000 browse.view
3dll->serv (getxml)
3dll->serv (starttdilc5110m000100)
5serv<-4gl (api.child.startedtdilc5110m0003)
5serv<-4gl (init.ready)
tdilc5110m000(5)-RUNNING:
3dll->serv (first.view5)
tdilc5110m000(5)-RUNNING:first.view
5serv<-4gl (first.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700190
>tdilc5110m000 enum.answer tdilc50001:1
3dll->serv (enum.answertdilc5000115)
tdilc5110m000(5)-RUNNING:enum.answer
5serv<-4gl (enum.answer0)
tdilc5110m000(5)-RUNNING:
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700190
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700190
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700191
>tdilc5110m000 browse.set
3dll->serv (first.set5)
tdilc5110m000(5)-RUNNING:first.set
5serv<-4gl (first.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.setEOF)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 0 No record found
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700191
>tdilc5110m000 browse.set
3dll->serv (first.set5)
tdilc5110m000(5)-RUNNING:first.set
5serv<-4gl (first.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.set0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000(5) put.field:tdilc501.cstk 0
>tdilc5110m000 update
3dll->serv (modify.set+save5)
tdilc5110m000(5)-RUNNING:modify.set+save
5serv<-4gl (modify.set+save0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000
>tdilc5110m000 get.field:tdilc501.cstk
<tdilc5110m000(5) get.field:tdilc501.cstk=0
>tdilc5110m000 browse.set
3dll->serv (next.set5)
tdilc5110m000(5)-RUNNING:next.set
5serv<-4gl (next.setEOF)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 0 No record found
>tdilc5110m000 browse.view
3dll->serv (next.view5)
tdilc5110m000(5)-RUNNING:next.view
5serv<-4gl (next.view0)
tdilc5110m000(5)-RUNNING:
<tdilc5110m000 1 ok
>tdilc5110m000 get.field:tdilc501.orno
<tdilc5110m000(5) get.field:tdilc501.orno=700192
>tdilc5110m000 end.session
3dll->serv (end.program5)
tdilc5110m000(5)-RUNNING:end.program
5dll->serv (tdilc5110m000: exit(5))
3dll->serv (afsscript: exit(3))
Rgds,
Paul