muheeb
4th December 2002, 17:46
Hi all,

I wrote the following simple section of code in order
to insert a new record to "Maintain Sales Order" via AFS:
------------------------------------------------------------------------------
f4101m000.put.Sales_Order(orno.f)
f4101m000.put.Customer(cuno)
f4101m000.put.tdsls040.cotp(cotp)
f4101m000.insert(true, err.msg)
if strip$(err.msg)<>"" then
stpapi.recover("tdsls4101m000", err.msg)
endif
f4101m000.end()
-------------------------------------------------------------------------------
I run this and first, I got always a message error after running
"insert": err.msg = "Input cancelled on field Sales".
Secondly it always hands, after "end" it never end thinking!
So can you please me what's wrong in this code and what I'm missing. I have BaanIVc.

lbencic
5th December 2002, 04:37
Try running the afs.log trace and see if the values are valid on your system.
You can do that by putting the line
-- -set AFSLOG=1
in your bw config/ Command box.
This creates a file called 'afs.log' in the TMP or user home directory. Let us know what it shows.

Try increasing the length of your err.msg variable to capture the full message, maybe it's getting cut off.

Try searching for that message in standard Baan messages to see what the full message is for. I suspect the Sales Order Type field may not be valid.

Also, try splitting up the insert and the save by putting a false in the insert command and calling the save separate. You may get a better error on the insert if you don't do the save right away.

muheeb
5th December 2002, 13:06
Thanks very much for answering...

I did what you said, it was just a wrong Sales Order I guess!

The code succeeded to insert a record just fine, but the

the program still get stuck after it finishes (after the "end"

command), it keep thinking endlessly!

Why this happens??


Thanks.

lbencic
5th December 2002, 18:11
hmm....I have written afs's to that session with similar structure and had no problem with the end. Once it inserts, it should end properly no problem.

I will ask the standard questions - do you have a recent version of the api handle library, and do you have other api's working on the end? Also, a recent version of the Sales Order?

I don't use the library version of the api coding, I write the commands directly. Did you separate the insert and the save? (You can do that with the library, right?)
If you get no errors back on either, also try the Get Mess option after the insert and saves, before your end, and see if there is any clue there. Try performing a stpapi.recover before the end as well.

Also, check the api log - does it say anything at the end? Does it receive the end command? Check your processes when complete - are there any open ones you were not expecting?

mgakhar
5th December 2002, 22:58
Hi Muheeb,
We too recently had developed a AFS for Sales Order Header and Lines. Well the header never gave any problems.
Neways u need to check whether u have the latest patch for the object ottstpapihand.

MG.

muheeb
6th December 2002, 09:37
Hi guys,


Finally it works... what still to do is "Order Sales Lines":)

Thanks..