VishalMistry
14th August 2019, 19:15
Hi Everyone,

Following is the code generated using QKey:

|***************************************************************************
|* Autogenerated subsections for main.table.io
|***************************************************************************

after.read:
_pobj_exe1("after.read")

after.write:
_pobj_exe1("after.write")

after.rewrite:
_pobj_exe1("after.rewrite")

before.delete:
_pobj_exe1("before.delete")

|#end add by QKEY

I want to write some code when a new sales order header record is saved. I know i have to write it in after.write: section but I am not able to recall how I can achieve this as it has been a long time since I touched QKey. There has been a lot of custom code already written by other developers.

Any urgent help will be highly appreciated.

Vishal

mark_h
14th August 2019, 20:55
Basically you would add in a |#end then add in the code. Kind of like this:


|#end add by QKEY

choice.cont.process:
after.choice:
|20060828.st
| Try testing here for production orders with subcontracting operations.
| The production order number is on the PO line table tdpur041. Any
| production order found with any PO line not fully received should
| not be completed.
| 20060828.end
if comp.frm = tcyesno.yes then
select tisfc010.cwoc, tisfc010.opno, tirou001.kowc
from tisfc010, tirou001
where tisfc010._index1 = {:tisfc001.pdno}
and tirou001._index1 = {tisfc010.cwoc}
and tirou001.kowc = tckowc.subcontracting
selectdo
select tdpur041.*
from tdpur041
where tdpur041._index6 = {:tisfc001.pdno, :tisfc010.opno}
selectdo
if double.cmp(tdpur041.dqua, tdpur041.oqua, .0001)>=0
and double.cmp(tdpur041.bqua, 0.0, .0001)=0 then
if double.cmp(tdpur041.quap, tdpur041.oqua, .0001)<0 then
message("Purchase order %d line %d needs maintain approvals."
,tdpur041.orno,tdpur041.pono)
choice.again()
endif
else
message("Purchase order %d line %d not fully received."
,tdpur041.orno,tdpur041.pono)
choice.again()
endif
selectempty
message("Production order %d operation %d not tied to a purchase order."
,tisfc001.pdno,tisfc010.opno)
if ask.enum("ticontactpsa",tcyesno.yes) = tcyesno.yes then
if ask.enum("tpbop39003",tcyesno.yes) = tcyesno.yes then
|* message("OK - will continue process")
else
choice.again()
endif
else
choice.again()
endif
endselect
endselect
| 20130617.st - Made it thru the checks lets check for VSS.
select tcudi006.*
from tcudi006
where tcudi006._index1 = {:tisfc001.cwar}
as set with 1 rows
selectdo
endselect
if tcudi006.site <> tcudi.site.lsvl then
|vss.checks = false
| No VSS checks needed.
else
if tcudi006.wuse = tcudi.wuse.logical or tcudi006.wuse = tcudi.wuse.mrb or
tcudi006.wuse = tcudi.wuse.parent or tcudi006.wuse = tcudi.wuse.unique then
|vss.checks = false
| No vss checks needed.
else
select tdvss001.*, tdvss010.*
from tdvss001, tdvss010
where tdvss001._index1 = {:tisfc001.mitm}
and tdvss010._index1 = {tdvss001.item, :tisfc001.ccot.a}
as set with 1 rows
selectdo
selectempty
message("Needs VSS PFEP Data.")
choice.again()
endselect
if is.warehouse.vss(tisfc001.cwar) then
if tdvss001.proc = tcyesno.no or tdvss001.subm = tcyesno.no then
message("VSS record needs to be submitted.")
choice.again()
endif
endif
if tdvss010.cwar <> tisfc001.cwar then
message("PFEP Warehouse does not match production order warehouse.")
choice.again()
endif
if tdvss001.leng = 0 or tdvss001.heig = 0 or tdvss001.widt = 0 then
message("%s needs PFEP data completed or processed to VSS set.", trim$(tisfc001.mitm))
choice.again()
endif
endif
endif
endif
| 20130617.end
|#call
|#pobj added by QKEY 3.70
_pobj_exe1("after.choice.cont.process")
|#end add by QKEY
| Go set the current status of the order in
| tisfc970.
update_completed_status()
|#pobj added by QKEY 3.70

|***************************************************************************
|* Autogenerated subsections for choice.cont.process
|***************************************************************************

before.choice:
_pobj_exe1("before.choice.cont.process")