Process TRTACHMGT1: TRTACHMGT1
PECBESOINS: Modification of the quantities to be taken into account
This entry point is located in the TRTACHMGT1 process takes into account the requirements for the workbenches (global planning, work plan and grouping), generates an action "PECBESOINS".
The goal of this actions to give the possibility to convert into physical units the requirement quantity to be taken into account.
This is carried out by default as a function of the product but only for the requirements not issued on a purchase document.
Context and operating method
Transaction
There is no transaction in process.
Log file
There is an open log file.
Different call cases
The call is made for each requirement line taken into account in the workbenches.
Available variables and masks
The following variables are loaded at the time of the call to the "PECBESOINS" action.
TRAIT
Process type for the requirements :
- 4 = For creation of purchase requests
- 5 = For creation of standard orders
- 6 = For creation of shipment requests (contract orders)
ABREV
Abbreviation for the screen mask used ("PMG")
The [M:PMG] screen mask is usable, the I variable indicates the grid line currently being processed.
[M:PMG]WIPTYP(I)
Order type:
- 2 = "PO" Supplier order
- 4 = "SC" Sub-contract service
- 7 = "TR " Transfer reorder
[M:PMG]WIPSTA(I)
Order status:
- 1 = "F" Firm
- 2 = "P" Planned
- 7 = "S" Suggested
The variables and classes given above must not be modified.
The following variable must be modified in order to influence the processing of the requirement selection.
RMNQTY
Quantity for the requirement to be taken into account expressed in :
- physical stock unit if the requirement comes from a purchase document ( "POP", "POF", "TRP", "TRF"
- or in active stock unit if the requirement does not come from a purchase document ("POS", "TRS", "SCF" … etc …)
-
Example of a specific/custom process activated by the entry point PECBESOINS:
$ACTION
ACTION example
When "PECBESOINS" : Gosub PECBESOINS
When "ORDLEC" : Gosub ORDLEC
When "ORDMAJ" : Gosub ORDMAJ
Endcase
Return
#----- Conversion of the requirement quantity in physical unit---#
$PECBESOINS
If find(TRAIT,4,5,6) & ABREV="PMG" & (!find([M:PMG]WIPTYP(I),2,7) | [M:PMG]WIPSTA(I)=3)
If [F:ITM]ITMREF<>[M:PMG]ITMREF(I)
Read [ITM] ITM0=[M:PMG]ITMREF(I): If fstat Raz [F:ITM]: Endif
Endif
If [F:ITM]STOMGTCOD=3 & [F:ITM]DEFPOT<>0
[L]RMNQTY=[L]RMNQTY*100/[F:ITM]DEFPOT
Call QTEARR ([L]RMNQTY,[F:ITM]STU) From TRTDIV
Endif
Endif
Return
#----- Conversion of the quantities in physical units after read [F:ORD] -----#
$ORDLEC
If [F:ITM]ITMREF<>[F:ORD]ITMREF
Read [ITM] ITM0=[F:ORD]ITMREF: If fstat Raz [F:ITM]: Endif
Endif
If [F:ITM]STOMGTCOD=3 & [F:ITM]DEFPOT<>0
[F:ORD]EXTQTY=[F:ORD]EXTQTY*100/[F:ITM]DEFPOT
Call QTEARR ([F:ORD]EXTQTY,[F:ITM]STU) From TRTDIV
[F:ORD]CPLQTY=[F:ORD]CPLQTY*100/[F:ITM]DEFPOT
Call QTEARR ([F:ORD]CPLQTY,[F:ITM]STU) From TRTDIV
[F:ORD]RMNEXTQTY=[F:ORD]RMNEXTQTY*100/[F:ITM]DEFPOT
Call QTEARR ([F:ORD]RMNEXTQTY,[F:ITM]STU) From TRTDIV
Endif
Return
#----- Conversion of the quantities in active unit if requirements come from purchasing -----#
$ORDMAJ
If find([F:ORD]WIPTYP,2,7) & left$([M:ORDK]ABBFIL,1)="P"
If [F:ITM]ITMREF<>[F:ORD]ITMREF
Read [ITM] ITM0=[F:ORD]ITMREF: If fstat Raz [F:ITM]: Endif
Endif
If [F:ITM]STOMGTCOD=3 & [F:ITM]DEFPOT<>0
[F:ORD]EXTQTY=[F:ORD]EXTQTY*[F:ITM]DEFPOT/100
Call QTEARR ([F:ORD]EXTQTY,[F:ITM]STU) From TRTDIV
[F:ORD]CPLQTY=[F:ORD]CPLQTY*[F:ITM]DEFPOT/100
Call QTEARR ([F:ORD]CPLQTY,[F:ITM]STU) From TRTDIV
[F:ORD]RMNEXTQTY=[F:ORD]RMNEXTQTY*[F:ITM]DEFPOT/100
Call QTEARR ([F:ORD]RMNEXTQTY,[F:ITM]STU) From TRTDIV
Endif
Return
Open tables
In the table below, the significant content flag indicates that the content is in phase with the context.
Table |
Significant content |
Table Title |
ORDERS |
No |
Pending movements |
ITMMASTER |
No |
Products |
ITMBPS |
No |
Products - Suppliers |
PREQUIS |
If TRAIT = 4 |
Header purchase requests |
PREQUISD |
If TRAIT = 4 |
Purchase request lines |
PORDER |
If TRAIT = 5 or 6 |
Purchase order headers |
PORDERC |
If TRAIT = 6 |
Contract product lines |
PORDERP |
If TRAIT = 5 or 6 |
Purchase order price lines |
PORDERQ |
If TRAIT = 5 or 6 |
Purchase order lines quantity |
Miscellaneous remarks
It is mandatory that this entry point must be used with two other entry points ORDMAJ and ORDLEC in order to easily process the problem of products with two units (quantities in active units for WIP and physical units for the purchase documents).
ORDLEC: Modification of the quantities after the read of the WIP
This entry point is located in the TRTACHMGT1 process takes into account the requirements for the workbenches (global planning, work plan and grouping), generates an action "ORDLEC".
The goal of this action is to give the possibility to convert into physical units the WIP quantities that are going to be read.
This is carried out as a function by default for the product, the WIP quantities are always expressed in active units.
Context and operating method
Different call cases
The call is made after the read of a record in the ORDERS table in the purchase module processes.
Available variables and masks
The [F :ORD] is loaded during the call to the action "ORDLEC".
The following quantities must be converted into physical units if the product is "flagged":
[F :ORD]EXTQTY
Planned quantity
[F :ORD]CPLQTY
Actual quantity
[F :ORD]RMNEXTQTY
Remaining quantity
Example of a specific/custom process activated by the entry point ORDLEC:
$ACTION
ACTION example
When "PECBESOINS" : Gosub PECBESOINS
When "ORDLEC" : Gosub ORDLEC
When "ORDMAJ" : Gosub ORDMAJ
Endcase
Return
#----- Conversion of the requirement quantity in physical unit---#
$PECBESOINS
If find(TRAIT,4,5,6) & ABREV="PMG" & (!find([M:PMG]WIPTYP(I),2,7) | [M:PMG]WIPSTA(I)=3)
If [F:ITM]ITMREF<>[M:PMG]ITMREF(I)
Read [ITM] ITM0=[M:PMG]ITMREF(I) : If fstat Raz [F:ITM] : Endif
Endif
If [F:ITM]STOMGTCOD=3 & [F:ITM]DEFPOT<>0
[L]RMNQTY=[L]RMNQTY*100/[F:ITM]DEFPOT
Call QTEARR ([L]RMNQTY,[F:ITM]STU) From TRTDIV
Endif
Endif
Return
#----- Conversion of the quantities in physical units after read [F:ORD] -----#
$ORDLEC
If [F:ITM]ITMREF<>[F:ORD]ITMREF
Read [ITM] ITM0=[F:ORD]ITMREF: If fstat Raz [F:ITM]: Endif
Endif
If [F:ITM]STOMGTCOD=3 & [F:ITM]DEFPOT<>0
[F:ORD]EXTQTY=[F:ORD]EXTQTY*100/[F:ITM]DEFPOT
Call QTEARR ([F:ORD]EXTQTY,[F:ITM]STU) From TRTDIV
[F:ORD]CPLQTY=[F:ORD]CPLQTY*100/[F:ITM]DEFPOT
Call QTEARR ([F:ORD]CPLQTY,[F:ITM]STU) From TRTDIV
[F:ORD]RMNEXTQTY=[F:ORD]RMNEXTQTY*100/[F:ITM]DEFPOT
Call QTEARR ([F:ORD]RMNEXTQTY,[F:ITM]STU) From TRTDIV
Endif
Return
#----- Conversion of the quantities in active unit if requirements come from purchasing -----#
$ORDMAJ
If find([F:ORD]WIPTYP,2,7) & left$([M:ORDK]ABBFIL,1)="P"
If [F:ITM]ITMREF<>[F:ORD]ITMREF
Read [ITM] ITM0=[F:ORD]ITMREF : If fstat Raz [F:ITM]: Endif
Endif
If [F:ITM]STOMGTCOD=3 & [F:ITM]DEFPOT<>0
[F:ORD]EXTQTY=[F:ORD]EXTQTY*[F:ITM]DEFPOT/100
Call QTEARR ([F:ORD]EXTQTY,[F:ITM]STU) From TRTDIV
[F:ORD]CPLQTY=[F:ORD]CPLQTY*[F:ITM]DEFPOT/100
Call QTEARR ([F:ORD]CPLQTY,[F:ITM]STU) From TRTDIV
[F:ORD]RMNEXTQTY=[F:ORD]RMNEXTQTY*[F:ITM]DEFPOT/100
Call QTEARR ([F:ORD]RMNEXTQTY,[F:ITM]STU) From TRTDIV
Endif
Return
Open tables
In the table below, the significant content flag indicates that the content is in phase with the context.
Table |
Significant content |
Table Title |
ORDERS |
Yes |
Pending movements |
ITMMASTER |
No |
Products |
Miscellaneous remarks
It is mandatory that this entry point must be used with two other entry points ORDMAJ and PECBESOINS in order to easily process the problem of products with two units (quantities in active units for WIP and physical units for the purchase documents).