STKMAJ script: Stock update
PCU_IDENT : During the unpacking of a stock line
This entry point is called before the update of the new stock line coming from the unpacking of the line which an action is being carried out on (issue, location and status change, etc.).
The characteristics of this new stock line are contained in the work screen [M:STW].
Modifying the content of this work screen enables to intervene on the characteristics of the new line and in particular to modify identifiers 1 and 2 that are those of the unpacked line by default.
Context and operating mode
Transaction
There is one transaction in progress
Log file
There is an open log file.
Different call cases
The original stock line has just been updated (reduction of 1 packing unit and n stock units).
A new line of n stock units will be created with the same characteristics or a line with identical characteristics will be updated (increase of n stock units).
The characteristics of this new line are in the screen [M:STW] indexed via the I variable.
For example: Reset to zero of identifiers 1 and 2
Raz [M :STW]PALNUM(I)
Raz [M :STW]PALNUM(I)
Warning: Avoid intervening on other fields than the 2 identifiers since the STOWORK [STW] screen contains all the data used to update stock.
Open tables
All the tables of the stock engine are open but their content is not significant.
The stock update interface screen: STOWORK [STW] is open and contains all the characteristics of the issues to carry out.
GENANA: Analysis number assignment on receipt
This entry point is used to intervene on the update of a receipt into stock when the analysis number is assigned.
Context and operating mode
Transaction
There is one transaction in progress
Log file
No trace file is open.
Different call cases
Call if creation of a new analysis request, therefore only in the case of stock receipt movements with the ‘Q’ status.
Available variables and masks
Variable or mask |
Definition |
Global char WANA |
Analysis number |
If the WANA variable is loaded via this entry point, no automatic assignment of the analysis number by the standard sub-program will be carried out.
If this entry point reuses an existing analysis number, the quality control recording must be updated concerning the quantity by status fields.
Open tables
All the tables opened by the stock engine.
MAJ_ITH: Updating the Products-sites totals history
Use this entry point in order not to update the history of the products-sites totals (ITMMVTHIS table).
Context and operating mode
Transaction
There is one transaction in progress
Log file
No trace file is open.
Different call cases
Call on updating the stock on product shortage when the products-sites totals are being updated.
In order not to update the history of the products-sites totals, the GPE variable must be set to 1.
Warning: this entry point is the equivalent of the entry point located in the STKVALMAJ2 processing. The same behavior will probably be required in both cases.
Available variables and masks
Variable or mask |
Definition |
Block 1 of screen STOWORK |
It contains the characteristics of the document line for which the stock is being updated, among which: - [M:STW]TRSTYP: transaction type (local menu 704) - [M:STW]VCRTYP: document type (local menu 701) |
|
Open tables
All the tables opened by the stock engine.
AGRSTJ: stock movements should not be aggregated
Use this entry point in order not to aggregate the stock movements.
Context and operating mode
Transaction
There is one transaction in progress
Log file
There is an open log file.
Different call cases
Call upon stock update on each stock movement entry.
In order not to aggregate stock movements, the GPE variable must be set to 1.
Available variables and masks
Variable or mask |
Definition |
Block 1 of screen STOWORK |
It contains the characteristics of the document line for which the stock is being updated, among which: - [M:STW]TRSTYP: transaction type (local menu 704) - [M:STW]VCRTYP: document type (local menu 701) |
|
Open tables
All the tables opened by the stock engine.
QLH_CRIT : add a criterion upon analysis request generation
Use this entry point to define an additional differentiation criterion when generating analysis requests.
Context and operating mode
Transaction
There is one transaction in progress
Log file
There is an open log file.
Different call cases
Call upon stock update on each stock movement entry.
To use the lot as an additional differentiation criterion when generating analysis requests, the WQLH_CRIT local variable must be declared and loaded as follows:
Local Char WQLH_CRIT
WQLH_CRIT = "LOT = [M:STW]LOT(I)"
Prerequisites
The lot must be added to the STOQLYH table. It is automatically loaded via the transclasses.
Available variables and masks
Variable or mask |
Definition |
Block 1 of screen STOWORK |
It contains the characteristics of the document line for which the stock is being updated, among which: - [M:STW]TRSTYP: transaction type (local menu 704) - [M:STW]VCRTYP: document type (local menu 701) |
|
Open tables
All the tables opened by the stock engine.
STA_CRIT: add a criterion on searching an allocation
Use this entry point to define an additional differentiation criterion when searching for the allocations to be followed on a new stock line.
Context and operating mode
Transaction
Transaction
There is one transaction in progress
Log file
There is an open log file.
Different call cases
Call when updating stock if the characteristics of a stock line with allocations are modified. Calling this entry point only occurs when searching for an allocated quantity equal to the quantity of the new stock line.
Used to determine the allocations to be followed on this new stock line.
To define an additional differentiation criterion for allocations, the WSTACRIT local variable must be loaded with the additional filter to be applied.
Open tables
All the tables opened by the stock engine.
PURQLC: not to purge a quality control in the case of an issue in Q status
Use this entry point not to purge a quality control in the case of an issue in Q status.
Context and operating mode
Transaction
There is one transaction in progress
Log file
There is an open log file.
Different call cases
Call upon update of stock placed in the PURGE_STOQLYD label.
The GPE variable must be set to 1 in order not to purge a quality control in the event of an issue with Q status.
Available variables and masks
Variable or mask |
Definition |
|
Open tables
All the tables opened by the stock engine.
CONTROL_BACKDATE: authorize backdated stock issues
This entry point is used to check if a backdated stock issue is authorized. The control is applied to the existing stock on a relevant date. This is a blocking control.
This control has been implemented to meet several requirements:
- Keep a chronological order: It is not possible to issue a product on a given date if this product was not in the stock on that date.
- Maintain consistency in stock movements regarding lot entry and issue
- Avoid beginning the stock movements of new products with a negative stock value
- Stock on the receipt date/effective date (earlier than the current date) must exist for the product-site, lot and sublot, requested quantity and serial number (which determines the stock line). All the other characteristics, such as location, status, packing unit, conversion factor, user 1 and 2 areas as well as the LPN number, that are available on the stock line, are considered to determine the available stock. If there is no available stock, a blocking control prevents you from creating the document.
- In the stock journal, a control is applied to the stock movements already performed between the current date and the entered date (earlier than the current date) to prevent stock to be issued for this product on a date earlier than the last sock issue for that same product (same site, lot, sublot, serial number).
Prerequisites
- Concerning Product management (GESITM), negative stock is prohibited (the Stock < 0 authorized check box is cleared).
- No negative stock is managed for the product.
Activation
In this entry point, enter the following instruction:
Call BACKDATE From STKMAJCTL
Errors are managed by the standard scripts.
Context and operating mode
Considered movements
The control only applies to the creation of documents. It does not apply to the modification or deletion of documents.
Flow | TRSTYP (Stock transaction types) ML 704 | VCRTYP (Entry type) ML 701 |
---|---|---|
Issue | 2 = Miscellaneous issue | 20 = Miscellaneous issue |
31 = Assembly (parent product) | ||
32 = Disassembly (component) | ||
35 = Lot modification | ||
4 = Customer delivery | 4 = Delivery | |
5 = Sales invoice with stock movement | ||
6 = Work order issue | 12 = Production tracking | |
24 = Service request | 33 = Service request | |
29 = Subcontract issue | 6 = Receipt | |
Negative receipt | 11 = Receipt return | 8 = Supplier return |
32 = Subcontract receipt return | 8 = Supplier return | |
Stock change | 14 = Intersite transfer | 29 = Stock change |
Count | 13 = Stock count | 9 = Stock count |
Limitations
Stock movements corresponding to a Lot modification document (VCRTYP = 35) are considered. Effectively, the corresponding issue flow is identified as a Miscellaneous issue (TRSTYP=2). This is normal behavior for lot renumbering/mixing but it serves no purpose for characteristic changes (except potency) and lot user custom fields. This has no consequences on the calculation of the stock on the effective date. On the other hand, it will block the update if a movement relating to characteristic changes or lot user custom fields is later than the effective date entered.
Technical data
The table below mentions the sign (positive/negative) of the quantity in the following flows [M:STW]:
Flow type | MAJCODH | MAJTYP (I) | Quantity sign |
---|---|---|---|
Issue | C (creation) | S (issue) | + |
Negative receipt | C | E (receipt) | - |
Intersite transfers | C | C (change of location) | + |
Example
STOCK on the S1 site: Lots are managed for Product A1.
On 22 October, the stock quantity is 150.
- Lot 1: 50
- Lot 2: 20
- Lot 3: 80
1 October | 3 October | 5 October | 10 October | 15 October |
---|---|---|---|---|
Lot 1 +30 | Lot 1 -10 | Lot 1 +10 |
|
Lot 1 +20 |
Lot 2 +20 |
|
|
|
|
|
|
|
Lot 3 +50 | Lot 3 +30 |
Effective date | Lot | Quantity | Result |
---|---|---|---|
30 September | Lot 2 | - 10 | Blocked movement (Stock = 0) |
1 October | Lot 1 | - 40 | Blocked movement (Issue movement on 3 October) |
5 October | Lot 1 | - 40 | Blocked movement (Stock = 30) |
5 October | Lot 3 | - 20 | Blocked movement (Stock = 0) |
12 October | Lot 3 | - 60 | Blocked movement (Stock = 50) |
14 October | Lot 1 | - 50 | Blocked movement (Stock = 30) |
15 October | Lot 1 | - 50 | Authorized movement (Stock = 50) |