After receipt process
- change Batch Status
- print report
Userevent materialmangement.receipt, workordermanagement.receipt
BSL: BatchNumber
Userevent materialmanagement.receiptend , workordermangement.receiptend
// only if item Group 9 is defined with "N", we change the Batch status to 0
function ReceiptEnd
instance bsl b
instance datastore dtw
dtw=(v2)select "IBT1"."ItemCode","OBTN"."SysNumber" &
from "IBT1" &
inner join "OBTN" on "OBTN"."ItemCode"="IBT1"."ItemCode" and "OBTN"."DistNumber"="IBT1"."BatchNum" &
inner join "OITM" on "OITM"."ItemCode"="IBT1"."ItemCode" and "OITM"."QryGroup9" <>'Y' &
where "IBT1"."BaseType"=59 and "IBT1"."BaseEntry"=<e_ReceiptDocEntry> ;
for loop = 1 to <dtw.rowcount>
dtw.setrow=<loop>
b.put=BatchNumber("<dtw.itemcode>",<dtw.sysnumber>)<tab>{"Status":"1"}
if <b.ret_code> <> 1 then
messagebox=error$$<b.ret_text>
end if
next
destroy=dtw
end function
In next example we will save Work order Position UDF 2 in The BatchAttribute 1 (OBTN.MnfSerial)
workordermanagement.src
function ReceiptEnd
instance bsl b
instance datastore dtw
select "UDF2" into :mnfSerialInfo from "BEAS_FTPOS" where "BELNR_ID"=<e_belnr_id> and "BELPOS_ID"=<e_belpos_id>
dtw=(v2)select "IBT1"."ItemCode","OBTN"."SysNumber" &
from "IBT1" &
inner join "OBTN" on "OBTN"."ItemCode"="IBT1"."ItemCode" and "OBTN"."DistNumber"="IBT1"."BatchNum" &
inner join "OITM" on "OITM"."ItemCode"="IBT1"."ItemCode" and "OITM"."QryGroup9" <>'Y' &
where "IBT1"."BaseType"=59 and "IBT1"."BaseEntry"=<e_ReceiptDocEntry> ;
for loop = 1 to <dtw.rowcount>
dtw.setrow=<loop>
b.put=BatchNumber("<dtw.itemcode>",<dtw.sysnumber>)<tab>{"BatchAttribute1":<mnfSerialInfo,bsl>}
if <b.ret_code> <> 1 then
messagebox=error$$<b.ret_text>
end if
next
destroy=dtw
end function