How To Implement Flexible Account in Custom Routine (Case Study)

Purpose of Document

This document explains as-is routine which deals with Flexible Account (or Flex Account).

Business Requirement:

We are using EnterpriseOne with Oracle Transportation Management (OTM) and there is no feature to create accruals for the freight cost. We had to extract data from OTM into custom tables and create the G/L entries and liability records. We needed flex accounting to work but could not figure out the proper business functions and what data to pass; so we hard coded the accounting.
The current situation is that we had to create an other module to handle customs entries and also generate G/L entries and liabilities. The accounting for brokerage and duties also will need flex accounting. This is why we need to know how to implement the routine.
We are using DMAAI's in the 9100 series after getting confirmation from Oracle that the 9100 series would not be used in the future.
In the end, for any company customizing within the distribution system, there might be special needs not available in JDE that flex accounting would be needed like we needed to. Documentation would be welcomed.

Disclaimer:

This document contains some contents which is beyond the support scope of Oracle's JD Edwards EnterpriseOne application release support. Go through full cycle test before you put this raw code not to disturb any standard application logic.

The simplified routine here is adopted from the existing routine of XT4111Z1 which flex account either for MCU or for SUB.The AAI Number, Document Type, Company, G/L Category Code are variables, which you can choose to meet your business requirement. You can use this document to have better understanding on how standard EnterpriseOne applications flex account - if possible, refer to the exiting document which explains setup and examples,

Note that Flexible Account is working for hard-code list of applications as below,

Note:

Object Affected:

• New objects:
- 2 Data Structure to handle Edit Line (which validates a record and get flex account before it calls F0911FSEditLine)
- Two BSFN to handle both validation and creation on cache and commit cache to database
- One interactive or batch application to call above BSFN
• Change object
- BuildFlexibleAccountwithCache is to include the custom application/function

Setup:

(For this case study, the object ID used is 'N55FLEX0'. You can define your own object if needed)

  1. P1691 (Cost Object Rule Setup Method), add entry for N55FLEX0 with Method 'A - AAI Number method'
Functionality enabled Application ID Method Method Description
FA (Rule Setup Method) N55FLEX0 A AAI number method

2. P16902 (Enabled Functionality by Application) which enable you to list a number of tables which you want to flex

Functionality Enabled Functionality Description Table Name Table Description Application Name
FA Flex Accounting F0006 Business Unit Master N55FLEX0
FA Flex Accounting F0101 Address Book Master N55FLEX0
FA Flex Accounting F4101 Item Master N55FLEX0
FA Flex Accounting F4102 Item Branch File N55FLEX0
SM Rule Setup Method N55FLEX0

: So function N55FLEX0 can make use of columns from the tables F0006, F0101, F4101, and F4102 (custom table can be added here)

3. P4095 (DMAAI), specify Object Account (repeat this in case you want to flex both Debit and Credit lines)

AAI Number Description Description - 2
9122 Inventory Custom
9124 Expense Custom

AAI Number Co Do Ty Description G/L Cat Description G/L Branch Plant Obj Acct Sub
9122 00200 IA Inventory Adjustments IN30 Manufactured Finished Goods 1411

: For this example, custom DMAAI 9122 (credit line) and 9124 (debit line) are to be used. You must have this one because flexible accounting is part of DMAAI routine

4. P40296 (Flex Rule Definition) - Example,

Co Doc Type AAI Number Business Unit Subsidiary Subledger Data Item File Name
00200 IA 9122 X Buyer Number F4102

: So subsidiary of the object account is coming from F4102.BUYR

5. P0901 (Account Master): Make it sure the account you want to flex is defined/added

6. Reset database Cache - Tables F4095, F4096, and F0901 belong to Database Cache (or, a member of P98613)



User Interface:

For this example, one dummy interactive application is created. The data for this add-on application can be added dynamically based on the business requirement. Actual parameters are specified below, which make use of GC or FC variable depending on the level of detail.

Simplified routine:

For this example, one dummy interactive application is created,

BatchReviseOnExit

