ErpRob
Well Known Member
I'm trying to read the order entry cache and loop through the cache. I have the program working and it reads the data fine, but I must have a pointer issue. The program reads through the cache fine, however when the program returns control to the P4210 the, it crashes on the end document and rolls back the changes.
I'm assuming I have a pointer issue,
Can I pass a pointer from P4210 to my custom program? Do I need a pointer from P4210? If so can I pass a pointer between applications
Do I need to call a business function first to initialize the pointer, or a program to terminate it.
The custom program is called right before F4211 End Document (i.e. B4200310- F4211FSEndDoc), and passes all the computer ID and job number....
I'm surprised this topic of read through the cache is not posted in full. I have only seen one, but it does not have all the code and details.
Below is the code from my custom program.
// Always use the CACHE For ADD and changes. Then loop F4211 and check cache
// again and if in cache it was either and add or change. ignore anything in
// F4211
//
// CACHE ADD AND CHANGE
VA frm_cachecursor_GENLNG = 0
// File use to determine which lines are in the cache to ignore those records when reading F4211
F5859UI1.Delete
FI szComputerID = TK Computer ID
FI mnJobnumberA = TK Job Number
//
F42UI11 Retrieve Sales Order Detail (WF) Info
"2" -> BF cRetrieveFromCache
FI szComputerID -> BF szComputerID
FI mnJobnumberA -> BF mnJobnumberA
VA frm_F42UI11WFLineNumb_LNIX <- BF mnLineNumberXREF
FI mnDocumentOrderInvoiceE -> BF mnDocumentOrderInvoiceE
FI szOrderType -> BF szOrderType
FI szCompanyKeyOrderNo -> BF szCompanyKeyOrderNo
VA frm_LineNumber_LNID <- BF mnLineNumber
"1" -> BF cSuppressErrorMessage
VA frm_EV21_LastCacheRecord <- BF cErrorCode
"N" -> BF cActionCode
VA frm_cachecursor_GENLNG <> BF idF42UI11Handle
VA frm_ItemDescriptionDSC1 <- BF szDescription
VA frm_OrderDate <- BF jdDateTransactionJulian
VA frm_UOM <- BF szUnitOfMeasureAsInput
VA frm_QtyOrdered <- BF mnUnitsTransactionQty
VA frm_ExtendedPrice <- BF mnAmountExtendedPrice
VA frm_TaxableLineTAX1_YN <- BF cTaxableYN
VA frm_QtyShipped <- BF mnUnitsQuantityShipped
VA frm_QtyBO <- BF mnUnitsQuanBackorHeld
VA frm_QtyCancel <- BF mnUnitsQuantityCanceled
VA frm_ItemLineTypeLNTY <- BF szLineType
VA frm_UnitPriceUPRC <- BF mnAmtPricePerUnit2
VA frm_ShortItem_ITM <- BF mnIdentifierShortItem
VA frm_ItemNumberLITM <- BF szIdentifier2ndItem
VA frm_GeoCodeTXA1 <- BF szTaxRateArea
VA frm_TaxExplCodeEXR1 <- BF szTaxExplanationCode
VA frm_CostCenterDetail <- BF szBranchPlant
VA frm_KitLineZero <- BF mnKitMasterLineNumber
VA frm_StatusCodeNext <- BF szStatusCodeNext
VA frm_OrderSuffix <- BF szOrderSuffix
While VA frm_EV21_LastCacheRecord is not equal to "1"
F5859UI1.Insert
FI szComputerID -> TK Computer ID
FI mnJobnumberA -> TK Job Number
FI szCompanyKeyOrderNo -> TK Order Company (Order Number)
FI mnDocumentOrderInvoiceE -> TK Document (Order No, Invoice, etc.)
FI szOrderType -> TK Order Type
VA frm_LineNumber_LNID -> TK Line Number
If VA frm_QtyShipped is equal to <Zero> And VA frm_QtyBO is equal to <Zero> And VA frm_QtyCancel is not equal to <Zero>
VA frm_ExtendedPrice = 0
Else
If VA frm_QtyBO is not equal to <Zero>
VA frm_ExtendedPrice = ([VA frm_QtyShipped]+[VA frm_QtyBO])*[VA frm_UnitPriceUPRC]
End If
End If
//
VA frm_Quantity = [VA frm_QtyBO]+[VA frm_QtyShipped]
//
.....More code here. but only calculations
F42UI11 Retrieve Sales Order Detail (WF) Info
"2" -> BF cRetrieveFromCache
FI szComputerID -> BF szComputerID
FI mnJobnumberA -> BF mnJobnumberA
VA frm_F42UI11WFLineNumb_LNIX <- BF mnLineNumberXREF
FI mnDocumentOrderInvoiceE -> BF mnDocumentOrderInvoiceE
FI szOrderType -> BF szOrderType
FI szCompanyKeyOrderNo -> BF szCompanyKeyOrderNo
VA frm_LineNumber_LNID <- BF mnLineNumber
"1" -> BF cSuppressErrorMessage
VA frm_EV21_LastCacheRecord <- BF cErrorCode
"N" -> BF cActionCode
VA frm_cachecursor_GENLNG <> BF idF42UI11Handle
VA frm_ItemDescriptionDSC1 <- BF szDescription
VA frm_OrderDate <- BF jdDateTransactionJulian
VA frm_UOM <- BF szUnitOfMeasureAsInput
VA frm_QtyOrdered <- BF mnUnitsTransactionQty
VA frm_ExtendedPrice <- BF mnAmountExtendedPrice
VA frm_TaxableLineTAX1_YN <- BF cTaxableYN
VA frm_QtyShipped <- BF mnUnitsQuantityShipped
VA frm_QtyBO <- BF mnUnitsQuanBackorHeld
VA frm_QtyCancel <- BF mnUnitsQuantityCanceled
VA frm_ItemLineTypeLNTY <- BF szLineType
VA frm_UnitPriceUPRC <- BF mnAmtPricePerUnit2
VA frm_ShortItem_ITM <- BF mnIdentifierShortItem
VA frm_ItemNumberLITM <- BF szIdentifier2ndItem
VA frm_GeoCodeTXA1 <- BF szTaxRateArea
VA frm_TaxExplCodeEXR1 <- BF szTaxExplanationCode
VA frm_CostCenterDetail <- BF szBranchPlant
VA frm_KitLineZero <- BF mnKitMasterLineNumber
VA frm_StatusCodeNext <- BF szStatusCodeNext
VA frm_OrderSuffix <- BF szOrderSuffix
End While
//
//
//
// Free handle to Credit Memo Cache
If VA frm_cachecursor_GENLNG is not equal to <Zero>
Memory, Free Ptr To Data Structure
VA frm_cachecursor_GENLNG <> BF idGenericLong
End If
//
//
Any help would be appreciated, I have been trying to get this working all week.
I'm assuming I have a pointer issue,
Can I pass a pointer from P4210 to my custom program? Do I need a pointer from P4210? If so can I pass a pointer between applications
Do I need to call a business function first to initialize the pointer, or a program to terminate it.
The custom program is called right before F4211 End Document (i.e. B4200310- F4211FSEndDoc), and passes all the computer ID and job number....
I'm surprised this topic of read through the cache is not posted in full. I have only seen one, but it does not have all the code and details.
Below is the code from my custom program.
// Always use the CACHE For ADD and changes. Then loop F4211 and check cache
// again and if in cache it was either and add or change. ignore anything in
// F4211
//
// CACHE ADD AND CHANGE
VA frm_cachecursor_GENLNG = 0
// File use to determine which lines are in the cache to ignore those records when reading F4211
F5859UI1.Delete
FI szComputerID = TK Computer ID
FI mnJobnumberA = TK Job Number
//
F42UI11 Retrieve Sales Order Detail (WF) Info
"2" -> BF cRetrieveFromCache
FI szComputerID -> BF szComputerID
FI mnJobnumberA -> BF mnJobnumberA
VA frm_F42UI11WFLineNumb_LNIX <- BF mnLineNumberXREF
FI mnDocumentOrderInvoiceE -> BF mnDocumentOrderInvoiceE
FI szOrderType -> BF szOrderType
FI szCompanyKeyOrderNo -> BF szCompanyKeyOrderNo
VA frm_LineNumber_LNID <- BF mnLineNumber
"1" -> BF cSuppressErrorMessage
VA frm_EV21_LastCacheRecord <- BF cErrorCode
"N" -> BF cActionCode
VA frm_cachecursor_GENLNG <> BF idF42UI11Handle
VA frm_ItemDescriptionDSC1 <- BF szDescription
VA frm_OrderDate <- BF jdDateTransactionJulian
VA frm_UOM <- BF szUnitOfMeasureAsInput
VA frm_QtyOrdered <- BF mnUnitsTransactionQty
VA frm_ExtendedPrice <- BF mnAmountExtendedPrice
VA frm_TaxableLineTAX1_YN <- BF cTaxableYN
VA frm_QtyShipped <- BF mnUnitsQuantityShipped
VA frm_QtyBO <- BF mnUnitsQuanBackorHeld
VA frm_QtyCancel <- BF mnUnitsQuantityCanceled
VA frm_ItemLineTypeLNTY <- BF szLineType
VA frm_UnitPriceUPRC <- BF mnAmtPricePerUnit2
VA frm_ShortItem_ITM <- BF mnIdentifierShortItem
VA frm_ItemNumberLITM <- BF szIdentifier2ndItem
VA frm_GeoCodeTXA1 <- BF szTaxRateArea
VA frm_TaxExplCodeEXR1 <- BF szTaxExplanationCode
VA frm_CostCenterDetail <- BF szBranchPlant
VA frm_KitLineZero <- BF mnKitMasterLineNumber
VA frm_StatusCodeNext <- BF szStatusCodeNext
VA frm_OrderSuffix <- BF szOrderSuffix
While VA frm_EV21_LastCacheRecord is not equal to "1"
F5859UI1.Insert
FI szComputerID -> TK Computer ID
FI mnJobnumberA -> TK Job Number
FI szCompanyKeyOrderNo -> TK Order Company (Order Number)
FI mnDocumentOrderInvoiceE -> TK Document (Order No, Invoice, etc.)
FI szOrderType -> TK Order Type
VA frm_LineNumber_LNID -> TK Line Number
If VA frm_QtyShipped is equal to <Zero> And VA frm_QtyBO is equal to <Zero> And VA frm_QtyCancel is not equal to <Zero>
VA frm_ExtendedPrice = 0
Else
If VA frm_QtyBO is not equal to <Zero>
VA frm_ExtendedPrice = ([VA frm_QtyShipped]+[VA frm_QtyBO])*[VA frm_UnitPriceUPRC]
End If
End If
//
VA frm_Quantity = [VA frm_QtyBO]+[VA frm_QtyShipped]
//
.....More code here. but only calculations
F42UI11 Retrieve Sales Order Detail (WF) Info
"2" -> BF cRetrieveFromCache
FI szComputerID -> BF szComputerID
FI mnJobnumberA -> BF mnJobnumberA
VA frm_F42UI11WFLineNumb_LNIX <- BF mnLineNumberXREF
FI mnDocumentOrderInvoiceE -> BF mnDocumentOrderInvoiceE
FI szOrderType -> BF szOrderType
FI szCompanyKeyOrderNo -> BF szCompanyKeyOrderNo
VA frm_LineNumber_LNID <- BF mnLineNumber
"1" -> BF cSuppressErrorMessage
VA frm_EV21_LastCacheRecord <- BF cErrorCode
"N" -> BF cActionCode
VA frm_cachecursor_GENLNG <> BF idF42UI11Handle
VA frm_ItemDescriptionDSC1 <- BF szDescription
VA frm_OrderDate <- BF jdDateTransactionJulian
VA frm_UOM <- BF szUnitOfMeasureAsInput
VA frm_QtyOrdered <- BF mnUnitsTransactionQty
VA frm_ExtendedPrice <- BF mnAmountExtendedPrice
VA frm_TaxableLineTAX1_YN <- BF cTaxableYN
VA frm_QtyShipped <- BF mnUnitsQuantityShipped
VA frm_QtyBO <- BF mnUnitsQuanBackorHeld
VA frm_QtyCancel <- BF mnUnitsQuantityCanceled
VA frm_ItemLineTypeLNTY <- BF szLineType
VA frm_UnitPriceUPRC <- BF mnAmtPricePerUnit2
VA frm_ShortItem_ITM <- BF mnIdentifierShortItem
VA frm_ItemNumberLITM <- BF szIdentifier2ndItem
VA frm_GeoCodeTXA1 <- BF szTaxRateArea
VA frm_TaxExplCodeEXR1 <- BF szTaxExplanationCode
VA frm_CostCenterDetail <- BF szBranchPlant
VA frm_KitLineZero <- BF mnKitMasterLineNumber
VA frm_StatusCodeNext <- BF szStatusCodeNext
VA frm_OrderSuffix <- BF szOrderSuffix
End While
//
//
//
// Free handle to Credit Memo Cache
If VA frm_cachecursor_GENLNG is not equal to <Zero>
Memory, Free Ptr To Data Structure
VA frm_cachecursor_GENLNG <> BF idGenericLong
End If
//
//
Any help would be appreciated, I have been trying to get this working all week.