Fetch Next

ngbl

Member
Does anyone knows how to check on Fetch Next table IO function? I was working on B7332 program R42565 invoice. This program was working fine until I want to summarized by item which is activated thru the PO tab 'item summary' = '1'. I noticed that my invoice line are summarized by two's. That means my Sales Order line 1 and 2 are summarized and print and then line 3 and 4 summarized and print and so on.
Thru debuging, I noticed that the Fetch next line on table F42565 for record 3, File_IO_status show "Error" eventhough I have already record summarized (for record 1 and 2) written to F42565. The pgm logic is when there is Error it will create new record in F42565.
Is there any way to check whether Fetch Next function is functioning properly?
Thank you for assistance.

Program R42565
Section Phase 1 - Build work file
Event Do Section
logic statement where debuging is done.
// SAR# 3574085 End
If RV Invoice Consolidation (A5) WF is equal to "Y"
If VA evt_EV02_InvoiceBeenUsed is equal to "1"
RV Previous Invoice Num WF = BC Document (Voucher, Invoice, etc.) (F4211)
RV Previous Doc Type WF = BC Document Type (F4211)
RV Previous Doc Key Coy WF = BC Document Company (F4211)
// SAR# 2952620
//
// If running in proof mode, then assign the invoice number so it can be
// consolidated.
If PO cPreventARAssignment is equal to "1"
RV Work File Invoice Number = BC Document (Voucher, Invoice, etc.) (F4211)
End If
Else
F42565.Select
VA rpt_LineWholeNumber = floor([BC Line Number (F4211)])
F42565.Fetch Next
If SV File_IO_Status is equal to CO SUCCESS
RV Previous Invoice Num WF = RV DOC - CONS Document Number(wf)
RV Previous Doc Type WF = RV DCT- CONS Document Type(wf)
RV Previous Doc Key Coy WF = RV KCO - CONS Document Company(wf)
// SAR# 2952620
//
// If running in proof mode, assign the invoice number of F42565 to work file
// invoice number so it can be used. Setting the invoice has been used flag
// allows it to not assign the invoice number.
//
If PO cPreventARAssignment is equal to "1"
RV Work File Invoice Number = RV DOC - CONS Document Number(wf)
VA evt_EV02_InvoiceBeenUsed = "1"
End If
Else
RV New Invoice Flag WF = "1"
RV Change in Pay Terms Flag WF = "0"
End If
End If
End If
End If




Bee Lay
 

Larry_Jones

Legendary Poster
Bee Lay,

I doubt there is anything wrong with the Fetch Next statement. Rather you should concentrate on the Select statement preceding it and your data. This Select has a number of conditions on it, for example, are all the lines using the same Currency and exchange rates?
This is a really complicated program and its very difficult to figure out what the code is doing given all of its branches.

Are you sure you understand what the processing option is supposed to do (I don't - I'm asking you). The help text on it is:

"Use this processing option to specify whether the system prints summaries of multiple line items for the same item if the item number, cost, and price of each line item are identical. For example, if you ship the same item to multiple locations, you might want to summarize line items for the invoice that is sent to the bill to location. Valid values are:
1 Print summaries of items only.
2 Print summaries of items split by commitments.
If you set this option to 1, the summarization is based on the following fields: 2nd Item Number, Unit Price, Unit of Measure, Line Type, Pricing Unit of Measure, Document Number, Document Type, and Document Company.
If you set this option to 2, the summarization is based on the following fields: Order Number, Order Type, Order Company, Line Number, Unit Price, Unit of Measure, Line Type, and Pricing Unit of Measure.
When working with kits, set this option to 1."


Larry Jones
[email protected]
OneWorld XE, SP 15.1
HPUX 11, Oracle SE 8.1.6
Mfg, Distribution, Financials
 

ngbl

Member
Thanks Larry.
As per your suggestion, I checked on the Select statement and I still can't find any problem with it. Anyway, I did another test in Production environment and the records are summarized correctly.
This is actually a lesson to me to test both environments if one does not work the way it is suppose to be.



Bee Lay
 
Top