Stock Inventory Form Plus

We want to create a version of the Stock Status Report to use as a Form to verify/count specific inventory. Unfortunately some of our stock doesn't make it into the DB and needs to be verified. SO this means I want those part numbers on my report EVEN IF Epicor says I do not have any. Below is the logic I have come up with, BUT it seems I can't figure out the combo to get EACH PartBin (Because we store in multiple places) PLUS any part numbers that may not be in the PartBin table, but do need to be on the list (Noted via Part.CheckBox02). It works w/ no-lock only, but when I add the no-error so I can use the AVAILABLE option all goes south. What I am getting is just the Parts that meet my AVAILABLE PartBin logic.

DEF VAR Outfile4 AS Char format 'X(1000)' no-undo.
DEF VAR OString4 as Char format 'X(1000)' no-undo.

Outfile4 = "\\HUMEPICOR\SCWork\TESTStockRpt.csv".
OUTPUT TO VALUE(Outfile4).

OString4 = "PartNum" + "," + "Description" + "," + "Warehouse" + "," + "BinNum" + "," + "OnhandQty" + "," + "OK" + "," + "Corrected Qty" + "," + "Notes".
PUT UNFORMATTED Ostring4 SKIP(0).

FOR EACH Part no-lock WHERE (Part.Company = (GetCurrentCompany())) AND (Part.PartNum BEGINS "CM") by Part.PartNum.

FOR EACH PartBin WHERE (PartBin.Company = (GetCurrentCompany())) AND (PartBin.PartNum = Part.PartNum) no-lock.
IF AVAILABLE PartBin THEN DO:

OString4 = Part.PartNum + "," + Part.PartDescription + "," + PartBin.WarehouseCode + "," + String(PartBin.BinNum) + "," + string(PartBin.OnhandQty) + "," + "," + ",".
PUT UNFORMATTED Ostring4 SKIP(0).

END. /*** AVAILABLE PartBin ***/
IF (NOT AVAILABLE PartBin) AND (Part.CheckBox02 = TRUE) THEN DO:

OString4 = Part.PartNum + "," + Part.PartDescription + "," + "," + "," + "," + "," + ",".
PUT UNFORMATTED Ostring4 SKIP(0).

END. /*** NOT AVAILABLE PartBin ***/
END. /*** PartBin ***/

END. /*** Part ***/

Brenda



[Non-text portions of this message have been removed]