Apps Wrapper Detail Functions (2ndLevel) Purpose
Calling Application for user interface
CustomFlexAccountAndCallF0911FSEditLine This is wrapper to interface with standard E1 business functions
FSOpenBatch to open batch (for this example, N type batch)
F0911FSBeginDoc To initialize G/L Cache
CacheProcessFlexInventoryAcctng Initilaize Flex Accounting. Depending on the application you are calling this can be done at different level
RetrieveDistAAIwF4095Cache Get DMAAI and Flex Account for 9122
F0911FSEditLine Validate and create G/L cache
RetrieveDistAAIwF4095Cache Get account for 9124
F0911FSEditLine To validate and create G/L Cache for debit line
(this document shall not cover BSFNLevel 3 and below)
CustomFlexAcctEndDoc
GetAuditInfo Application ID and Machine ID are one of key factors to control routine. Optional to write audit information into F0911
X0010GetNextNumber To set F0911.DOC (you can have your own numbering and type)
F0911FSGetNextDocNumber this function associate this number on the cache created through Edit Line
F0911FSEndDoc To commit cache created above
To update batch status from in use to something else. Batch header is means to isolate transaction for this example
CacheProcessFlexInventoryAcctng To terminate cache for flex accounting
RetrieveF4095Cache To terminate cache for F4095
RetrieveF4096Cache To terminate cache for F4096

Business Functions:

For this example, one dummy interactive application is created,

Parameter Name Data Item I/O Mapping Used For
szDocumentType DCT IN GC Or Ty Key to read F4095/F4096
szCompanyKey KCO IN GC Order Co Key to read F4095/F4096
mnDocVoucherInvoiceE DOC IN GC Order Number
mnJournalEntryLineNo JELN IN 0
jdDateForGLandVoucherJULIA DGJ IN GC Order Date
mnBatchNumber ICU OUT FC Batch Number This is to communicate with G/L
szBatchType ICUT IN N For this example, type N is used
jdDateBatch DBT IN GC Order Date
mnJobnumberA JOBS OUT FC Job Number
mnIdentifierShortItem ITM IN GC Short Item No
mnAddressNumber AN8
mnDocumentOrderInvoiceE DOCO IN GC Order Number
mnItemNumberShortKit KIT
szIdentifier2ndItem LITM IN GC 2nd Item Number
szIdentifier3rdItem AITM
szCostCenter MCU IN GC Business Unit Key to read F4095/F4096
szTransactionReference TREF
mnAmountField AA IN GC Extended Price
szAcctNoInputMode ANI
szGlClass GLC IN GC G/L Offset Key to read F4095/F4096
szSubledger SBL
cSubledgerType SBLT
szGlCategory GLPT
szSubsidiary SUB
szCostCenterAlt MMCU
szComputerID CTID IN FC Machine Key
szApplicationGroup EAP IN N55FLEX0

Parameter Name Data Item I/O Mapping Used For
mnJobNumber MATH06 IN FC Job Number Key for Cache
szComputerID CTID IN FC Machine Key Key for Cache so both edit line and end doc share it
cErrorFlag EV01
mnBatchNumber ICU IN FC Batch Number
szBatchType ICUT IN N
cPrevBatchStatus IST
cBatchStatus EV01
cDocInBalance EV01
cSuppressBatchControl EV01
cExitedOnAdd EV01 IN 0
cOverrideMode EV01
mnStartingDocAmount AA
cCurrencyFlag CRYR
mnNextNumberIndex MATH06
szNextNumberSystemcode SY
cTypeOfDocument EV01
mnDocNumber DOC
szProgramID PID IN P55FLEX0
szUserID USER IN SL UserID
cUpdateBatchHeader EV01
cBypassCurrencyConv EV01
cConfigHubTransactionType EV01
cRevenueRecognitionFlag RRF


---------------------------------- Below are called by the wrapper functions above --------------------------------------------------

Parameter Name Data Item I/O Mapping Used For
cPrevBatchstatus IST
cPostoutofbalance EV01 ' ' Because this routine is simply creates F0911 (not posting)
szBatchtype ICUT szBatchType
mnBatchnumber ICU VA evt_BatchNumber or return to BF mnBatchNumber
jdBatchDate DICJ VA evt_DateBatchJulian
cCancelBatchControl EV01 1 Not to have batch control

