Sandy Blondino
17th January 2014, 20:30
Hello,
I have a question about an AFS session for tisfc0202m000. I've written the AFS code, and the first problem I've encountered is that when the two pop-up messages appear and I answer 'yes' to both of them, it seems like the second message "Post to Inventory" never gets answered.
Has anyone else encountered this behavior and how did you get past it?
Thanks for any help,
Sandy
Here is the code snippet.
stpapi.put.field("tisfc0202m000", "tisfc001.pdno", str$(t.pdno))
retval = stpapi.find("tisfc0202m000", err.msg)
if retval = 1 then
stpapi.put.field("tisfc0202m000", "qdlv.frm", str$(temp.qty))
if not isspace(err.msg) then
temp.msg = err.msg
stpapi.recover("tisfc0202m000", err.msg)
errhit = 1
endif
if errhit <> 1 then
| Update all preceeding operations? yes
stpapi.enum.answer("tisfc0202m000", "tisfc01021", tcyesno.yes)
| Post to inventory? yes
stpapi.enum.answer("tisfc0202m000", "tisfc02029", tcyesno.yes)
stpapi.handle.subproc("tisfc0202m000", "tdilc4113s000", "add")
stpapi.continue.process("tisfc0202m000", err.msg)
....
bhushanchanda
17th January 2014, 21:40
Hi,
Search for similar threads on the board.
Example 1 (http://www.baanboard.com/baanboard/showthread.php?t=24296&highlight=tisfc0202m000)
Example 2 (http://www.baanboard.com/baanboard/showthread.php?t=24481)
Example 3 (http://www.baanboard.com/baanboard/showthread.php?p=174477)
I hope they put some light.
mark_h
18th January 2014, 02:13
And please only post in one forum.
mark_h
18th January 2014, 02:17
Always make sure the questions are answered before they are asked. You can see below were I update first the warehouse. But before I update the qty delivered I aswer 3 questions first. You can even see where one service pack baan started asking a new question on us.
function extern complete_prod_order( domain tcorno prod.pdno,
domain tccwar prod.cwar,
ref string msg())
{
long rc
string qcmp(20) |, hold.msg(120)
stpapi.put.field("tisfc0202m000","tisfc001.pdno",str$(prod.pdno))
rc = stpapi.find("tisfc0202m000",msg)
| rc = stpapi.change.view( "tisfc0202m000", msg)
if not isspace(msg) or rc<>1 then
| 20050615.st
| stpapi.end.session("tisfc0507m000") | 20050615.end
stpapi.end.session("tisfc0202m000")
return
endif
| Update the warehouse
stpapi.put.field("tisfc0202m000","tisfc001.cwar",prod.cwar)
rc = stpapi.update("tisfc0202m000",1,msg)
if not isspace(msg) or rc<>1 then
| 20050615.st
| stpapi.end.session("tisfc0507m000") | 20050615.end
stpapi.end.session("tisfc0202m000")
return
endif
stpapi.get.field("tisfc0202m000","qdlv.frm",qcmp)
| 20070705.st Add answer for tpbop question
rc = stpapi.enum.answer("tisfc0202m000","ticontactpsa",tcyesno.no) | 20070705.end
rc = stpapi.enum.answer("tisfc0202m000","tisfc02024",tcyesno.yes)
rc = stpapi.enum.answer("tisfc0202m000","tisfc02029",tcyesno.yes)
stpapi.put.field("tisfc0202m000","tisfc001.cwar",prod.cwar)
stpapi.continue.process("tisfc0202m000",msg)
if isspace(msg) then
rc = stpapi.update("tisfc0202m000",1,msg)
stpapi.get.mess.code("tisfc0202m000",msg)
| stpapi.get.field("tisfc0202m000","tisfc001.osta",qcmp)
| stpapi.get.field("tisfc0202m000","tisfc001.pdno",qcmp)
| End both sessions.
endif
| 20050523.st Try commenting it out.
| stpapi.end.session("tisfc0507m000")
stpapi.end.session("tisfc0202m000")
}
Put all the threads together and will move to AFS forum.
Sandy Blondino
23rd January 2014, 20:12
Thanks for the suggestions and code snippets. But I'm still having a problem with this AFS session.
After the AFS session has completed, I go back to the tisfc0202m000 session to check the record. The "Qty to deliver" field is filled in as expected, but the second enum message has been ignored by the AFS code, even though I call it in my code. Then I manually click on "Rep complete" and the second enum message appears, and the tisfc0202m000 session will continue as expected. The second enum message is "Post to inventory"
Any suggestions?
Thanks for the help,
Sandy
mark_h
24th January 2014, 19:39
Post you code again - I see problems with what is above. But honestly it should be this easy after you find the production order.
stpapi.get.field("tisfc0202m000","qdlv.frm",qcmp)
| 20070705.st Add answer for tpbop question
rc = stpapi.enum.answer("tisfc0202m000","ticontactpsa",tcyesno.no) | rc = stpapi.enum.answer("tisfc0202m000","tisfc02024",tcyesno.yes)
rc = stpapi.enum.answer("tisfc0202m000","tisfc02029",tcyesno.yes)
stpapi.put.field("tisfc0202m000","tisfc001.cwar",prod.cwar)
stpapi.continue.process("tisfc0202m000",msg)
If you still have issues it could be the session code or the stpapi libraries.
Sandy Blondino
24th January 2014, 20:10
Hi Mark,
Here is the code snippet.
As you can see I've moved the put.field for qdlv.frm several times and nothing seems to work.
stpapi.put.field("tisfc0202m000", "tisfc001.pdno", str$(t.pdno))
retval = stpapi.find("tisfc0202m000", err.msg)
if retval = 1 then
stpapi.put.field("tisfc0202m000", "qdlv.frm", str$(temp.qty))
if not isspace(err.msg) then
temp.msg = err.msg
stpapi.recover("tisfc0202m000", err.msg)
errhit = 1
endif
if errhit <> 1 then
| Update all preceeding operations? yes
retval = stpapi.enum.answer("tisfc0202m000", "tisfc01021", tcyesno.yes)
| Post to inventory? yes
retval = stpapi.enum.answer("tisfc0202m000", "tisfc02029", tcyesno.yes)
|stpapi.put.field("tisfc0202m000", "qdlv.frm", str$(2.00))
| subsession tdilc4113s000 Maintain Receipts (ILC) is called
stpapi.handle.subproc("tisfc0202m000", "tdilc4113s000", "add")
|click on 'Rep Complete' button
stpapi.continue.process("tisfc0202m000", err.msg)
stpapi.put.field("tdilc4113s000","tdilc402.stun","PCS")
stpapi.put.field("tdilc4113s000","tdilc402.qstr",str$(temp.qty))
stpapi.put.field("tdilc4113s000","tdilc402.qstc",str$(temp.qty))
retval = stpapi.update("tdilc4113s000",1,err.msg)
retval = stpapi.save("tdilc4113s000", err.msg)
if not isspace(err.msg) or retval<>1 then
stpapi.end.session("tdilc4113s000")
stpapi.end.session("tisfc0507m000")
stpapi.end.session("tisfc0202m000")
return(false)
else
stpapi.end.session("tdilc4113s000")
retval = stpapi.update("tisfc0202m000",1,err.msg)
if not isspace(err.msg) or retval<>1 then
stpapi.end.session("tisfc0507m000")
stpapi.end.session("tisfc0202m000")
endif
endif
stpapi.get.mess.code("tisfc0202m000",err.msg)
mark_h
24th January 2014, 22:52
(1) What is the default answer for tisfc02029 on your system?
(2) Do you own source to where you could debug tisfc0202m000?
(3) In debug mode - what happens when you hit the stpapi.continue? Do you see the process for tdilc4113s000 launch in your processes? I usually start a shell, use ps to watch what happens. Make sure the process is a child to tisfc0202m000. It might actually be tdilc4113s000 that is causing the problem. You might even want to try some get fields on tdilc4113s000 to make sure it is zooming correctly.
Sandy Blondino
24th January 2014, 23:07
Hi Mark,
1.) the default answer is yes for tisfc02029
2.) We don't own source code
3.) In debug mode, I don't get an error. I can just step to the next step.
In the shell, I can see the processes launch for the AFS script and they are exactly the same sequence as when I run the tisfc0202m000 session manually. I can see tisfc0202m000, tisfc0507m00 and tdilc4113s000 launch in the processes.
I'll try using the get.fields and see what values I get.
Thanks for your response,
Sandy
mark_h
25th January 2014, 01:42
(1) Darn sometimes the default answer gets in the way.
(2) Makes this tough sometimes.
(3) The question is which session is controlling it - and does it get launched okay. Attached a quick snapshot so you can see which session is parent. Did not run my afs code because we do no use tdilc4113 for it - just receipts.