How to Troubleshoot R41501 (Inventory to GL Reconciliation Update) and GPF1 (Inventory Flag)

Purpose of Document

This document is to guide user to have better understanding on how R41501 (Inventory to GL Reconciliation Update) is working?

For detail, refer to <Document 1678098.1> - E1: 41: 9.1 Enhancement - Inventory to G/L Reconciliation Process (P41500/R41500/R41501).

Below tables are to demonstrate as-is behavior of inventory transaction (example of P4114 - Inventory Adjustment). This simple transaction is to give you how Item Ledger File (F4111, namely Cardex) is written and how it corresponds to General Ledger (F0911) File which takes balanced figures with valid offset account.

Supposing that DMAAI (P40950) is defined as below,

AAI Number Co Do Ty G/L Cat Business Unit Obj Acct Sub Others
4122 00200 IA IN30 M30 1411 Inventory
4124 00200 IA IN30 M30 6310 Expense of COGS

Refer to <Document 625475.1> E1: 40: Automatic Accounting Instructions for Distribution (AAI / DMAAI) [Video]


In adding Inventory Adjustment through P4114 which writes data into,

Doc Co Document Number Do Ty Pay Itm JE Line Number G/L Cat Transaction Explanation Extended Cost/Price Program ID others
00200 1038 IA 000 1 IN30 Inventory Adjustments 500 EP4114 Inventory

Doc Co Do Ty Document Number JE Line Number Account Number Business Unit Obj Acct Sub LT Amount Explanation Alpha Name Program ID Inventory Flag (GPF1)
Others
00200 IA 1038 1 M30.1411 M30 1411 AA 500 Inventory Adjustments EP4114 1 Inventory
00200 IA 1038 2 M30.6310 M30 6310 AA -500 Inventory Adjustments EP4114 COGS

: Note that F0911.GPF1 flag is set '1' through inventory transaction (and which affects General Account)

In case Inventory Transaction, Sales Transaction and Procurement Transaction which affect F0911 did not set F0911.GPF1 flag correctly, check a certain routine which calls F0911FSEditLine (B0900049). For this example, XT4111Z1 (F4111EditLine) is responsible to set this flag in calling F0911FSEditLine.

Note: Possibly you may search for the fix through below business functions:


Case Study: In your running R41501 against the document above (1038|IA|00200), which updates JE Line number 2.00 which is COGS line. Why this is happening?

This type of issue can be coming in below settings,

AAI Number Co Do Ty G/L Cat Business Unit Obj Acct Sub Others
4122 00001 IT **** 6310 COGS


The reason which updates cost line from F0911 is that,

  1. Reads through all Object Account (OBJ) based on DMAAI for cost. So in reading DMAAI '4122' this routine stores the object account '6310'
  2. Compare F0911.OBJ with the value returned above
  3. Since one of DMAAI set the object account 6310 as a cost account, R41501 sets F0911.GPF1 = '1' (which is not what you want to have)

In case you have this type of issue, try as below,

  1. Look for the F0911.OBJ which gets updated through R41501
  2. Open table F4095 through Databrowser
  3. Search for all DMAAIs which meets this object (refer below full list of DMAAI below)
  4. Refine that DMAAI


Information written below is to explain what R41501 (Inventory to GL Reconciliation Update) performs:-

Note that actual routine is handled through business function UpdateGPFInF0911 (B4100961, Update GPF In F0911) called by R41501 (Inventory to GL Reconciliation Update)

Business Function: UpdateGPFInF0911 (B4100961, Update GPF In F0911)

Parameter Name Data Item Data Type Req/Opt I/O/Both Others
szDocumentType DCT char OPT NONE
mnDocumentNumber DOC MATH_NUMERIC OPT NONE
szDocumentCompany KCO char OPT NONE
jdGLDateBegin DGL JDEDATE OPT NONE
jdGLDateEnd DGL JDEDATE OPT NONE
szErrorID DTAI char OPT NONE
cSupressErrorMessage EV01 char OPT NONE
mnBatchNumber ICU MATH_NUMERIC OPT NONE
szWOCompletionDocType DCT char OPT NONE
szWOIssueDocType DCT char OPT NONE
szLeanCompletionDocType DCT char OPT NONE
szLeanIssueDocType DCT char OPT NONE
mnDocumentOrderNumber DOCO MATH_NUMERIC OPT NONE
szScrapDocType DCT char OPT NONE
mnJobnumberA JOBS MATH_NUMERIC OPT NONE
szComputerID CTID char OPT NONE
cProofFinal EV01 char OPT NONE

First of all, check cTransactionType as below,

cTransactionType Nature of Transaction DMAAI Explanation
1 Sales 4240 Inventory (SOI)
4241 Inventory in Transit
2 Purchase 4310 Inventory (OPI)
4326 Weight Tag Price Adjustment
4330 Received /Vouchered (OPV)
4338 Reprice Variance - Inventory
4350 Purchase Tax Accrual (OPT)
4385 Cost/Expense Adjustment (OPD)
3 Inventory (Others) 3110 Inventory/Row Material
3130 Sub-Assmby/Finished Goods
3140 Project Contra
3910 Inventory Stock Valuation (Adjustment)
4122 Inventory
4134 Inventory (CDIV)
4152 Inventory (PINV)
4162 Inventory (AVCI)
4172 Inventory (CI)
4240
4241
4310
4326
4338
4340 Exchange Rate
4350
4385

