BPM to show warning of overshipment

I want to create a simple BPM that displays a text warning popup when (ShipDtl.SellingShippedQty + ShipDtl.SellingShipmentQty) > ShipDtl.SellingReqQty

I can’t figure out how or where to add a calculation to a BPM condition. Can someone please point me in the right direction? Thank you!

use a condition type of:

image

An have the custom code return true for a valid condition

expression would be like:

return ((ShipDtl.SellingShippedQty + ShipDtl.SellingShipmentQty) > ShipDtl.SellingReqQty ? true : false);
3 Likes

Note that this can become a more complex problem IF your team happens to create more than one shipping line, or more than one packslip for a specific order on a specific day… in other words… if you have an order for 10 pieces… and you create two packslips, you can ship 8 on one packslip, and 8 more on another packslip… both packslips are “valid” because they are under the order quantity, but you still are overshipping them.
To do this “properly” you need to look at both the current packslip, AND any other open/unshipped packslips.

The BO CustShip.GetQtyInfo includes a field for the qty already shipped. So doing the check in there should work, even if multiple packers or multiple lines on a single packer are employed.

1 Like

Below which I have created in E9 on CustShip.UpdateMaster Pre-Processing when ReadyToInvoice is checked.

define var lShippedQty like ShipDtl.OurInventoryShipQty no-undo.
for each ttShipHead where ttShipHead.Company = cur-comp and (ttShipHead.RowMod = “A” or ttShipHead.RowMod = “U”) and ttShipHead.ReadyToInvoice = true :
for each ShipDtl no-lock where ShipDtl.Company = ttShipHead.Company and ShipDtl.PackNum = ttShipHead.PackNum :
lShippedQty = 0 .
for each BuffShipDtl no-lock where BuffShipDtl.Company = ShipDtl.Company and BuffShipDtl.OrderNum = ShipDtl.OrderNum and
BuffShipDtl.OrderLine = ShipDtl.OrderLine and BuffShipDtl.OrderRelNum = ShipDtl.OrderRelNum and
BuffShipDtl.PackNum = ShipDtl.PackNum and BuffShipDtl.PackLine <> ShipDtl.PackLine :
lShippedQty = lShippedQty + (BuffShipDtl.OurInventoryShipQty + BuffShipDtl.OurJobShipQty ) .
end.
lShippedQty = lShippedQty + (ShipDtl.OurInventoryShipQty + ShipDtl.OurJobShipQty ) .
find first OrderRel where OrderRel.Company = ShipDtl.Company and OrderRel.OrderNum = ShipDtl.OrderNum and
OrderRel.OrderLine = ShipDtl.OrderLine and OrderRel.OrderRelNum = ShipDtl.OrderRelNum no-lock no-error.
if avail OrderRel then
do:
lShippedQty = lShippedQty + OrderRel.OurJobShippedQty + OrderRel.OurStockShippedQty.
if lShippedQty > OrderRel.OurReqQty then
do:
lQtyMessage = "Total shipped qty " + string(lShippedQty) + " is more than the order qty " + string(OrderRel.OurReqQty) +
" for pack line " + string(ShipDtl.PackLine) + " related to Order/Line/Rel Num : " + string(ShipDtl.OrderNum) + “/” +
string(ShipDtl.OrderLine) + “/” + string(ShipDtl.OrderRelNum) + ". Please check the shipped qty. ".
{lib/PublishEx.i &ExMsg = lQtyMessage }
end.
end.
end.

Bpm on CustShip.Update Pre-Processing when shipped is checked.

var ShipDtl = ttShipDtl.Where(sd => (sd.Added()) && ((sd.OurJobShipQty + sd.OurInventoryShipQty) > (sd.SellingReqQty - sd.SellingShippedQty))).FirstOrDefault();

if(ShipDtl != null)
{

      var message = "You are attempting to overship this line. Please correct before you can continue.";
          message = message + ShipDtl.SellingReqQty + " " + ShipDtl.SellingShippedQty + " " + ShipDtl.OurJobShipQty + " " + ShipDtl.OurInventoryShipQty; 
            throw new Ice.Common.BusinessObjectException(
            new Ice.Common.BusinessObjectMessage(message)
            {
            Type = Ice.Common.BusinessObjectMessageType.Error,
            });
}
1 Like

I am on version 10.2.600 and I do not see the fields ShipDtl.SellingReqQty or ShipDtl.SellingShippedQty in the ShipDtl table.

This appears to cause the ShipDtl variable to be null in all cases.