jojovalenton
20th March 2014, 13:00
Dear LN Expert,

Anybody can help me resolve on how to catch interactive YES/NO message from the standard session and run in AFS. The script below is the sample i used for the Report Orders Completed subsession, its not working. Pls help. Thanks.


function afs.run.tisfc004(
domain tcpdno sfc.pdno.afs)
{ |report orders completed
domain tcmcs.str100 error.msg
domain tiqep3 additional.qtdl, i.qtdl
boolean retval
domain tcpdno i.pdno
domain tcitem i.mitm
domain tccwar i.cwar
domain tcclot i.clot
long ret
error.msg = ""
i.clot = "TEST-ONLY-NOW.JRV"
i.qtdl = 84
i.pdno = pdno.f
i.mitm = " 1101077229901"
i.cwar = "CS01"
|* AFS Script
stpapi.put.field("tisfc0120s000","tisfc001.pdno",i.pdno)
stpapi.put.field("tisfc0120s000","tisfc001.mitm",i.mitm)
stpapi.put.field("tisfc0120s000","tisfc001.cwar",i.cwar)
stpapi.put.field("tisfc0120s000","tisfc001.osta",str$(etol(tcosta.in.prod)))
ret = stpapi.find("tisfc0120s000", error.msg)
if ret = 1 then
stpapi.put.field("tisfc0120s000","additional.qtdl",str$(i.qtdl))
stpapi.put.field("tisfc0120s000","tisfc001.clot",i.clot)
stpapi.put.field("tisfc0120s000","tisfc001.osta",str$(etol(tcosta.to.be.completed)))
stpapi.put.field("tisfc0120s000","tisfc001.cmdt",str$(utc.num()+(24*60*60)))

retval = stpapi.update("tisfc0120s000", true, error.msg)
if not retval then
retval = stpapi.recover("tisfc0120s000", error.msg)
endif
endif
}

bhushanchanda
20th March 2014, 13:16
Hi,

To handle messages you have to do

stpapi.enum.answer("session_code","message_code",tcyesno.no) | My answer is no

Do remember, you have to write this before the question actually pops up.

And, your code is directly trying to insert data to a sub-session so you need to make a few changes.

Similar threads:-

Thread 1 (http://www.baanboard.com/baanboard/showthread.php?t=53298)
Thread 2 (http://www.baanboard.com/baanboard/showthread.php?t=47910)
Thread 3 (http://www.baanboard.com/baanboard/showthread.php?t=53298)

jojovalenton
22nd March 2014, 02:11
Hello,

Thanks for the reply. I will try to explore these thread links.

Jojo