![]()
In the following example we use the BSL call over a placeholder and BSL function call.
Example:
In the Manual Receipt window for work order for receipt assembly the system does not check minimum quantity.
This only works in "Material issue window".
It is possible to execute the check with BSL WorkorderBoM/CheckMinMaxBom
Idea: Check issue Quantity while insert receipt quantity.
What we check:
Needed Quantity = the input quantity + all receipts from past
Related to this quantity the system has to calculate the Planned 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