E9.1 XT4311Z1 and number of times the sub functions need to be called.

FrankCLT

Well Known Member
Hello All,

If I have a worktable that has multiple POs with varying lines that will need to update the F4301\F4311 files, do I need to do the (XT4311Z1), BeginDoc, EditLIne, EditDoc EditLine and EndDoc for each record being read from my worktable?


Thanks as always,
FrankCLT
 
No. You should be able to call
Code:
BeginDoc
EditLine
EditLine
EnitLine
..
EditDoc
EndDoc

Although you may need to call EditDoc after every EditLine - I can't remember for purchase orders offhand. If only updating the line you may be able to just call EditLine/EndDoc, but for POs, again can't remember. I know you can for Sales Orders, but I always call BegDoc anyway as sort of a best practice.

HOWEVER, please note, you should repeat the sequence above for each PO. In other words BegDoc/EndDoc should only contain a single PO with EditLine called for each line on the PO.
 
I'm the same as Brian above but maybe add F4311ClearWorkFiles at the end of everything or if you encountered errors

For each PO #
You would call F4311BeginDoc for each PO # once, then call F4311EditLine for each PO line 1.000 2.000 2.001 etc multiple times. Then the F4311EndDoc.
I would then repeat for a new PO #

You can share the same Job # or get a new one for each PO #

So a PO has just one line your calls would look like this
Begin
EditLine
EndDoc

If a PO has 3 lines your calls would look like this
Begin
EditLine
EditLine
EditLine
EndDoc

I would create a UBE to read the PO worktable, sort by DOCO and in the level break header call Begin Doc and call EndDoc in a level break footer, then in the Do Section call the EditLine
 
This works for me

