Write the h-BinCheck procedure to check inventory
- Last Updated: April 29, 2024
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Here you add another procedure call that illustrates some of the block types you studied in
this section and some of the list handling functions summarized in Introduction to ABL. The procedure looks at the Warehouse
and Bin tables to see which Warehouses can and cannot
supply the Items for a given Order.
|
The additional code defines two new OUTPUT parameters and a new
variable.
Then, as part of the ASSIGN statement, it constructs a list of Item
numbers for the OrderLines of the Order. To make a
list, it uses a CHARACTER variable cItemList. The assignment statement
effectively means:
- Take the current value of the
cItemListvariable (which is initially blank). - If it is blank, then append a blank value to it (this is just a no-op condition
for the
IF-THEN-ELSEstatement, which requires both aTHENphrase and anELSEphrase). Otherwise, if there is already something in the list, append a comma to it to separate theItems. - Use the
STRINGbuilt-in function to convert the integerItemNumto a CHARACTER value and append it to the variable. (There are other built-in functions like this one namedDECIMAL,INTEGER,DATE, andLOGICALto convert character strings to those other data types as well.)
At the end of the FOR EACH block, cItemNum holds a
comma-separated list of all the Items for the current
Order.
Finally, the procedure runs another procedure, h-BinCheck.p, which you write next.
To write the h-BinCheck.p procedure:
- Save this modified version of h-OrderCalcs.p.
- Open a New Procedure Window and start to write
h-BinCheck.p with the following code. Add each new group of
statements to the procedure as they are discussed:
/* h-BinCheck.p */ DEFINE INPUT PARAMETER pcItemList AS CHARACTER NO-UNDO. DEFINE OUTPUT PARAMETER pcWarehouseList AS CHARACTER NO-UNDO. DEFINE OUTPUT PARAMETER pcBestWarehouse AS CHARACTER NO-UNDO. DEFINE VARIABLE iEntry AS INTEGER NO-UNDO. DEFINE VARIABLE iItemNum AS INTEGER NO-UNDO. DEFINE VARIABLE iWHQty AS INTEGER NO-UNDO. DEFINE VARIABLE iWHNum AS INTEGER NO-UNDO. DEFINE VARIABLE iBestWH AS INTEGER NO-UNDO. DEFINE VARIABLE cBestList AS CHARACTER NO-UNDO.
This procedure takes the list of item numbers as an INPUT parameter and
returns two CHARACTER parameters. The various variables are used throughout the
procedure.