raikar_raviraj
15th February 2008, 06:07
Hi,
I am writting an AFS to make an entry in Session tfacp1200s000. Batch Already Exists and entry is present in tfacp1100s000.
I am facing a problem in doing so. When i use stpapi.continue.process("tfacp1110s000", error ) the subsession tfacp1200s000 doesnt open. Hence when i try to insert values in subsession tfacp1200s000 it gives an error "Session not Available".
If i use ret = stpapi.insert ("tfacp1110s000", 1, error) instead of stpapi.update method the subsession opens on continue process but as record already exists in session tfacp1110s000 i am not suppose to make another entry in it. I tried playing with the code but to no avail. I have also gone through Baanboard but didnt find solution for the same.
If anybody could help in this regard then it would be great.
The source code for the same is as below.
function afs.post.jv()
{
domain ltstr15 name,ttyp
domain tcccur ccur,ccty
long year,docn,dbcr,month,day
year = tfgld100.year
ttyp = tfgld101.ttyp
stpapi.put.field("tfgld1101m000","tfgld101.year",str$(year))
stpapi.put.field("tfgld1101m000","tfgld101.btno",str$(tfgld100.btno))
stpapi.put.field("tfgld1101m000","tfgld101.ttyp",ttyp)
ret = stpapi.find("tfgld1101m000", error )
if ret = 1 then
stpapi.put.field("tfgld1101m000","tfgld101.year",str$(year))
stpapi.put.field("tfgld1101m000","tfgld101.btno",str$(tfgld100.btno))
stpapi.put.field("tfgld1101m000","tfgld101.ttyp",ttyp)
stpapi.handle.subproc("tfgld1101m000","tfacp1110s000","add")
ret=stpapi.mark("tfgld1101m000")
stpapi.continue.process( "tfgld1101m000", error )
amnt = 100
stpapi.put.field("tfacp1110s000","tfacp200.ttyp",str$(tfgld101.ttyp))
stpapi.put.field("tfacp1110s000","tfacp200.ninv",str$(docno))
stpapi.put.field("tfacp1110s000", "tfacp200.suno",str$(suno))
stpapi.put.field("tfacp1110s000", "tfacp200.docd", str$(docd))
ret = stpapi.find("tfacp1110s000", error )
stpapi.put.field("tfacp1110s000", "tfacp200.ccur", str$(ccur))
stpapi.put.field("tfacp1110s000", "screen.amnt", str$(amnt))
stpapi.put.field("tfacp1110s000", "tfacp200.isup", str$(isup))
stpapi.handle.subproc("tfacp1110s000","tfacp1120s000","add")
ret = stpapi.update("tfacp1110s000", 1, error)
if ret<> 1 then
message("%s",error)
endif
stpapi.continue.process("tfacp1110s000", error )
enter.purchase.invoice.transaction()
stpapi.end.session("tfacp1110s000")
else
stpapi.recover("tfgld1101m000", error )
endif
stpapi.end.session("tfgld1101m000")
stpapi.end.session("tfgld1506s000")
}
function enter.purchase.invoice.transaction()
{
stpapi.put.field("tfacp1120s000","tfgld102.leac",str$(2615))
stpapi.put.field("tfacp1120s000","tfgld102.dim2",shiftl$(shiftr$("5")))
stpapi.put.field("tfacp1120s000","tfgld102.dim1",str$(1999))
stpapi.put.field("tfacp1120s000","amount",str$(100))
ret = stpapi.insert("tfacp1120s000", 1, error )
if ret <> 1 then
message("%s",error)
stpapi.recover("tfacp1120s000", error )
endif
stpapi.end.session("tfacp1120s000")
}
I am writting an AFS to make an entry in Session tfacp1200s000. Batch Already Exists and entry is present in tfacp1100s000.
I am facing a problem in doing so. When i use stpapi.continue.process("tfacp1110s000", error ) the subsession tfacp1200s000 doesnt open. Hence when i try to insert values in subsession tfacp1200s000 it gives an error "Session not Available".
If i use ret = stpapi.insert ("tfacp1110s000", 1, error) instead of stpapi.update method the subsession opens on continue process but as record already exists in session tfacp1110s000 i am not suppose to make another entry in it. I tried playing with the code but to no avail. I have also gone through Baanboard but didnt find solution for the same.
If anybody could help in this regard then it would be great.
The source code for the same is as below.
function afs.post.jv()
{
domain ltstr15 name,ttyp
domain tcccur ccur,ccty
long year,docn,dbcr,month,day
year = tfgld100.year
ttyp = tfgld101.ttyp
stpapi.put.field("tfgld1101m000","tfgld101.year",str$(year))
stpapi.put.field("tfgld1101m000","tfgld101.btno",str$(tfgld100.btno))
stpapi.put.field("tfgld1101m000","tfgld101.ttyp",ttyp)
ret = stpapi.find("tfgld1101m000", error )
if ret = 1 then
stpapi.put.field("tfgld1101m000","tfgld101.year",str$(year))
stpapi.put.field("tfgld1101m000","tfgld101.btno",str$(tfgld100.btno))
stpapi.put.field("tfgld1101m000","tfgld101.ttyp",ttyp)
stpapi.handle.subproc("tfgld1101m000","tfacp1110s000","add")
ret=stpapi.mark("tfgld1101m000")
stpapi.continue.process( "tfgld1101m000", error )
amnt = 100
stpapi.put.field("tfacp1110s000","tfacp200.ttyp",str$(tfgld101.ttyp))
stpapi.put.field("tfacp1110s000","tfacp200.ninv",str$(docno))
stpapi.put.field("tfacp1110s000", "tfacp200.suno",str$(suno))
stpapi.put.field("tfacp1110s000", "tfacp200.docd", str$(docd))
ret = stpapi.find("tfacp1110s000", error )
stpapi.put.field("tfacp1110s000", "tfacp200.ccur", str$(ccur))
stpapi.put.field("tfacp1110s000", "screen.amnt", str$(amnt))
stpapi.put.field("tfacp1110s000", "tfacp200.isup", str$(isup))
stpapi.handle.subproc("tfacp1110s000","tfacp1120s000","add")
ret = stpapi.update("tfacp1110s000", 1, error)
if ret<> 1 then
message("%s",error)
endif
stpapi.continue.process("tfacp1110s000", error )
enter.purchase.invoice.transaction()
stpapi.end.session("tfacp1110s000")
else
stpapi.recover("tfgld1101m000", error )
endif
stpapi.end.session("tfgld1101m000")
stpapi.end.session("tfgld1506s000")
}
function enter.purchase.invoice.transaction()
{
stpapi.put.field("tfacp1120s000","tfgld102.leac",str$(2615))
stpapi.put.field("tfacp1120s000","tfgld102.dim2",shiftl$(shiftr$("5")))
stpapi.put.field("tfacp1120s000","tfgld102.dim1",str$(1999))
stpapi.put.field("tfacp1120s000","amount",str$(100))
ret = stpapi.insert("tfacp1120s000", 1, error )
if ret <> 1 then
message("%s",error)
stpapi.recover("tfacp1120s000", error )
endif
stpapi.end.session("tfacp1120s000")
}