Special window-events in the goods receipt window mw_wareneingang_edit
orderchange |
Pur.Order No was changed |
prereceiptpo |
Before goods receipt. If returns "return false" the goods receipt can be prevented.
Example: I want to allow the users to make goods receipts from purchase order in beas and receive up to more 10% of the purchase order qty:
windowevent prereceiptpo setvar=lc_maxqty=& select <dw_1.item.quantity.value,num(6)> * 1.1 setvar=lc_newqty=& select <dw_1.item.openqty.value,num(6)> + & <dw_1.item.menge.value,num(6)> if <lc_newqty,#0.000000> n> <lc_mayqty,#0.000000> then messagebox=error$**$Max Quantity = <lc_maxqty,#0.000000>! return failure end if end event
|
receiptpo |
goods receipt successful. e_docentry (read only) internal document No. e_docnum (read only) visible document No. linenum is always 0, that is why there is no variable. |
receiptpo |
Before creating a document (all data is already determined) |
batchnumstatus |
After creation of the document only with batch items cc:whscode cc:qs // J=create Quality control plan - if existing cc:cardcode cc:docentry // of the purchase order cc:docnum // of the purchase order and cc:batchnun generated batch No. Can be set to 0,1 or 2 cc:newdocentry goods receipt delivery note (docentry) |
qccreate |
After creating a document - Check if a quality control inspection plan shall be created Same variables as in "batchnumstatus" |
receiptpoend |
After end of a goods receipt Same variables as in batchnumstatus Return value is not considered. |
Additionally you can use these fields:
userfield1
userfield2
See example for using these:
Create a field "weight" which should be saved to a UDF.
Characteristic: The event "Wareneingang" (goods receipt) is triggered after this is done and all fields are cleared.
Therefore you have to buffer the input in a variable.
windowevent start
create=column=x=1390,y=390,width=330,height=56,id=userfield1,name=weight,tab=41
create=text=x=1000,y=390,width=600,name=weight_t,text=weight (kg)
protect=weight=1
setitem=weight=
setvar=e_weight=
end event
windowevent orderchange
protect=weight=0
end event
windowevent itemchange weight
// buffer the field in a variable
setvar=e_weight=<weight>
end event
windowevent prereceitpo
// ATTENTION: RESET ALREADY DONE!!! Item is blank.
if <e_weight> n> 0 then
sql=update pdn1 set u_ksb_wt=<e_weight,num(3)> where docentry=<e_docentry>
end if
setvar=e_weight=
end event
Example storage location
// 14.6.2006
// Thomas Lassacher
// Force input of storage location for goods receipt in BEAS. Goods receipt in SBO can be controlled with beasGUI.
// create input field for storage location
windowevent start
create=column=x=475,y=1500,width=330,weight=56,id=userfield1,name=weight,tab=41
create=text=x=15,y=1500,width=600,name=weight_t,text=storage location
end event
// Force input of storage location for the stores 61, 62 and 88
windowevent prereceiptpo
if <lagplatz> = 61 or <lagplatz> = 62 or <lagplatz> = 88 then
if <weight> = "" then
meldung=fehler$Fehlerhafte Eingabe: Lagerplatz
return false
end if
end if
end
// set variable for the Update because field is NOT available after creating the document.
windowevent itemchange weight
setvar=e_lapl=<weight>
end event
// After booking set the storage location to the table OINM and IGN1 (storage location management)
windowevent receiptpo
setvar=e_transnum=select top 1 oinm.transnum from pdn1 inner join opdn on opdn.docentry = pdn1.docentry and pdn1.linenum=0 inner join oinm on oinm.base_ref = opdn.docnum and oinm.transtype = opdn.objtype and oinm.doclinenum = 0 and pdn1.docentry = <e_docentry>
sql=update pdn1 set importlog='<e_lapl>' where docentry=<e_docentry> and linenum = 0
sql=update oinm set importlog = '<e_lapl>' where transnum = <e_transnum>
end event