Missing Price History (F4074) When Edit Line and End Doc got called in different Call Object Kernel Process - CASE STUDY

Goal

Why the sales order master business function (F4211FSEndDoc) is not able to retain F4074 (Price History) when,

Solution

To populate F4074 based on F40UI74 which got written during Edit Line routine,

The function F40UI74DAOInitExt called by F4211EditDoc (this function gets called by F4211FSEndDoc) returns SUCCESS

So, same process continue process to update F40UI74.SFXO by calling F40UI74DAOUpdateCorrectLineExt

Example:

Calling Business function F40UI74DAOUpdateCorrectLineExt from F4211EditDoc for GES. Application Name [DConnector], Version [] (BSFNLevel = 3)

UPDATE PRODDTA.F40UI74 SET AWCTID='INTEGRATIONSVR ',AWJOBS=75977032.000000,AWPEID=16104.000000,AWTCID=25.000000,AWXLIN=1000.000000,AWAREV=1.000000,AWDOCO=211446.000000,AWDCTO='SO',AWKCOO='00709',AWSFXO=' ',AWLNID=1000.000000,AWAKID=0.000000,AWSRCFD=' ',AWOSEQ=0.000000,AWSUBSEQ=0.000000,AWTIER=0.000000,AWASN=' ',AWAST=' ',AWITM=6044029.000000,AWAN8=0.000000,AWCRCD='INR',AWUOM='EA',AWMNQ=0.000000,AWLEDG=' ',AWFRMN=' ',AWBSCD=' ',AWFVTR=40000.000000,AWABAS=' ',AWUPRC=20000000.000000,AWFUP=0.000000,AWGLC=' ',AWARSN=' ',AWACNT=' ',AWSBIF=' ',AWMDED=' ',AWPROV='1',AWATID=0.000000,AWLITM=' ',AWAITM=' ',AWDSC1=' ',AWLNTY=' ',AWUORG=0.000000,AWFGY=' ',AWORPR=' ',AWSO08=' ',AWRPRC=' ',AWOLVL=' ',AWCATLG=' ',AWIGID=0.000000,AWCGID=52795.000000,AWOGID=0.000000,AWANPS=0.000000,AWBSDVAL=0.000000,AWSRFLAG=' ',AWADJCAL=' ',AWNBRORD=0.000000,AWUOMVID=' ',AWACCAN8=0.000000,AWBNAD=0.000000,AWADJGRP=' ',AWMEADJ=' ',AWADJSTS=' ',AWADJREF=' ',AWFVUM=' ',AWPDCL=' ',AWCFGID=0.000000,AWCFGCID=0.000000,AWAPRP1=' ',AWAPRP2=' ',AWAPRP3=' ',AWAPRP4=' ',AWAPRP5=' ',AWAPRP6=' ',AWNDPI=' ',AWPMTN=' ',AWRULENAME=' ',AWPA04=' ',AWADJQTY=' ',AWQTYPY=0.000000,AWSTPRCF=' ',AWTSTRSNM=' ' WHERE ( AWCTID = 'INTEGRATIONSVR ' AND AWPEID = 16104.000000 AND AWJOBS = 75977032.000000 AND AWTCID = 25.000000 AND AWXLIN = 1000.000000 AND AWDOCO = 211446.000000 AND AWDCTO = 'SO' AND AWKCOO = '00709' AND AWSFXO = ' ' AND AWLNID = 0.000000 AND AWAREV = 1.000000 AND AWAKID = 0.000000 AND AWSRCFD = ' ' AND AWOSEQ = 0.000000 AND AWSUBSEQ = 0.000000 )

Calling Business function F40UI74DAOInitExt from F4211EditDoc for GES. Application Name [DConnector], Version [] (BSFNLevel = 3)
IN->[ 1] idDAOIndex [0]
IN->[ 2] mnJobNumber [75976968]
Entering GetPricingHistoryCacheFlag
Entering jdeCacheInit - Name:[75976968DataMapCDISTCache]
Incremented cache count to 141
Created new cache - hCache:[e5762678]
hCache:[e5762678] Nm:[975976968DataMapCDISTCache] Recs:0 Curs:0 Hnds:1 Cchs:141 INIT new
Entering jdeCacheTerminate
hCache:[e5762678] Nm:[975976968DataMapCDISTCache] Recs:0 Curs:0 Hnds:1 Cchs:141 TERM one
GetPricingHistoryCacheFlag Get handle Failed
Entering JDB_OpenTable(Table = F40UI74)
Incremented table handle count to 109
Exiting JDB_OpenTable(Table = F40UI74) (UserHandle e9e27e88) (hRequest ecda9e30) with Success
Incremented DataPointer count to 1
OUT->[ 1] idDAOIndex [1001]
OUT->[ 2] mnJobNumber [75976968]
Return value is 0 for F40UI74DAOInitExt. (BSFNLevel = 3)

Conclusion:

: Regardless the parameter used for cCMUpdateWriteToWF (regardless writing cache or workfile) F40UI74DAOInitExt always try to read it in cache which was created by another process, which eventually fails. So the reason End Doc fails to write F4074 based on F40UI74 is that the SFXO value (a number of spaces) between Edit Line and End Doc are different (1 to 3).

In this scenario, client has implemented pseudo e-Commerce so Begin Doc and Edit Line routine writes a physical work files assuming that End Doc can handle it so long as the job number and machine ID are unique. This works fine except for F40UI74 table because of the nature of advanced price routine.