jatin_sanghi
11th February 2005, 17:09
Hi,

I'am facing a problem when running AFS for running session tdilc1120m000. I have to run this session for only inventory adjusments, but whenever i'am going to subsession tdilc1121s000, the AFS session hangs.

I have checked through the debugger, and found that the session hangs only when i get to the first " stpapi.put.field" command for tdilc1121s000 and after that nothing happens. Finally i have to abort.

So, i get the entries in tdinv100 with active status and nothing anywhere else.

Please help me out as this is very urgent and needs to be sorted out.
The script i'am using is attached along with the post.

Eagerly waiting for a reply..
Jatin

kbartelds
11th February 2005, 17:28
I'm attaching my script for stock corrections (and transfers), it's working. You will see some dutch in it, but you will get the idea. If you have any questions, send me a PM.
The input comes from a customized table, this can be changed to fixed values or form values. The idea is to simply enter transactions which will be stored in the table, after that this program will take care of the stock transaction.

Regards,
Klaas

jatin_sanghi
12th February 2005, 07:23
Hi Klaas,

Thank for ur reply, based on ur script i have changed my script, but the same thing is coming up again, ie, the session hangs as it reaches the first stpapi.put statement for tdilc1121s000.

Please see if there are any more modifications to be made.

Regards,
jatin

jatin_sanghi
12th February 2005, 08:44
Hi Klaas,

Thank for ur reply, based on ur script i have changed my script, but the same thing is coming up again, ie, the session hangs as it reaches the first stpapi.put statement for tdilc1121s000.

Please see if there are any more modifications to be made.

Regards,
jatin

mark_h
12th February 2005, 17:58
Please do not cross post. Pick a forum and make your post and moderators will move it around.

Next make sure you have the latest stpapi patches and the latest objects for the sessions. Sometimes this will fix the problem. The only thing I noticed was that when I do the stpapi.get in my session I do it before I do the continue on tdilc1120m000. This way I have the fields when tdilc1121s000 comes up. Also as suggested in one of the other posts - do it buy had and make sure there are no messages coming up that are not being accounted for in the scripts.

Mark

kbartelds
14th February 2005, 16:23
Looks to me your script is missing:

stpapi.put.field("tdilc1121s000","tdilc102.clot",clot(1,cur.stock.point))
stpapi.put.field("tdilc1121s000","tdilc102.date",str$(date(cur.stock.point)))
stpapi.put.field("tdilc1121s000","tdilc102.loca",tdilc911.loca)
stpapi.put.field("tdilc1121s000","tdilc102.stun",stun(1,cur.stock.point))

clot might not be a problem, date and loca could be a problem if omitted. Can you post a log file for one run?

Regards,
Klaas

Kingsto88
23rd March 2005, 05:19
Hi Klaas and Mark,

I am using your sample and modified the script to below:
But after running, I checked that tdinv100 is added but not tdilc103.
Also when i look at tmp.orno, it is blank, so is that the reason why tdilc103 is not created. Why get.field is not working?

Appreciate your assistance with this.

Thanks and regards

long ret
string tmp.orno(6)
stpapi.put.field("tdilc1120m000","tdinv100.item",var.item)
stpapi.put.field("tdilc1120m000","tdinv100.cwar",ln.cwar)
stpapi.put.field("tdilc1120m000","tdinv100.idat",str$(date.num()))
stpapi.put.field("tdilc1120m000","tdinv100.sern","1")
stpapi.put.field("tdilc1120m000","tdinv100.kowt",str$(etol(tckowt.wrh.transfer)))
stpapi.put.field("tdilc1120m000","tdinv100.odat",str$(date.num()))
stpapi.put.field("tdilc1120m000","tdinv100.pdat",str$(date.num()))
stpapi.put.field("tdilc1120m000","tdinv100.trdt",str$(date.num()))
stpapi.put.field("tdilc1120m000","tdinv100.pqan",ln.pric)
stpapi.put.field("tdilc1120m000","tdinv100.dwar",ln.cwar)
ret = stpapi.insert("tdilc1120m000",1,msg)
message("%d %s",ret,msg)
if not ret then
stpapi.recover("tdilc1120m000",msg)
else
stpapi.get.field("tdilc1120m000","tdilc100.wrho",tmp.orno)
message("or %s ",tmp.orno)
endif
if ret then
stpapi.put.field("tdilc1120m000","tdinv100.wrho",tmp.orno)
stpapi.find("tdilc1120m000",msg)
message("find %s",msg)
stpapi.handle.subproc("tdilc1120m000","tdilc1122s000","add")
stpapi.continue.process("tdilc1120m000",msg)
message("cont %s",msg)
if isspace(msg) then
stpapi.put.field("tdilc1122s000","tdilc103.sufr","PCS")
stpapi.put.field("tdilc1122s000","tdilc103.suto","PCS")
stpapi.put.field("tdilc1122s000","tdilc103.lcfr",ln.oldloc)
stpapi.put.field("tdilc1122s000","tdilc103.qstr",ln.pric)
stpapi.put.field("tdilc1122s000","tdilc103.qstk",ln.pric)
stpapi.put.field("tdilc1122s000","tdilc103.strt",ln.pric)
stpapi.put.field("tdilc1122s000","tdilc103.tofr",ln.newloc)
stpapi.insert("tdilc1122s000",1,msg)
endif
stpapi.end.session("tdilc1122s000")
endif
stpapi.end.session("tdilc1120m000")

kbartelds
23rd March 2005, 10:29
Hi,

I think the record in tdinv100 is not created, but is already there. In your script you use:
stpapi.put.field("tdilc1120m000","tdinv100.sern","1")
so if there is already a record present for your (test?) data insert action will fail. sern should be determined based on records present in tdinv100.

Second: the get.field will not work, because the field tdilc100.wrho does not exist. This should be tdinv100.wrho I guess.

Might be a good idea to run the script in debugger and at the same time have a look at what information is added to the afs.log

Good luck!

Regards,
Klaas

Kingsto88
23rd March 2005, 11:12
Hi Klaas

Thanks for the reply.
I took out the sern "1" and also changed tdilc100 to tdinv100.
Thanks for seeing my mistake.
BUT the records in tdilc103 is still not created. Now the tdinv100 is created and the tmp.orno captures the new order number BUT no record is created in tdilc103.

Can you see any other errors I have done?

Appreciate it and thanks.

rgds

Kingsto88
23rd March 2005, 11:26
Hi Klass,

After writing my last comment, i went thru the program again.
Noticed my mistake

I entered a field which is wrong. There is no such field tofr. It is suppose to be lcto !!
So now it is working fine !!

Thanks and regards