dbclark79
26th August 2002, 22:22
We are running BaanERP 5.0c and we're creating an AFS script to create new PO Lines for existing POs. The result of our stpapi.change.view() call (see below) is error message "Buy-from BP not allowed".

ATTEMPT #1:
==========
stpapi.put.field("tdpur4501m000", "tdpur401.orno", afs.orno)
stpapi.change.view("tdpur4501m000", afs.error)


ATTEMPT #2:
===========
stpapi.put.field("tdpur4501m000", "tdpur401.orno", afs.orno)
stpapi.put.field("tdpur4501m000", "tdpur401.otbp", afs.otbp)
stpapi.change.view("tdpur4501m000", afs.error)


ATTEMPT #3:
===========
stpapi.put.field("tdpur4501m000", "tdpur401.orno", afs.orno)
stpapi.put.field("tdpur4501m000", "tdpur401.pono", afs.pono)
stpapi.put.field("tdpur4501m000", "tdpur401.sqnb", afs.sqnb)
stpapi.put.field("tdpur4501m000", "tdpur401.otbp", afs.otbp)
stpapi.change.view("tdpur4501m000", afs.error)


All three of these attempts results in the same "afs.error" message: "Buy-from BP not allowed".


Any recommendations ?????

:confused: :confused: :confused: :confused: :confused:

mark_h
27th August 2002, 14:53
Since I am not familiar with Baan5(tdpur4501m000 is display purchase order) I was wondering if you have to do a stpapi.change.view, could you just do a find? I also seem to recall that on Baan5 on multioccurence sessions you might have to use the stpapi.synchronize.dialog()?

Just wondering out loud.

Mark

Youp2001
27th August 2002, 15:12
Mark is right. You should use the synchronize function.

First set view for purchase order lines in overview session.
Then synchronize.
Set fields for detail session.
Write/save record using overview session.

See the AFS document for more details on how to make this work.

Youp

dbclark79
27th August 2002, 16:12
Mark and Youp - Thank you for the replies.

tdpur4501m000 in BaanERP 5.0c is Purchase Order Lines (maintain, display and print).

Our AFS scripts does in fact have:
1. stpapi.change.view() on multi-occurence
2. stpapi.synchronize.dialog() on multi-occurence
3. stpapi.put.field() on detail session
4. stpapi.insert() on detail session

The problem is that step #1 does not work. The change.view repeatedly fails because of "Buy-from BP not allowed" error message.

The examples that I submitted before are different coding options that I've attempted for step #1 only.

Additional ideas??

-David

dbclark79
27th August 2002, 16:50
Attached is a 3GL example script of the problem.

mark_h
27th August 2002, 17:29
Gordon - that was probably was my fault. I meant to say it was on Display session on my system.

David,

Fresh out of ideas, from looking at your script I see how the sync dialog works. I thought maybe you had to do that up front before the change view. Would you by chance happen to have the source code? I was curious as to what causes that error when running the session manually.

I looked briefly on the support site, but nothing jumped out at me. I can not think of anything else to try, it may just be the session and a new object would fix it - but that may not work either. If you do get an answer please post it.

Mark

dbclark79
27th August 2002, 18:24
Attached is another attempt using Sales Orders (tdpur4500m000) + form.command + to.lines + Sales Order Lines (tdpur4501m000).

This solution results in a lock-up hung script.

mark_h
28th August 2002, 16:54
Are you on the latest tools version? Either that or you may need a new version of tdpur4500m000 and tdpur4501m000 sessions. I would recommend contacting Baan support. If you do find a solution please post it here.

Thanks

Mark