Scope of Check in CO09 _ SAP Blogs
Short Description
ATP check details...
Description
8/10/2018
PPrroodduuccttss
Scope of Check in CO09 | SAP Blogs
IInndduussttrriies
SSuuppppoorrtt
TTrraaiinniin ng
CCoom mm muunniitty
DDeevveelloop peer
PPaarrttnneer
About About
Actions
Home Hom e / Community / Blogs
Scope of Check in CO09 September 18, 2014
|
6,753 Views |
Noel Connolly mor e by this this author
SD (Sales and Distribution) MAN Productio MAN Production n Planning (PP) | MM (Materials Management) | capacity | co09 | former jive document | logistics | materials management mana gement | materials planning | mrp
share 0
Follow
share
tweet
shar e
RSS
Purpose of this Document The purpose of this document is to explain the ags in the scope of check (transaction OVZ9) and to clarify which tables are read for each respective respectiv e ag. It shall also give a brief logic behind each of the ags and the code where this logic is applied. https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
1/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Motivation of this document Troubleshooting ATP issues inevitably brings you to transaction CO09. The most common ATP issue is the complaint “System tells me there is 0 available but there is something something available in MMBE” MMBE”.. CO09 will usually reveal the cause of such system behaviour. CO09 will display all the stock / receipt elements & requirements elements according to your scope of check. However, it can sometimes be dicult to know what exactly these elements are and where they are read from. An SAP consultant may have a background in SD and PP but not in MM. When that consultant sees an SD or PP element in the element list of CO09, they know immediately what it is referring to and where it came from. However Howev er,, that same consultant may struggle when they see an MM element. They do not know which table it came from, how it was created in that table etc. This can be frustrating if the consultant sees an element in CO09 on their production system system and wants to replicate the same on their non-production system. You arguably cannot tell the full story of the ATP overview if you are unaware of how the elements got into CO09. Furthermore, the ags in the scope of check can be somewhat ambiguous; for example, the dierence between “Incl dependent reqs” and “Incl. depen. reservat” could reservat” could easily be confused. You turn one ag on, both ags on, one ag on & one ag o in a trial t rial and error approach to see what the dierence would be. Such struggles led to the creation of a le, now manifested into this document. This document ensures that the consultant does not have to debug into CO09 every time they come across an element they might be unfamiliar with. If it is necessary to debug into CO09, the document provides provid es a starting point for debugging analysis for each respective ag. The document is intended to provide a quick reference reference that allows the reader to understand where the element is coming from and why it is being displayed in CO09. ___________________________________________________________________ _________________________________________________________
Part 1: Stocks 1) Include Safety Stock: Table it reads from: MARC (Plant Data for Material)
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
2/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Example of how this entry gets created in table MARC: Field “Safety Stock” in the MRP2 tab of the material master (Figure 1).
Figure 1: Safety Stock eld in Material Master
Figure 2: Safety Stock eld in table MARC Logic of the flag: Select on table MARC for the material and the plant. If flag is turned off, the safety stock maintained in the material master is subtracted from the available stock.
n example in CO09: There is unrestricted stock of 10 with no receipts or requirements. The safety stock is 2. Flag turned on: Available stock = 10 Flag turned o: Available stock = 8. Code that implements this logic: Include LMG22FSQ / FORM SELECT_SINGLE: SELECT SINGLE * FROM MARC WHERE MATNR = MARC_KEYTAB-MATNR and WERKS = MARC_KEYTAB-WERKS
Table 1: Select the material data from table MARC Include LATP2FSE / FORM STOCK_READ: * exclude safety stock IF G_T441 G_T441V-EISBP V-EISBP XFLAG. L_ATPK-MNG0 L_ATPK -MNG011 = L_ATPK-MNG01 – ATPMAT TPMAT-EISBE. -EISBE.
ENDIF.
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
3/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Table 2: Safety stock subtracted from available stock.
2) Incl. Stock in transfer: Table it reads from : MARC (Plant Data for Material)
Figure 3: “In Transfer” eld in the material master
Example of how this entry gets created in table MARC: Transfer posting in MIGO_TR updates the value in table MARC. E.G a transfer posting (movement type 303) is posted for a quantity of 5. This updates the “in Transfer Transfer (Plant)” eld in the “Plant Stock” tab of the material master (for the destination plant).
Logic of the flag: When ag is turned on, the value in the “in Transfer (Plant)” eld is added to the available stock of the receiving plant.
n example in CO09: There is unrestricted stock of 10 with no receipts or requirements. A goods movement of movement type 303 is posted from plant 0001 to plant 0002. This sets the stock in transfer to 5. Flag turned on: Available stock = 15 (10 + 5) in plant 0002. Flag turned o: Available stock = 10 (10) in plant 0002. Code that implements this logic: Include LATP2FSE / Form STOCK_READ: * include stock in transfer transfer between plant in receiving receiving plant IF G_T441 G_T441V-UMLMP V-UMLMP = XFLAG AND ( ATPGSW-DBFLG = SWOFF OR CM61B-BERID = ATPGA TPGA-BERID -BERID ). L_ATPK-MNG0 L_ATPK -MNG011 = L_ATPK-MNG01 + ATPMA ATPMAT T-UMLMC.
ENDIF.
Table 3: Stock in transfer (ATPMAT-UMLMC) added to the available stock
3) Incl. quality insp. Stock: https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
4/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
I)
Table it reads from: MARD (Storage Locaon Data for Material) Example of how this entry gets created in table MARD: Can occur by creating a goods receipt in MIGO of type “Quality Inspection” (See gure 4)
Figure 4: Quality Inspecon Stock type in MIGO
Figure 5: Field INSME in table MARD
Logic of the flag: If ag is set, the “In “I n Quality Inspection” (INSME) from table MARD (gure 5) is added to the available stock. If the ag is not set, the “In Quality Inspection” (INSME) from table MARD is not added to the available stock.
n example in CO09: – There is 7 in unrestricted unrestricted stock. A Goods movement with a quantity of 100 is posted into QI stock; this creates a quantity in MARD-INSME as illustrated in gure 5). Flag turned on: Available stock = 107. Flag turned o: Available stock = 7.
Code that implements this logic: Include LATP2FM3 / FORM MARD_CHECK
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
5/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Include LATP2FM3 / FORM MARD_CHECK IF ATPMAT-INSMK IS INITIAL OR (
ATPMAT-INSMK EQ XFLAG
AND LV_XHUPF EQ XFLAG ). S_ATPK-MNG01 = S_ATPK-MNG01 + MARD-INSME + MARD-KINSM. ENDIF. ENDIF.
Table 4: Add the quality stock (INSME) to the available stock
ii)
Table it reads from: MDQM (MRP View of the QM Inspecon Lot). This is a view of tables QALS and JEST. QALS: Inspecon lot record JEST: Individual Object Status
Example of how this entry gets created in table MDQM: An inspection lot with status SPRQ is created.
Logic of the flag: If ag is set, the system attempts to read inspection lots from table MDQM. Field INSMK must be set for the inspection lot to be selected.
n example in CO09: – There is unrestricted stock = 7. There are 4 inspecon lots in MDQM for the material. These amount to 13 (See figure 6).
Figure 6: Inspection lots for a material existing in view MDQM – When the ag is set, the system will select the inspection lots and consider them as receipts in CO09 (See gure 7)
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
6/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Figure 7: Flag is set so inspecon lots are displayed and there is an available quanty of 20 (7 + 10 + 1 + 1 + 1)
– When the ag is not set, the system will not select the inspection lots and they are not considered in CO09 (See gure 8)
Figure 8: Flag not set so inspecon lots not displayed and available quanty of 7.
Code that implements this logic: Include LATP2FM7 / FORM MDQM_READ:
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
7/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Include LATP2FM7 / FORM MDQM_READ: SELECT * FROM MDQM WHERE MATNR AND
= ATPMAT-MATNR
WERKVORG = ATPMAT-WERKS
AND SOBKZ
IN (SPACE, SOBKZK)
AND INSMK = CHARX AND ( KNTTP = SPACE OR STAT35 = SPACE ) AND PAENDTERM < ATPMAT-ENDWZ. CLEAR MDQM-SOBKZ.
Table 5: Select on table MDQM Include LATP2FM6 / Form MDQM_CHECK: * quantity S_ATPK-MNG01 = MDQM-LMENGEZUB.
Table 6: Quantity of MDQM-LMENGEZUB passed to the ATP structure Include LATP2TM0 / HIERARCHY_FILL: COLLECT S_ATPK INTO G_ATPKXR.
Table 7: Collects the ATP data into the Receipts structure
4) Incl. blocked Stock: Table it reads from: MARD (Storage Locaon Data for Material), fields SPEME & KSPEM
Example of how this entry gets created in table MARD: Can occur by creating a goods receipt in MIGO of stock type “Blocked” (See gure 9)
Figure 9: Stock type of “Blocked Stock” in MIGO
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
8/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Figure 10: Field SPEME in table MARD
Logic of the flag: If this ag is on, then elds MARD-SPEME (Blocked Stock) + MARD-KSPEM (Blocked Consignment Stock) are added to the available stock
n example in CO09: There is unrestricted stock of 10 with no receipts or requirements. The blocked stock is 5. Flag turned on: Available stock = 15. (10 + 5) Flag turned o: Available stock = 10. (10)
Code that implements this logic: Include LATP2FM3 / Form MARD_CHECK * include blocked stock (inclusive conseignment stock) IF G_T441V-SBSTP = XFLAG. S_ATPK-MNG01 = S_ATPK-MNG01 + MARD-SPEME + MARD-KSPEM. ENDIF.
Table 8: Blocked stock (MARD-SPEME) added to the available stock
5) Incl. restricted-use Stock: Table it reads from: MCHB (Batch Stocks) Example of how this entry gets created in table MCHB: Stock is created for batch managed material (e.g. through MIGO). The “Batch Restricted” flag can be set in transacon MSC2n (See fig ure 11)
Figure 11: Batch restricted flag in MSC3n https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
9/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Logic of the flag: Flag only relevant for batch stocks. SELECT on table MCHB to get the relevant batch stocks. If the ag is set, the system will add the value of the restricted use stock (MARC-CEINM) to the available stock.
n example in CO09: A batch has been set to “Restricted Use”. Flag turned on: The batch will appear in CO09, the quantity of the batch will be displayed and added to the available quantity. Flag turned o: The batch will appear in CO09, the quantity of the batch will be displayed as 0. The batch stock is not added to the available stock.
Code that implements this logic: Function VB_READ_BATCH: SELECT * FROM mchb INTO TABLE xv_mchb_dummy FOR ALL ENTRIES IN s0_mchb WHERE matnr EQ s0_mchb-matnr AND werks EQ s0_mchb-werks.
Table 9: Selects the batch data from table MCHB Include LATP2FM5 / Form MCHB_READ: * include restricted use stock IF g_t441v-nfvbc = xag. s_atpk-mng01 = s_atpk-mng01 + s_mchbx-ceinm. ENDIF.
Table 10: Loop through s_mchbx (contains the batches) and add blocked stock (ceinm) to the available quantity
6) W/o subcontracting: I)
Table it reads from: MSSL (Total Special Stocks with Vendor ) Example of how this entry gets created in table MSSL: Posng a 541 movement via MB1B can post stock into the MSSL table
Logic of the flag: If the ag is set, the system will not read table MSSL. If the ag is not set, the system will read table MSSL. When the ag is not https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
10/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
set, The eld “Unrestricted” (SLLAB) is added to the available quantity. Fields “In Qual. Insp.” (SLINS), & “Restricted-Use” (SLEIN) are added to the available quantity if the relevant ags are selected in the scope of check.
n example in CO09: – There is 4172 (4067 + 105) in unrestricted stock in table MARD (See gure 12)
Figure 12: Unrestricted stock in MARD – There is an entry in MSSL where unrestricted stock = 195 (See gure 13)
Figure 13: Unrestricted stock in MSSL The “W/o subcontracting” ag is set: Available Stock = 4172 (4172) The “W/o subcontracting” ag is not set: Available Stock = 4367 (4172 + 195)
Code that implements this logic: Include LATP2FMH / FORM MSSL_READ:
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
11/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Include LATP2FMH / FORM MSSL_READ: * include subcontracting IF G_T441V-OLBPR = XFLAG AND CM61B-BERTY K_LOHNB. EXIT. ENDIF.
Table 11: EXIT before the select if MSSL the ag is = “X” Include LATP2FMH / FORM MSSL_READ: SELECT LIFNR
SLLAB
SLINS
SLEIN
FROM MSSL INTO (MSSL-LIFNR,
MSSL-SLLAB,
MSSL-SLINS,
MSSL-SLEIN)
WHERE MATNR = ATPMAT-MATNR AND
WERKS = ATPMAT-WERKS
AND SOBKZ = SOBKZO.
Table 12: SELECT on table MSSL Include LATP2FMH / FORM MSSL_READ:
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
12/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Include LATP2FMH / FORM MSSL_READ: * valuated stock with unrestricted use P_ATPK-MNG01 = P_ATPK-MNG01 + MSSL-SLLAB. * include stock in quality inspection IF G_T441V-QMBSP = XFLAG. P_ATPK-MNG01 = P_ATPK-MNG01 + MSSL-SLINS.
ENDIF.
* include restricted use stock IF G_T441V-NFVBC = XFLAG. P_ATPK-MNG01 = P_ATPK-MNG01 + MSSL-SLEIN.
ENDIF.
Table 13: Values from MSSL added to the available stock
ii)
Table it reads from: RESB (Reservation/dependent requirements) Example of how this entry gets created in table RESB: A subcontract order is created in ME21n with components. This creates an entry in table RESB where BDART = “BB”.
Logic of the flag: When the flag is set, the system will not display the subcontracng requirements. When the flag is not set, the system will display the subcontracng element in CO09.
n example in CO09: – A subcontract order exists with a subcontracng component Flag turned on: Subcontracng element from RESB not displayed
Flag turned o: Subcontracting element from RESB displayed
Code that implements this logic: SAPLM61Q / FORM CHECK_NEW_KOMPONENTE
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
13/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
SAPLM61Q / FORM CHECK_NEW_KOMPONENTE *–> Daten in Tabelle MDPMX uebernehmen MOVE-CORRESPONDING MDPM TO MDPMX. MOVE SKBED
TO MDPMX-BDART.
IF MDPA-SOBKZ EQ BESKZF OR MDPA-BESKZ EQ BESKZF. MOVE BRBED
TO MDPMX-BDART.
MOVE MDPA-FLIEF TO MDPMX-LIFNR. ENDIF.
Table 14: When component added to subcontract order, constant BRBED passed to MDPMX-BDART (Later stored in RESB) LATP2TMR / DEFINE resb_t441v_check * check T441V if atpgd-anwdg c_appl_forcast and g_t441v-resbp xag
” material reservation
and g_t441v-skbdp xag
” dependent requirements
and g_t441v-olbpr = xag and g_t441v-arrep xag and g_t441v-arrep chara.
” without subcontracting ” all dependent reservations ” dep. reservations that can be
” withdrawn exit. endif.
Table 15: If OLBPR set, the system may exit before the SELECT (depending on other ags) Include LATP2FR1 / FORM RESB_DB_READ
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
14/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Include LATP2FR1 / FORM RESB_DB_READ SELECT * FROM atp_resb INTO TABLE lt_atpresb WHERE matnr = atpmat-matnr AND werks = atpmat-werks AND xloek = space AND kzear = space AND sobkz IN (space, sobkzk) AND bdmng > atp_resb~enmng AND txtps = space AND schgt = space AND dbskz = space AND ( vorab IS NULL OR vorab = space ).
Table 16: Select on RESB structure
___________________________________________________________________ _________________________________________________________
Part 2: In / Outward Movements 6) Incl. Purchase Orders: Table it reads from: EKET (Scheduling Agreement Schedule Lines) EKKO (Purchasing Document Header) – When the flag is set to “A”.
Example of how this entry gets created in table EKET: Purchase document can be created via transacon ME21n.
Logic of the flag: System selects from table EKET. If the ag is set to “X”, the purchase order will appear in CO09 and the quantity is added to the available quantity. The quantity of the PO may be adjusted depending on what has already been delivered / receipted.
n example in CO09: i) Flag set to “X”:
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
15/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Example 1: There is stock = 10 on your system. There is a Purchase Order with a quantity of 5 that has not yet been delivered or goods posted. Available quantity is 10 + 5 = 15 on the date of the PO. Example 2: There is stock = 10 on your system. There is a Purchase Order with a quantity of 5, of which 3 have been delivered. The Purchase order quantity will be reduced to 2 in CO09 while the 3 already delivered will be displayed as a shipping notication. Example 3: There is stock = 10 on your system. There is a Purchase Order with a quantity of 5, of which 3 have been goods receipted. The consequence is that CO09 will display 10 + 3 (13) as stock and 2 as the quantity of the purchase order. Overall available quantity is 15 on the date of the PO.
Code that implements this logic: Include LATP2TME: DEFINE ekes_t441v_check. * check T441V if g_t441v-lavip xag
” shipping notication for
” purchase orders and scheduling ” agreements and g_t441v-bestp xag
” purchase order and
” scheduling agreement and g_t441v-bestp ‘A’.
“1579745
exit. endif. END-OF-DEFINITION.
Table 17: Macro that checks if the ag is set Include LATP2FE3 / Form EKET_DB_READ:
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
16/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Include LATP2FE3 / Form EKET_DB_READ: SELECT * FROM atp_eket INTO TABLE lt_atp_eket WHERE matnr = atpmat-matnr AND werks = atpmat-werks AND bstyp IN (bstypf, bstypl) AND ( loekz = space OR loekz = chars ) AND elikz = space AND stapo = space AND pstyp pstyps
Table 18: Selects the data from EKET (ensuring it does not select a deleted PO etc.) Include LATP2TME: Macro eket_check: if p_atpmex-delkz = retpo and atp_eket-glmng >= atp_eket-wemng. p_atpmex-mng01 = atp_eket-menge – atp_eket-glmng. else. if atp_eket-wemng > atp_eket-dabmg. p_atpmex-mng01 = atp_eket-menge – atp_eket-wemng.
else. p_atpmex-mng01 = atp_eket-menge – atp_eket-dabmg.
endif.
endif.
Table 19: Calculates the quanty of the PO item in CO09 by subtracng the already delivered / MRP reduced quanty etc. from the quanty of the PO.
ii) Flag set to “A”: This means that the system will also consider the conrmed schedule lines of an STO. See SAP note 1579745
Code that implements this logic: Include LATP2FE8 / Form EKET_DB_READ_CONF:
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
17/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Include LATP2FE8 / Form EKET_DB_READ_CONF: *—(2)next step: Select EKKO IF NOT lt_sel_ekko IS INITIAL. SELECT ebeln FROM ekko INTO TABLE lt_res_ekko FOR ALL ENTRIES IN lt_sel_ekko WHERE ebeln = lt_sel_ekko-ebeln AND reswk ‘ ‘. ENDIF.
Table 20: Select from EKKO will only succeed when there is a value in
RESWK (Supplying Plant in STO) Class CL_MMPUR_SCHED_STO / Method BUILD_ATP_EKET_CONF
Table 21: Calculation of the conrmed quantity
7) Incl. Purchase Requisitions: Table it reads from: EBAN (Purchase Requision) Example of how this entry gets created in table EBAN: Purchase Requisition can be created via ME51n.
Logic of the flag: If the ag is not blank, then the system will execute a Select on table EBAN for the material / plant combination.
n example in CO09: – There is unrestricted stock of 10. There is a purchase requisition = 5. Flag turned on: Available stock (on date of purchase requisition) = 15 Flag turned o: Available stock = 10. (Purchase Requisition not considered)
Code that implements this logic: Include LATP2TME: Macro eban_t441v_check: * check T441V if g_t441v-banfp xag.
” purchase requisition exit.
endif.
Table 22: Check to see if the flag is set. If not equal to X, then system does not
proceed to the SELECT.
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
18/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
Include LATP2FE0 / Form EBAN_DB_READ: SELECT * INTO TABLE lt_atpeban FROM ATP_EBAN WHERE MATNR = ATPMAT-MATNR AND
WERKS = ATPMAT-WERKS
AND LOEKZ = SPACE AND EBAKZ = SPACE AND BSAKZ = BATYPN AND PSTYP PSTYPS AND SOBKZ IN R_SOBKZ.
Table 23: Select on the EBAN structure; ensures that a deleted purchase
req is not selected etc.
8) Incl. dependent reqs: Table it reads from: RESB (Reservation/dependent requirements) Example of how this entry gets created in table RESB: A planned order with a component is created (for example in MD11). The reservation of the component will have a requirements type (BDART) = “SB”.
Logic of the flag: If flag is set, the system will execute a select on RESB. These data selected from RESB will be considered requirements in the calculaon of the available quanty.
n example in CO09: – Available Stock = 100. A planned order is created with a component required quantity = 4. The component required quantity is conrmed. Flag turned on: Available Quantity is 96 (100 – 4) Flag turned o: Available Quantity is 100 (100)
Code that implements this logic: LATP2TMR / DEFINE resb_t441v_check
https://blogs.sap.com/2014/09/18/scope-of-check-in-co09/
19/59
8/10/2018
Scope of Check in CO09 | SAP Blogs
LATP2TMR / DEFINE resb_t441v_check * check T441V if atpgd-anwdg c_appl_forcast and g_t441v-resbp xag
” material reservation
and g_t441v-skbdp xag
” dependent requirements
View more...
Comments