anjunath
12th September 2015, 11:17
Hi,

I am using tdpur4210m100 for processing specific purchase order through AFS.
Have passed same order for 'from order' and 'to order ' ranges and try to invoke process button . But there is an error coming like ' Purchase Approval Command disabled ' . Please mention if you have any solution for this.

please refer below code .

ret = stpapi.find("tdpur4210m100", error) |"tdpur4210m100"
if ret then

stpapi.put.field("tdpur4210m100", "orno.f", purchaseorder.f)
stpapi.put.field("tdpur4210m100", "orno.t", purchaseorder.f)
stpapi.form.command("tdpur4210m100",5,"exec.cont.process",error)
stpapi.continue.process("tdpur4210m100",error)

afs.success = true
else
enter.log(concat$("|","insert ",error))
dal.set.error.message("@"&error)
show.dal.messages(MSG.ALL)
afs.success = false
endif

bhushanchanda
12th September 2015, 12:12
Moved to correct forum - AFS/DDC/OLE: Function servers

Hi,

There is no need to call continue.process. You might first check if you are able to process it manually from session. Also, check the form checkboxes when you run it successfully. Apply the same when you run the AFS.

The following works for me -

string error(100)
stpapi.set.report("tdpur4210m100","rtdpur421010001","ASCIF",error)
stpapi.put.field("tdpur4210m100", "orno.f", "SWO000006")
stpapi.put.field("tdpur4210m100", "orno.t", "SWO000006")
stpapi.put.field("tdpur4210m100", "appr.rules", str$(etol(tcyesno.no)))

stpapi.form.command("tdpur4210m100",5,"exec.cont.process",error)
stpapi.end.session("tdpur4210m100")

As you can see, I am setting apply approval rules to No. Also, you will need to set the report as the default print report checkboxes are checked.