Parameter Name Data Item I/O Mapping Used For
mnJobNumber MATH06 OUT VA evt_JobnumberA This is job number to communicate with End Doc routine
cDocAction ACTN A Add
cEditInstructionFlag EV01 1 Full Validation
cErrorFlag EV01 0 No error
cTypeDoc EV01
mnLastLineNumber JELN 0 To add a new entries
szCompanyKey KCO BF szCompanyKey Order or document company to set
szDocumentType DCT IA Any document type. For this example, setting is done on this type
mnDocNumber DOC
jdGLDate DGJ SL DateToday Or assign value through the wrapper function
szLedgerType LT
mnBatchNumber ICU VA evt_BatchNumber The batch number above
szBatchType ICUT BF szBatchType Batch type used to get batch number
jdBatchDate DICJ VA evt_DateBatchJulian Batch date used for header
jdBatchSystemDate DSYJ
mnBatchTime TICU
szTransactionCurrency CRCD
mnCurrencyRate CRR
szExplanation EXA "custom flex" This is mandatory parameter
szReference1 R1
szHomeBusinessUnit HMCU
szInvoiceNumber VINV
jdInvoiceDate IVD
cReverseVoid RE
jdHistoricalDate HDGJ
mnHistoricalRate HCRR
cCurrencyMode CRRM
szBaseCoCurrency CRDC
cMultiCurrencyInterco DOT1
mnAmountToDistribute ATAD
mnCurAmountToDistribute CTAD
cCurrencyFlag CRYR N, Y, or, Z SL CurrencyFlag
cHeaderChangedFlag EV01
cModelFlag EV02
szJEVersion VER ZJDE0001 The version of P0900049
cExchangeRateDateFlag EV01
cPaymentInstrument PYIN
cConfigHubTransactionType EV01
szBaseCompany CO

Parameter Name Data Item I/O Mapping Used For
cSuppressErrorMessage SUPPS IN 1
szErrorMessageID DTAI
cActionCode ACTN IN 3 1 - Map data to Flex Cache
2 - Map Flex Cache to Data
3 - Add Cache or update cache
4 - Delete Cache
8 - Terminate All
mnJobNumber JOBS IN VA evt_JobnumberA Across communication, this job number is key for cache
mnShortItemNumber ITM IN BF mnIdentifierShortItem
szBranchPlant MCU IN BF szCostCenter
mnAddressNumber AN8
sz2ndItemNumber LITM IN BF szIdentifier2ndItem Optional
sz3rdItemNumber AITM
mnKitItemNumber KIT
szBranch MMCU
szAgreementNumber DMCT
mnOrderNumber DOCO
szTransactionReference TREF
szReasonCode RCD

Parameter Name Data Item I/O Mapping Used For
mnAAITableNumber ANUM IN 9122, and 9124
szCompanyNumber CO IN BF szCompanyKey
szOrderType DCTO IN <Blank> Because F4095.DCTO is BLANK
szDocumentType DCT IN IA For this example, it is hard coded but this can be flexible depending on the setup
szGLCategory GLPT IN BF szGlClass
szCostType COST IN <Blank> Because AAI method is in use
szBranchPlant MCU IN BF szCostCenter
szObjectAccount OBJ
szSubsidiary SUB IN BF szSubsidiary
szCostCenter MMCU
szAccountNumber ANI OUT BF szAcctNoInputMode
cSuppressErrorMessage EV01
szErrorMessageID DTAI
cVoidAccountValidation EV02
mnJobNumber JOBS IN VA evt_JobnumberA
cSalesFlexAccountingFlag EV03 IN 1 Hard coded
szSubledger SBL IN BF szSubledger
cSubledgerType SBLT
szApplicationGroup EAP IN BF szApplicationGroup
szManagerialAnalysisCode1 ABR1
szManagerialAnalysisCode2 ABR2
szManagerialAnalysisCode3 ABR3
szManagerialAnalysisCode4 ABR4
cManagerialAnalysisType1 ABT1
cManagerialAnalysisType2 ABT2
cManagerialAnalysisType3 ABT3
cManagerialAnalysisType4 ABT4
mnIdentifierShortItem ITM
szAccountUnitOfMeasure UM
szPriceAdjustmentType AST
szProjectBusinessUnit MCU
szProjectSubsidiary SUB
mnTransactionID TSID
szComputerID CTID IN BF szComputerID This is key field for cache along with Job Number