Note:

Simplified routine of UpdateGPFInF0911 (B4100961, Update GPF In F0911) called by R41501 (Inventory to GL Reconciliation Update)

General Routine of B4100961


Subroutine/Subfunction I4100961_RetrieveAccountForInvAAI

Subroutine 1

Sub-routine2

Subroutine2

Sub-routine 3:

(* To be added *)

Related Query:

---| I4100961_RetrieveAccountForInvAAI
------| I4100961_RetrieveUDCRecords UDC 41|IN to get cTransactionType (*cTransactionType = dsF0005Fetch.drdl01[0] ;)
------| Prepare Select data from F4111 on (ILDOC = dsDS->mnDocumentNumber And ILDCT = dsDS->szDocumentType And ILKCO = dsDS->szDocumentCompany And ILDGL >= dsDS->jdGLDateBegin And ILDGL <= dsDS->jdGLDateEnd)
sql> SELECT * FROM PRODDTA.F4111 WHERE ( ILDOC = 975.000000 AND ILDCT = 'IA' AND ILKCO = '00200' AND ILDGL >= 116091 AND ILDGL <= 116091 ) ORDER BY ILGLPT ASC
------| JDB_Fetch (F4111)
------| WHILE
---------| Check input GLDates
---------| is F4111.IPCD IN ('Y', 'y', ' ', '\0') AND F4111.ICU <> 0
------------| is cTransactionType IN ('1', '2', '3')
---------------| retrieve company on F4111.MCU
---------------| get F4111.GLPT
---------------| Load the AAIs and Get the Accoount Numbers from F4095 based on the transaction type
------------------| cTransactionType = 1 (sales): 4240, 4241
------------------| cTransactionType = 2 (purchase): 4310, 4326, 4385, 4330, 4340, 4350, 4338
------------------| cTransactionType = 3 (all): 4122, 3110, 3130, 3910, 4134, 4152, 4162, 4172, 4240, 4241, 4310, 4326, 4385, 3140, 4340, 4350, 4338
---------------------| I4100961_RetrieveObjAccount
------------------------| JDB_SelectKeyed on (F4095.ANUM, CO, GLPT with same way to retrive DMAAI - Most specific to most generic) *** Refer DMAAI listed above - reads specific to generic
---------------------------| JDB_Fetch (F4095)
---------------------------| WHILE
------------------------------| I4100961_AddObjAccountToStruct
---------------------------------| Save F4095.obj into szObjAccount (= aStrObjAccount[iCounter])
------------------------------| JDB_Fetch
---------------------------| End WHILE
---------| JDB_Fetch
------| End WHILE

---| I4100961_SelectAndUpdateF0911
------| I4100961_PrepareSelectF0911 on (GLDOC = F3106 DOCO And GLDCT = lpDS->szDocumentType And GLKCO = lpDS->szDocumentCompany And GLDGL >= lpDS->jdGLDateBegin And GLDGL <= lpDS->jdGLDateEnd)
sql> SELECT * FROM PRODDTA.F0911 WHERE ( GLDOC = 975.000000 AND GLDCT = 'IA' AND GLKCO = '00200' AND GLDGJ >= 116091 AND GLDGJ <= 116091 ) ORDER BY GLDCT ASC,GLDOC ASC,GLKCO ASC,GLDGJ DESC,GLJELN ASC,GLLT ASC,GLEXTL ASC

------| JDB_Fetch (F0911)
------| WHILE loop
---------| is F0911.gpf1 <> '1' and F0911.lt not in ('CA', 'XA', 'YA', 'ZA')
------------| I4100961_RtvObjAccountToStruct based on F0911.OBJ per cTransactionType ***
---------------| Check exiting object array from Compare F0911.OBJ with all F4095.OBJ stored by I4100961_AddObjAccountToStruct
------------| Is Record met?
---------------| cProofFinal = '1'
------------------| I4100961_UpdateGLRecord
---------------------| I4100961_PrepareUpdateSelectF0911 on DOC, DCT, KCO, LT (=AA), DGJ, JELN, EXTL
------------------------| (SUCCESS) set F0911.gpf1 = 1
sql> UPDATE PRODDTA.F0911 SET GLGPF1='1' WHERE ( GLDCT = 'IA' AND GLDOC = 975.000000 AND GLKCO = '00200' AND GLDGJ = 116091 AND GLJELN = 2.000000 AND GLLT = 'AA' AND GLEXTL = ' ' ) AND ( GLDOC = 975.000000 AND GLDCT = 'IA' AND GLKCO = '00200' AND GLLT = 'AA' AND GLDGJ = 116091 AND GLJELN = 2.000000 AND GLEXTL = ' ' )

------------------| UpdatedGLRecordCache
---------| JDB_Fetch
------| end WHILE

To be completed by July-31-2016