This event is the best place to modify the created work order
workordermanagement.src
function CreateWorkOrderPositionEnd
end function
In this example we use the in Production line from the Resource, which is defined in first Routing position
Note:
- if possible: use Warehouse Rules
- if possible: work with Beas Service Layer
- don't change standard fields, if Beas Service Layer command is available. We can't give any guarantee, if you use update command on beas tables

function CreateWorkOrderPositionEnd
// Get Warehouse from Work order Position. We use always BSL if possible,
instance bsl b
b.get=WorkorderPos(<e_WoDocEntry>,<e_WoLineNumber>)/WhsCode/$value
setvar=ls_whscode=<b.ret_value>
// Then we get the warehouse type. BSL is perfect for this work
b.get=WareHouse(<ls_whscode,bsl>)/WhsBinType/$value
setvar=ls_binType=<b.ret_value>
// we want to check only WMS Warehouse (typ 3)
if <ls_binType> <> 3 then
return success
end if
// Get WMS Produdction Line from resource from first Routing position
// Note: You must sort by "SortId", not "POS_ID"
// we use SQL, because not all fields available in BeasServiceLayer
sql.select top 1 "BEAS_APLATZ"."WMS_PRODLINE" into ls_wmsprodline &
from "BEAS_FTAPL" inner join "BEAS_APLATZ" on "BEAS_APLATZ"."APLATZ_ID"="BEAS_FTAPL"."APLATZ_ID" &
where "BEAS_FTAPL"."BELNR_ID"=<e_WoDocEntry> and "BEAS_FTAPL"."BELPOS_ID"=<e_WoLineNumber> order by "SortId"
// Note: Update on Standard fields not good
// But in this case: This field don't have additional functionality in Beas and BSL PUT is not available
sql.update "BEAS_FTPOS" set "WMS_PRODLINE"=<ls_wmsprodline,dbstring> where "BELNR_ID"=<e_WoDocEntry> and "BELPOS_ID"=<e_WoLineNumber>
end function
|