Parameter Name Data Item I/O Mapping Used For
mnJobNumber MATH06 IN VA evt_JobnumberA Key for cache - through this Begin Doc, Edit Line and End Doc can communicate with each other.
cLineAction ACTN IN A Add Mode
cProcessingMode EV01 IN 1
cEditFlag EV01 IN 1
cErrorFlag EV01
cRecordWrittenFlag EV01
cTypeDoc EV01 IN J
mnLineNumber JELN IN 0
mnAmount AA IN BF mnAmountField
szAccountNumber ANI IN BF szAcctNoInputMode
szAccountID AID
szBusinessUnit MCU IN BF szCostCenter
szObject OBJ
szSubsidiary SUB
cAccountMode AM IN 2
mnFiscalYear FY
mnPeriodNumber PN
mnCentury CTRY
szSubledger SBL
cSubledgerType SBLT
mnUnits U
szUnitOfMeasure UM
jdServiceDate DSVJ
szLineExtension EXTL
szAssetID ASID
cPostedCode POST
szExplanation EXR
szReference2 R2
szPayItem SFX
cBillCode BC
mnDoiSub DOI
szWorkOrder001 WR01
szOutsiderLeaseWellID ALID
szOrderType DCTO
mnLineID LNID
szPODocType PDCT
szPOKeyCompany PKCO
szPurchaseOrder PO
szPOSuffix PSFX
c1099Flag TNN
mnCurrencyAmount ACR
mnForeignTaxAmount CTAM
mnForeignTaxableAmount CTXA
mnTaxAmount STAM
mnAmountTaxable ATXA
szTaxExplanationCode EXR1
szTaxArea TXA1
cCurrencyFlag CRYR
szCompany CO
jdCheckDate DKJ
szDisplayKeyCompany KCO
szDisplayBaseCoCurr CRDC
szDisplayTransCurrency CRCD
mnDisplayExchgRate CRR
cDisplayCurrencyMode CRRM
mnLastLineNo JELN
mnOriginalAmount ANOG
mnOriginalAmountForeign FAA
cGlPostCodeAlt001 ALT1
cGlPostCodeAlt002 ALT2
cGlPostCodeAlt003 ALT3
cGlPostCodeAlt004 ALT4
cGlPostCodeAlt005 ALT5
cGlPostCodeAlt006 ALT6
cCommitmentReliefFlag ALT7
cBillingControl ALT8
cGlPostCodeAlt009 ALT9
cGlPostCodeAlt000 ALT0
cGlPostCodeAlt00X ALTX
szCheckNumber CN
jdDateCheckCleared DKC
cSummarizedCode SUMM
cPurgeCode PRGE
cBatchRearEndPostCode BRE
szJobCategory JBCD
szJobStep JBST
mnWeeklyYear WY
mnWeeklyPeriod WN
cFinalPayment FNLP
cAssetInputMode ASM
mnSequenceNoOperations OPSQ
mnOriginalDocNumber ODOC
szOriginalKeyCo OKCO
cClientFreeForm1 CFF1
cClientFreeForm2 CFF2
szGlClass GLC
cDeleteNotAllowed DLNA
szIdType ALTY
szSubledgerDescription DL01
szAccountDescription DL01
cBypassMEditFlag EV01
cReconciledCode RCND
mnTaxAmountGross AA
mnForeignTaxAmountGross ACR
cPostingCode1ManagerialAccount PM01
cPostingCode2ManagerialAccount PM02
cPostingCode3ManagerialAccount PM03
cPostingCode4ManagerialAccount PM04
cPostingCode5ManagerialAccount PM05
cPostingCode6ManagerialAccount PM06
cPostingCode7ManagerialAccount PM07
cPostingCode8ManagerialAccount PM08
cPostingCode9ManagerialAccount PM09
cPostingCode10ManagerialAccoun PM10
cManagerialAnalysisType1 ABT1
szManagerialAnalysisCode1 ABR1
cManagerialAnalysisType2 ABT2
szManagerialAnalysisCode2 ABR2
cManagerialAnalysisType3 ABT3
szManagerialAnalysisCode3 ABR3
cManagerialAnalysisType4 ABT4
szManagerialAnalysisCode4 ABR4
mnIdentifierShortItem ITM
mnAddressNumber AN8
szOverrideExplanation EXA
mnTaxItemNumber TXITM
cTrackTaxesFlag TKTX
mnDistributionLineNumber DLNID
cGLPostingCodeAlternateW ALTW
szCkNumber CKNU
szAlternateHomeBU AHBU
szJobPoolGroupingCode JPGC
szEmployeePoolGroupingCode EPGC
cBurdeningPostedCode BUPC
cInventoryFlag GPF1
cCogsInvRevFlag EV01



------------------------------ Below is callilng End Doc routine --------------------------------------

