View Single Post
  #1  
Old 29th March 2017, 16:03
jojovalenton jojovalenton is offline
Senior Member
 
Join Date: Aug 2007
Posts: 185
jojovalenton is on a distinguished road
Baan: InforLN FP7 - DB: SQL Server 2008 R2 - OS: Window Server 2008 R2
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

Last edited by mark_h : 29th March 2017 at 16:50. Reason: add code tags
Reply With Quote