| // Setup F4301/F4311 key fields
| VA rpt_F4301DOCO [DOCO] = <NULL>
| VA rpt_F4301DCTO [DCTO] = <NULL>
| VA rpt_F4301KCOO [KCOO] = <NULL>
| F0006.FetchSingle [Index 1: Cost Center]
| PC Business Unit (F4108.0) [MCU] = TK Business Unit [MCU]
| VA rpt_F4301KCOO [KCOO] <- TK Company [CO]
| VA rpt_F4301MCU [MCU] = PC Business Unit (F4108.0) [MCU]
| //
| If PO cProofOrFinal1_EV01 [EV01] is equal to "1"
| | //
| | // John Danter Consigned Stock Phase II 02/03/2014
| | // PO or GL flag 55CS08
| | If VA rpt_55CS08ConsumptionAction [55CS08] is equal to "1"
| | | //
| | | // Get P4310 Processing Options
| | | GetP4310ProcOpts(B4301710.GetP4310ProcOpts)
| | | VA rpt_F4301DCTO [DCTO] <- szOrderType_DCT [DCT]
| | | VA evt_LineTypeLNTY [LNTY] <- szLineType_LNTY [LNTY]
| | | PO szVersionP4310_VERS [VERS] -> szVersion_VERS [VERS]
| | | //
| | | // Get PO Number
| | | GetNextOrderNumber(B4302960.GetNextOrderNumber)
| | | VA rpt_F4301DOCO [DOCO] <- mnOrderNumber [DOCO]
| | | VA rpt_F4301KCOO [KCOO] -> szOrderCompany [KCOO]
| | | VA rpt_F4301DCTO [DCTO] -> szOrderType [DCTO]
| | | VA rpt_F4301MCU [MCU] -> szBranchPlant [MCU]
| | | //
| | | //
| | | // Assign a a value of '2' to replace the workfiles with memory arrays
| | | // otherwise assign a value of '1'
| | | //
| | | // This BSFN creates a F4301 header cache automatically
| | | F4311FSBeginDoc(XT4311Z1.F4311FSBeginDoc)
| | | VA rpt_F4301JobnumberJOBS [JOBS] <> mnJobNumber [JOBS]
| | | VA rpt_F4301ComputerCTID [CTID] <> szComputerID [CTID]
| | | "A" -> cHeaderActionCode [ACTN]
| | | "1" -> cProcessEdits [EV01]
| | | "2" -> cUpdateOrWriteToWorkFile [EV01]
| | | VA rpt_cWrittenToWorkFile_EV01 [EV01] <> cRecordWrittenToWorkFile [EV01]
| | | VA rpt_CurrencyModeCRRM [CRRM] -> cCurrencyProcessingFlag [CRYR]
| | | VA rpt_F4301KCOO [KCOO] <> szOrderCOmpany [KCOO]
| | | VA rpt_F4301DOCO [DOCO] <> mnOrderNumber [DOCO]
| | | VA rpt_F4301DCTO [DCTO] <> szOrderType [DCTO]
| | | "000" -> szOrderSuffix [SFXO]
| | | VA rpt_F4301MCU [MCU] <> szBranchPlant [MCU]
| | | PC Primary / Last Supplier Number (F4108.0) [VEND] -> mnSupplierNumber [AN8]
| | | VA rpt_OrderDate_TRDJ [TRDJ] <> jdOrderDate [TRDJ]
| | | VA rpt_CurrencyModeCRRM [CRRM] -> cCurrencyMode [CRRM]
| | | VA evt_CurrencyCodeFromCRCD [CRCD] -> szTransactionCurrencyCode [CRCD]
| | | SL UserID -> szOrderTakenBy [TKBY]
| | | "EP4310" -> szProgramID [PID]
| | | PO szVersionP4310_VERS [VERS] -> szPurchaseOrderPrOptVersion [VERS]
| | | VA evt_CurrencyCodeFromCRCD [CRCD] -> szBaseCurrencyCode [CRDC]
| | | SL UserID -> szUserID [USER]
| | | VA rpt_ProcessIDPEID [PEID] <> mnProcessID [PEID]
| | | VA rpt_TransactionTCID [TCID] <> mnTransactionID [TCID]
| | | //
| | | // NB Record written to workfile flag. This is a ONE line PO so we can get
| | | // away with settign this to 0. But for multiple line POs, this must change
| | | // from 0 > 1 after the first line
| | | //
| | | // This BSFN creates the F4311 detail cache record
| | | VA rpt_cWrittenToWorkFile_EV01 [EV01] = "0"
| | | VA evt_POAmountExtendedPriceAEXP = [RV Total of Value VEND BK MATH01 GBL]*-1
| | | F4311EditLine(XT4311Z1.F4311EditLine)
| | | VA rpt_F4301JobnumberJOBS [JOBS] -> mnJobNumber [JOBS]
| | | VA rpt_F4301ComputerCTID [CTID] -> szComputerID [CTID]
| | | "1.000" -> mnOrderLineNumber [LNID]
| | | "A" -> cDetailActionCode [ACTN]
| | | "1" -> cProcessEdits [EV01]
| | | "2" -> cUpdateOrWriteWorkFile [EV01]
| | | VA rpt_cWrittenToWorkFile_EV01 [EV01] <> cRecordWrittenToWorkFile [EV01]
| | | SL CurrencyProcessing -> cCurrencyProcessingFlag [CRYR]
| | | PO szVersionP4310_VERS [VERS] -> szPurchaseOrderPrOptVersion [VL01]
| | | VA rpt_F4301KCOO [KCOO] <> szOrderCompany [KCOO]
| | | VA rpt_F4301DOCO [DOCO] <> mnOrderNumber [DOCO]
| | | VA rpt_F4301DCTO [DCTO] <> szOrderType [DCTO]
| | | "000" -> szOrderSuffix [SFXO]
| | | VA rpt_F4301MCU [MCU] -> szBranchPlant [MCU]
| | | PC Primary / Last Supplier Number (F4108.0) [VEND] -> mnSupplierNumber [AN8]
| | | PO jdDateForGL_DGJ [DGJ] -> jdTransactionDate [TRDJ]
| | | "1" -> cPriceOverrideFlag [PROV]
| | | VA evt_POAmountExtendedPriceAEXP [AEXP] -> mnExtendedPrice [AEXP]
| | | VA rpt_AcctNoInputMode_ANI [ANI] -> szUnformattedAccountNumber [ANI]
| | | "EP4310" -> szProgramID [PID]
| | | SL UserID -> szUserID [USER]
| | | VA rpt_ProcessIDPEID [PEID] -> mnProcessID [PEID]
| | | VA rpt_TransactionTCID [TCID] -> mnTransactionID [TCID]
| | | //
| | | If SV Error_Status is equal to CO ERROR
| | | | VA rpt_cVENDError_EV01 [EV01] = "Y"
| | | | RV Error Text UDF [UDF] = "Purchase Order not created for this Supplier"
| | | End If
| | | //
| | | F4311EndDoc(XT4311Z1.F4311EndDoc)
| | | VA rpt_F4301ComputerCTID [CTID] -> szComputerID [CTID]
| | | VA rpt_F4301JobnumberJOBS [JOBS] -> mnJobNumber [JOBS]
| | | "EP4310" -> szCallingApplicationName [PGM]
| | | PO szVersionP4310_VERS [VERS] -> szVersion [VERS]
| | | SL UserID -> szUserID [USER]
| | | "2" -> cUseWorkFiles [EV01]
| | | "0" -> cConsolidateLines [EV02]
| | | VA rpt_ProcessIDPEID [PEID] -> mnProcessID [PEID]
| | | VA rpt_TransactionTCID [TCID] -> mnTransactionID [TCID]
| | | //
| | | //
| | | // Cleanup the cache containing header field changes
| | | CacheProcessHeaderToDetailChange(B4002390.CacheProcessHeaderToDetailChange)
| | | VA rpt_F4301DOCO [DOCO] -> mnOrderNumber [DOCO]
| | | VA rpt_F4301DCTO [DCTO] -> szOrderType [DCTO]
| | | VA rpt_F4301KCOO [KCOO] -> szOrderKeyCompany [KCOO]
| | | "4" -> cCacheActionCode [EV01]
| | | F4311ClearWorkFiles(XT4311Z1.F4311ClearWorkFiles)
| | | VA rpt_F4301ComputerCTID [CTID] -> szComputerID [CTID]
| | | VA rpt_szJobNumber_JOBS [JOBS] -> mnJobNumber [JOBS]
| | | "1" -> cClearHeaderFile [EV01]
| | | "1" -> cClearDetailFile [EV02]
| | | "2" -> cUseWorkFiles [EV01]
| | | VA rpt_ProcessIDPEID [PEID] -> mnProcessID [PEID]
| | | VA rpt_TransactionTCID [TCID] -> mnTransactionID [TCID]
| | | //
 
I'm the same as Brian above but maybe add F4311ClearWorkFiles at the end of everything or if you encountered errors
Good point. Every MBF has its nuisances. Some require a call to ClearWF even after EndDoc, some require EditDoc, some don't, etc. I would usually run a transaction through the existing APPL and parse the debug logs to reverse engineer what gets called and what needs to be passed, etc.
 
Back
Top