Parameter Name Data Item I/O Mapping Used For
szSystemCode SY IN 41
mnNextNumberingIndexNo NNIX IN 2
szCompanyKey KCO IN 00200
szDocumentType DCT IN IA
mnCentury CTRY IN 20
mnFiscalYear1 FY IN 17
szSameAsDocumentType SMAS
mnNextNumber001 N001 OUT VA evt_NextNumber002


Parameter Name Data Item I/O Mapping Used For
mnJobNumber JOBS IN BF mnJobNumber
cErrorFlag EV01
mnNextNumberIndex MATH01 IN 2 Along with X0010 these two parameters can be set for custom routine if needed.
szNextNumberSystemCode SY IN 41
cTypeOfDocument EV01
mnDocNumber DOC I/O VA evt_NextNumber002 This is the document number for F0911.DOC

Parameter Name Data Item I/O Mapping Used For
mnJobNumber MATH06 IN BF mnJobNumber
szComputerID CTID
cErrorFlag EV01
mnBatchNumber ICU IN BF mnBatchNumber
szBatchType ICUT IN BF szBatchType
cPrevBatchStatus IST
cBatchStatus EV01 IN BF cBatchStatus
cDocInBalance EV01
cSuppressBatchControl EV01
cExitedOnAdd EV01 IN 0
cOverrideMode EV01 IN A
mnStartingDocAmount AA
cCurrencyFlag CRYR IN N, Y, or Z
mnNextNumberIndex MATH06 IN 2
szNextNumberSystemcode SY IN 41
cTypeOfDocument EV01 IN J
mnDocNumber DOC IN VA evt_NextNumber002
szProgramID PID IN VA evt_ProgramId
szUserID USER IN VA evt_UserId
cUpdateBatchHeader EV01 IN 1
cBypassCurrencyConv EV01
cConfigHubTransactionType EV01
cRevenueRecognitionFlag RRF

Parameter Name Data Item I/O Mapping Used For
mnBatchNumber ICU IN BF mnBatchNumber
szBatchType ICUT IN N
cPreviousBatchStatus EV01
cFLAGBatchStatus EV02 IN 1
cFLAGTransactionInBalance EV03
cFLAGSuppressBatchControl EV04
cOverrideMode EV01
cSuppressDeleteFlag EV01

Parameter Name Data Item I/O Mapping Used For
szCacheActionCode CATN 8
mnJobNumber JOBS BF mnJobNumber
szErrorId DTAI
mnAaiTableNumber ANUM
szOrderType DCTO
szDocumentType DCT
szCostType COST
szCompany CO
szGlCategory GLPT
szCostCenter MCU
szObjectAccount OBJ
szSubsidiary SUB
idCacheCursor GENLNG ID
mnTransactionID TCID 0
szComputerID CTID BF szComputerID

Parameter Name Data Item I/O Mapping Used For
szCacheActionCode CATN 8
mnJobNumber JOBS BF mnJobNumber
szErrorMessageId DTAI
cCostObjectSetupMethod CO02
szPriceAdjustmentType AST
szCompany CO
szOrderType DCTO
szObjectAccount OBJ
mnAaiTableNumber ANUM
szItemNumber ITEM
cRecordTypeCCSUBSBLFlexFO @RT
cSubledgerType SBLT
szDataItem SFIT
cDataType SFDT
cManagerialAnalysisType1 ABT1
szFileName FILE
idCacheCursor GENLNG ID
mnElementNumber EL
cNoRowsExist EV01
mnTransactionID TCID 0
szComputerID CTID BF szComputerID

Hard Coded Application

The Below standard function need updating – all application IDs are hard-coded here.

BuildFlexibleAccountwithCache (N4002371, Build Flexible Account with Cache)
1. Go to OMW (Object Management Workbench)
2. Look for the object N4002371
3. Check out N4002371
4. Go to Named Event Rule design
5. Look for the model function or application you used for this routine
6. Add the application or function ID

Example:

If VA evt_cF4096FetchSuccess_EV01 is equal to "1"
....
Else
If BF szApplicationID is equal to "B03B0025,B03B0067"
...
Else
...
If BF szApplicationID is equal to "N55FLEX0,XT4111Z1"
Cache, Process Flex Inventory Accounting [(CacheProcessFlexInventoryAcctng, B4101090)]
...
End If

The Detail Routines for Flexible Accounting

This section is to explain how you can flex a certain table and columns either for MCU or SUB.

Refer to <Document 1353763.1> - E1: 42: How to Debug Flex Accounting issue in Sales Update.

<Internal_Only> please help me to publish this document - this will be remained internal</Internal_Only>