a.menon
13th April 2014, 14:03
Hello Gurus,

I have an AFS session which calls the RECIEPTS session , creates a new receipt, links to order, confirms and puts away.
The following piece of code is used for finding the receipt line to be linked.


whinhf3520m000.handle.sub.process("whinh3820m000", "add")

stpapi.put.field("whinh3820m000", "whinh210.rcno", receipt.number)

whinhf3820m000.put.Order_Origin(whgei210.oorg)
whinhf3820m000.put.Order(whgei210.orno)
whinhf3820m000.put.Position_Number(whgei210.pono)
whinhf3820m000.put.Sequence_Number(ord.seq)
ret = whinhf3820m000.find(error.mess)

if ret <> 1 then
check.flag = 2
if not isspace(error.mess) then
message(error.mess)
endif
else
ret = whinhf3820m000.mark(error.mess)
if ret <> 1 then
check.flag = 2
if not isspace(error.mess) then
message(error.mess)
endif
else
stpapi.enum.answer("whinh3820m000", "whinh3009", tcyesno.yes)
whinhf3820m000.Link_Marked_lines_to_Receipt(error.mess)
........................

The FIND call to the afs function always returns 2 (Another record found). I searched a lot on Baan borard and in may threads , the use of change.view before the "find" was suggested. I tried the same and it worked like a charm.

I am curious as to WHY this is needed here , even though there is no view field for the session in question?
Please shed some light on this.

Thanks in advance.!

bhushanchanda
13th April 2014, 20:05
Hi,

There are a few session's where you will have view fields and based on that you will get the records. So, once you insert value in the view fields the change.view() is executed. And then you have to find the record in the underlying lines. That's the simple theory behind changing view before find.