...
IF ItemApplnEntry.AppliedInbndEntryExists("Item Ledger Entry No.",TRUE) THEN
EXIT(TRUE);
EXIT(FALSE);
...
...
IF ItemApplnEntry.AppliedInbndEntryExists("Item Ledger Entry No.",TRUE) THEN
EXIT(TRUE);
// Add the following lines.
IF "Item Ledger Entry Type" = "Item Ledger Entry Type"::Consumption THEN
IF ItemApplnEntry.AppliedFromEntryExists("Item Ledger Entry No.") THEN
REPEAT
ItemLedgEntry.GET(ItemApplnEntry."Outbound Item Entry No.");
IF ItemLedgEntry."Entry No." <> xItemLedgEntry."Entry No." THEN BEGIN
xItemLedgEntry := ItemLedgEntry;
ItemApplnEntry.GetVisitedEntries(ItemLedgEntry,TempItemLedgEntry);
TempItemLedgEntry.SETCURRENTKEY("Item No.",Positive,"Location Code","Variant Code");
TempItemLedgEntry.SETRANGE("Item No.","Item No.");
TempItemLedgEntry.SETRANGE(Positive,TRUE);
TempItemLedgEntry.SETRANGE("Location Code","Location Code");
TempItemLedgEntry.SETRANGE("Variant Code","Variant Code");
IF NOT TempItemLedgEntry.ISEMPTY THEN
EXIT(TRUE);
END;
UNTIL ItemApplnEntry.NEXT = 0;
// End of the added lines.
EXIT(FALSE);
...