gous99
17th April 2002, 20:50
Hi, here is my problem,

I'm trying to use this dll (ottstpapihand) to create Purchase Orders/Lines.

Everything go smooth except for one thing. There is a few field that do not get updated. They stay blank or 0 or keep the default.

If I create a new Purchase Order manually, I can change those fields and the session lets me, so how come I can't replicate the same with calls to this dll, and only for those fields?

Here are the fields:

tdpur040.cdec Keeps the default value
tdpur040.cpay Stays blank
tdpur040.cfrw Stays blank
tdpur040.ccty Keeps the default value
tdpur040.ccur Keeps the default value
tdpur040.ccor Stays blank
tdpur040.ccon Stays at 0

Here is my call to feed these fields. Also, when inserting, they're is no error message. All the values are valid values.

stpapi.put.field("tdpur4101m000", "tdpur040.ccur", hold.ccur)
stpapi.put.field("tdpur4101m000", "tdpur040.cfrw", hold.cfrw)
stpapi.put.field("tdpur4101m000", "tdpur040.cpay", hold.cpay)
stpapi.put.field("tdpur4101m000", "tdpur040.cdec", hold.cdec)
stpapi.put.field("tdpur4101m000", "tdpur040.ccty", hold.ccty)
stpapi.put.field("tdpur4101m000", "tdpur040.ccon", str$(hold.buyr))
stpapi.put.field("tdpur4101m000", "tdpur040.ccor", hold.ccor)

lbencic
17th April 2002, 21:45
I have not looked at the session, and I don't see all of your field assignments listed here for it, just the ones your report problems with. Posting all the assigments in order may help. One thing you need to do is keep the assignments in the same order you would enter them in the Baan session. Some field entry will retrieve and set the defaults for following fields, and if you call them after your value is set, your value will be over written.

Lisa

gfasbender
17th April 2002, 22:02
I've found that field event processing embedded in sessions, such as after.update, can affect put() calls. For example, if you put() the fields you've described before the supplier field, and the supplier field has an after.update section that initializes those fields, then your updates are overridden.

You may have to add a second update process for specific fields to your api script.

mark_h
17th April 2002, 22:45
Gordon is correct - I have had to put some fields twice to get them updated. Also in one case I had to actually go update the table using a select for update session. Never did figure that one out, but the select for update solved my problem.

Mark

gous99
18th April 2002, 15:08
Thanks,

Yap, Gordon and Mark, you're both right. What I have to do for it to work for those specific fields is, insert the other fields, save the record, then put these fields, and update the record. This way, it does work.

But as Mark said, even with this, the Buyer field does not keep the value, so I have to do a direct update in the table, which is not good. This way it does not get saved in the PO history table, of course I can insert it there as well, but how many tables would I have to update like this!!!!

Anyway, I opened a case at Baan Support, they transfered it to the Netherlands, if they give me a solution, I will come back and share it.

gous99
18th April 2002, 15:11
Gordon and Mark
Thanks,

Yap, Gordon and Mark, you're both right. What I have to do for it to work for those specific fields is, insert the other fields, save the record, then put these fields, and update the record. This way, it does work.

But as Mark said, even with this, the Buyer field does not keep the value, so I have to do a direct update in the table, which is not good. This way it does not get saved in the PO history table, of course I can insert it there as well, but how many tables would I have to update like this!!!!

Anyway, I opened a case at Baan Support, they transfered it to the Netherlands, if they give me a solution, I will come back and share it.

gous99
18th April 2002, 15:12
...

mark_h
18th April 2002, 15:14
As soon I read my message on merging threads I will put this in the other message.

Mark