ArGri69
1st August 2008, 15:59
I try to locate a record with AFS in session cprpd2101m000 with stpapi.find()
But some how the record isn't found. The return is 2 (other record found).When I check this field it's always the first record. :confused:

this is the code I use:
o.item is a existing item!

stpapi.put.field("cprmp2101m000","cprmp300.plnc", "001")
stpapi.put.field("cprmp2101m000","cprmp300.plni", o.item)

ret = stpapi.find("cprmp2101m000",error.msg)
if ret=1 then
|record found perform action
stpapi.form.command("cprmp2101m000", 5, "update.plan", error.msg)
else
if ret=2 then
| Check which field is found
stpapi.get.field("cprmp2101m000","cprmp300.plni", i.item)
endif
endif


Anyone has an idea?

mark_h
1st August 2008, 16:46
While not familiar with this session I can tell you some of the things I have had to do to locate the correct record.
(1) I have had to do a find twice to get the correct record. So see if a second find works.
(2) In one multi-occ session I had to do a stpapi.change.view followed by a find.
(3) And in one case I had to do a stpapi.change.view, followed by the browse.set to look through each record.

No promise these will work. Plus with your profile showing LN then I do not know if segmented items comes into play. I do recall for segmented items if you did not put them correctly it would not find that item.

ArGri69
4th August 2008, 09:22
Mark,

Thanks for the reply, but it didn't solved the problem.
But I found the solution, after browsing the baanboard again. :D

The solution is that I have to to fill the segments for the planned item.
(in this case segment 3, because planned items consists of 3 segments, the 3rd is the item-segment)

So in my case it should be:
stpapi.put.field("cprmp2101m000","cprmp300.plni.segment.3", trim$(o.item))