baanguy2
3rd June 2005, 00:38
If anybody has done AFS automation for the session ticst0101m000, can you please post the script ? I am in kind of stuck with it as my application option is not working.

Thank you

mark_h
3rd June 2005, 15:24
Well here is some code that works for us - all it does is update the warehouse for a position. This may or may not work for you.


|******************************************************************************
|* API Code for printing production order shortage.
|******************************************************************************
function extern change_warehouse( domain tcorno run.order,
domain tcpono run.pono,
domain tccwar run.cwar,
ref string msg())
{
stpapi.put.field("ticst0101m000","ticst001.pdno",str$(run.order))
stpapi.put.field("ticst0101m000","ticst001.pono",str$(run.pono))
rc = stpapi.find("ticst0101m000",msg)
if rc = 1 then
stpapi.put.field("ticst0101m000","ticst001.cwar",str$(run.cwar))
stpapi.update("ticst0101m000",true,msg)
else
msg = "Position not found on ticst0101m000"
endif
stpapi.end.session("ticst0101m000")
}

baanguy2
3rd June 2005, 16:20
Thank you Mark.

But what I am trying to do is execute the user.0 option and I think I am missing something.

here is code:
stpapi.put.field("ticst0101m000","ticst001.pdno",str$(tisfc001.pdno))
isu = stpapi.find("ticst0101m000",errm)
if isu = 1 then
stpapi.application.option("ticst0101m000",1,0,errm)
stpapi.enum.answer("ticst0101m000","ticst01018",tcyesno.yes)
stpapi.end.session("ticst0101m000")
endif
Any suggestions ?

Thank you

mark_h
3rd June 2005, 18:09
Exactly what problem are you running into? I never used this, but the below code seemed to work. All I really did was reverse the stpapi.application.option and the question. You want the question answered before it is asked - which is what the stpapi.application.option would activate.


stpapi.put.field("ticst0101m000","ticst001.pdno",str$(322712))
rc = stpapi.find("ticst0101m000",err)
if rc = 1 then
stpapi.enum.answer("ticst0101m000","ticst01018",tcyesno.yes)
stpapi.application.option("ticst0101m000",1,0,err)
endif
stpapi.end.session("ticst0101m000")

baanguy2
6th June 2005, 20:12
Thank you Buddy, you are great.