In follow example we use the BSL call over place holder and BSL function call
EXAMPLE:
In Manual Receipt window for work order for receipt assembly the system don't check minimal
This is only working in "Material issue window"
It's possible to execute the check with bsl WorkorderBoM/CheckMinMaxBom
Idea: Check issue Quantity while insert receipt quantity
What we're checking:
Needed Quantity = the input quantity + all receipts from past
Related to this quantity the system has to calculate the Plan-Quantity
and based on this the minimum and maximum quantity.
mw_manuell_buchen.src
BSL Placeholder:
lc_bookedQty=<bsl.WorkorderPos([dw_1.item.belnr_id.value] | [dw_1.item.belpos_id.value]).QuantityProduced/$value>
In Placeholder not allowed: Comma and <>
Comma: Use PipeLine
Place holder in Place holder: Use []
Function Call
You must declare the bsl object and then you can call the BSL function
instance bsl b
b.get=WorkorderBom/CheckMinMaxBom(<dw_1.item.belnr_id.value>,&
<dw_1.item.belpos_id.value>,0,"",<lc_bookedQty,dbnum>,true)
This return a json object. Structure see description of this function
if <b.Status> = locked then
dw_1.item.menge.setvalue=0
end if
Complete example:
global function dw_1_item_menge_itemchanged
dec lc_bookedQty
// Work order - Bill of Material position must be defined
if <dw_1.item.belnr_id.value> n> 0 and <dw_1.item.belpos_id.value> n> 0 and <dw_1.item.pos_id.value> n= 0 and <dw_1.item.menge.value> n> 0 then
// Get booked Quantity
// Parameter with [] because inside placeholder
// comma in placeholder not allowed. Use | as comma
lc_bookedQty=<bsl.WorkorderPos([dw_1.item.belnr_id.value]|[dw_1.item.belpos_id.value]).QuantityProduced/$value>
lc_bookedQty=<lc_bookedQty,dbnum> + <dw_1.item.menge.value,dbnum>
// Execute BSL function
instance bsl b
b.get=WorkorderBom/CheckMinMaxBom(<dw_1.item.belnr_id.value>,<dw_1.item.belpos_id.value>,0,"",<lc_bookedQty,dbnum>,true)
// if locked, then set quantity to 0
if <b.Status> = locked then
dw_1.item.menge.setvalue=0
end if
destroy=b
end if
end global