Baanboard.com

Baanboard.com (http://www.baanboard.com/baanboard/index.php)
-   AFS/DDC/OLE: Function servers (http://www.baanboard.com/baanboard/forumdisplay.php?f=59)
-   -   gen advice and release advice (http://www.baanboard.com/baanboard/showthread.php?t=69901)

jojovalenton 29th March 2017 16:03

gen advice and release advice
 
hi,
i created generate advice and release advise inside the planned load and shipment session (whinh4180m000) but its not making any changes. i am not sure which part of the script is wrong.
Code:


function extern afs.run.owhinhf4182(
            domain tcorno i.orno.r,
            domain tcpono i.pono.r,
            domain tcpono i.seqn.r,
            domain tcwset i.oset.r,
            domain tccwar i.cwar.r,
        domain whinh.load i.load.r,
        domain whinh.shpm i.shpm.r)
|generate advice
  domain  tcmcs.str100 error.msg
  error.msg = ""
  long find.shipment, add.shipment, save.shipment, mark.shipment
  boolean update.shipment
  |* AFS Script
  stpapi.put.field("whinh4180m000","whinh480.oorg",str$(etol(whinh.oorg.sales)))
  stpapi.put.field("whinh4180m000","whinh480.orno",i.orno.r)
  stpapi.put.field("whinh4180m000","whinh480.pono",str$(i.pono.r))
  stpapi.put.field("whinh4180m000","whinh480.seqn",str$(i.seqn.r))
  stpapi.put.field("whinh4180m000","whinh480.boml",str$(0))
  stpapi.put.field("whinh4180m000","whinh480.cwar",i.load.r)
  stpapi.put.field("whinh4180m000","whinh480.cwar",i.shpm.r)
  stpapi.put.field("whinh4180m000","whinh480.cwar",i.cwar.r)
  find.shipment = stpapi.find("whinh4180m000",error.msg)
  if find.shipment = 1 then
      mark.shipment = stpapi.mark("whinh4180m000", error.msg)
      if mark.shipment then
        stpapi.form.command("whinh4180m000", 5, "whinh4201m000",error.msg)     
        stpapi.enum.answer("whinh4201m000","advice.log",whinh.oalg.no)
        stpapi.put.field("whinh4201m000", "overwrite.range", str$(etol(tcyesno.yes)))
        stpapi.put.field("whinh4201m000", "use.load.plan", str$(etol(tcyesno.yes)))
        stpapi.put.field("whinh4201m000", "load.f", i.load.r)
        stpapi.put.field("whinh4201m000", "load.t", i.load.r)
        stpapi.put.field("whinh4201m000", "shpm.f", i.shpm.r)
        stpapi.put.field("whinh4201m000", "shpm.t", i.shpm.r)
        stpapi.enum.answer("whinh4201m000","prerror",tcyesno.yes)
        stpapi.put.field("whinh4201m000", "order.prio", str$(etol(whinh.oorg.sales)),1)
        stpapi.put.field("whinh4201m000", "order.prio", str$(etol(whinh.oorg.sales.sched)),2)
        stpapi.put.field("whinh4201m000", "order.prio", str$(etol(whinh.oorg.sales.man)),3)
        stpapi.put.field("whinh4201m000", "include.org", str$(etol(tcyesno.yes)),1)
        stpapi.put.field("whinh4201m000", "include.org", str$(etol(tcyesno.yes)),2)
        stpapi.put.field("whinh4201m000", "include.org", str$(etol(tcyesno.yes)),3)
        stpapi.enum.answer("whinh4201m000","whinhs0039",whinh.sapp.ok) |run must be filled
        stpapi.enum.answer("whinh4201m000","whinh0007",tcyesno.yes)
        stpapi.enum.answer("whinh4201m000","pradvice",tcyesno.yes)
        stpapi.enum.answer("whinh4201m000","prshortage",tcyesno.yes)
        stpapi.enum.answer("whinh4201m000","print.ownership",tcyesno.yes)
        stpapi.put.field("whinh4201m000", "label.printing", str$(etol(whinh.plbs.order.settings)))
        stpapi.put.field("whinh4201m000", "device.selection", str$(etol(tcdvsl.default)))
        stpapi.set.report("whinh4201m000", "rwhinh420011000","N", error.msg)
        stpapi.set.report("whinh4201m000", "rwhinh420021000","N", error.msg)
        stpapi.set.report("whinh4201m000", "rwhinh420041000","N", error.msg)
        stpapi.form.command("whinh4201m000", 5, "read.and.load.run",error.msg)
        stpapi.form.command("whinh4201m000", 5, "advise",error.msg)
      endif
  endif
  stpapi.end.session("whinh4201m000")
  stpapi.end.session("whinh4180m000")
}

function extern afs.run.owhinhf4183(
            domain tcorno i.orno.s,
            domain tcpono i.pono.s,
            domain tcpono i.seqn.s,
            domain tcwset i.oset.s,
            domain tccwar i.cwar.s,
        domain whinh.load i.load.s,
        domain whinh.shpm i.shpm.s)
|released advice
  domain  tcmcs.str100 error.msg
  error.msg = ""
  long find.shipment, add.shipment, save.shipment, mark.shipment
  boolean update.shipment
  |* AFS Script
  stpapi.put.field("whinh4180m000","whinh480.oorg",str$(etol(whinh.oorg.sales)))
  stpapi.put.field("whinh4180m000","whinh480.orno",i.orno.s)
  stpapi.put.field("whinh4180m000","whinh480.pono",str$(i.pono.s))
  stpapi.put.field("whinh4180m000","whinh480.seqn",str$(i.seqn.s))
  stpapi.put.field("whinh4180m000","whinh480.boml",str$(0))
  stpapi.put.field("whinh4180m000","whinh480.cwar",i.load.s)
  stpapi.put.field("whinh4180m000","whinh480.cwar",i.shpm.s)
  stpapi.put.field("whinh4180m000","whinh480.cwar",i.cwar.s)
  find.shipment = stpapi.find("whinh4180m000",error.msg)
  if find.shipment = 1 then
      mark.shipment = stpapi.mark("whinh4180m000", error.msg)
      if mark.shipment = 1 then
        stpapi.form.command("whinh4180m000", 5, "whinh4202m000",error.msg)
        stpapi.put.field("whinh4202m000", "oorg.f", str$(etol(whinh.oorg.sales)))
        stpapi.put.field("whinh4202m000", "oorg.t", str$(etol(whinh.oorg.sales)))
        stpapi.put.field("whinh4202m000", "orno.f", i.orno.s)
        stpapi.put.field("whinh4202m000", "orno.t", i.orno.s)
        stpapi.put.field("whinh4202m000", "oset.f", str$(i.oset.s))
        stpapi.put.field("whinh4202m000", "oset.t", str$(i.oset.s))
        stpapi.put.field("whinh4202m000", "pono.f", str$(i.pono.s))
        stpapi.put.field("whinh4202m000", "pono.t", str$(i.pono.s))
        stpapi.put.field("whinh4202m000", "label.printing", str$(etol(whinh.plbs.order.settings)))
        stpapi.put.field("whinh4202m000", "use.load.plan", str$(etol(tcyesno.yes)))
        stpapi.put.field("whinh4202m000", "load.f", i.load.s)
        stpapi.put.field("whinh4202m000", "load.t", i.load.s)
        stpapi.put.field("whinh4202m000", "shpm.f", i.shpm.s)
        stpapi.put.field("whinh4202m000", "shpm.t", i.shpm.s)
        stpapi.enum.answer("whinh4202m000","whinhs0039",whinh.sapp.ok)
        stpapi.enum.answer("whinh4202m000","whinh0007",tcyesno.yes)
        stpapi.enum.answer("whinh4202m000","advice.log",whinh.oalg.no)
        stpapi.enum.answer("whinh4202m000","pradvice",tcyesno.no)
        stpapi.enum.answer("whinh4202m000","prshortage",tcyesno.yes)
        stpapi.enum.answer("whinh4202m000","print.ownership",tcyesno.no)
        stpapi.set.report("whinh4202m000", "rwhinh420021000","ASCIT", error.msg)
        stpapi.form.command("whinh4202m000", 5, "read.and.load.run",error.msg)
        stpapi.form.command("whinh4202m000", 5, "release.advice",error.msg)

      endif
  endif
  stpapi.end.session("whinh4202m000")
  stpapi.end.session("whinh4180m000")
}

psl help. thanks.
regards,
jojo

mark_h 29th March 2017 17:00

I don't have LN so not sure I will be much help the first thing I would look at in debug mode is the stpapi.form.command("whinh4180m000", 5, "whinh4201m000",error.msg) command. Is that the correct format to launch the next session? If this is correct then in debug mode right after you step thru this command you should see whinh4180m000 running in the background process. In 4c4 I can start a shell from the option dialog and watch the processes.

bhushanchanda 30th March 2017 12:26

It will help if you can point the exact line where there is an issue. You can step into debugger and check for the return values.

Also, I'm not sure, but I remember, there are a few activities which need a DLL call for AFS to work. Yes, that sounds bad. But, there are a number of places where we need to do that. If you have source code, that should be a big help. Else, you just need to keep playing and debugging it.

jojovalenton 31st March 2017 15:02

how to start new line for a header/line session (MMT session)? there is no form command to enter new line, new command is from the menu. synchronize command is available only when there is already the first line entered.


All times are GMT +2. The time now is 21:52.


vB.Sponsors
©2001-2017 - Baanboard.com - Baanforums.com