Go Back > Forum > Baan SIGs > AFS/DDC/OLE: Function servers

User login

Frontpage Sponsor


Google search

How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
200 - 500 GB
500 - 800 GB
800 - 1200 GB
1200 - 1500 GB
1500 - 2000 GB
> 2000 GB
Total votes: 4

Baanboard at LinkedIn

Reference Content

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 10th February 2016, 20:58
eric.dizon's Avatar
eric.dizon eric.dizon is offline
Senior Member
Join Date: Feb 2012
Posts: 151
eric.dizon is on a distinguished road
Baan: ERP LN - DB: MS SQL - OS: 2003
Thumbs up AFS - insert record in whinh5120m100

Hello, I am trying to get back using AFS again. I have the following code below to insert a new record in the Adjustment Order MMT session. It works on inserting the header records but I am having issues in inserting the detail records. I cannot seem to get past the issues I have. The code as it stands works on inserting the header record but having a error "Reason: Lot Bxxxx not found for item. " - What table do I verify if the lot is there? I try entering the same values using the actual session and it saves them no error.

string main.sess(13)
string sync.sess(13)
main.sess = "whinh5120m100"
sync.sess = "whinh5121m000"

stpapi.put.field(main.sess, "whinh520.orno", "ADJ")
stpapi.put.field(main.sess, "whinh520.cwar", "300832")
stpapi.put.field(main.sess, "whinh520.adrn", "INV17")
stpapi.put.field(main.sess, "whinh520.emno", "")
stpapi.put.field(main.sess, "whinh520.adst", "10")
stpapi.put.field(main.sess, "whinh520.mnad", "1")

h.ret = stpapi.insert(main.sess,true,errmsg)
if h.ret then |Insert succeeds
stpapi.get.field(main.sess, "whinh520.orno", l.orno)

|Find the record created
First question : Should I be using the main.sess or the sync.sess ? I tried both but having different issues
stpapi.put.field(sync.sess, "whinh521.orno", l.orno )
ret = stpapi.find(sync.sess , errfindmsg)
if isspace(errfindmsg)
2nd Q: Which session do I sync main or sync session ?
3rd Q: I am inserting a detail record do I use "add/modify" ?

ret = stpapi.synchronize.dialog(sync.sess, "modify", errmsg)
if ret then |
stpapi.put.field(sync.sess, "whinh521.orno", l.orno)
stpapi.put.field(sync.sess, "whinh521.pono", "1")
stpapi.put.field(sync.sess, "whinh521.cwar", "300832")
|stpapi.put.field(sync.sess, "whinh521.item", " CSBP043-030AAAA")
stpapi.put.field(sync.sess, "whin521.item.segment.1", "" ) |value(1; 9)
stpapi.put.field(sync.sess, "whin521.item.segment.2", "CSBP043-030AAAA") | CSBP043-030AAAA
stpapi.put.field(sync.sess, "whinh521.clot", "B00000575-15-10-0016") | l.clot) |B00000575-15-10-0016
stpapi.put.field(sync.sess, "whinh521.stun", "m") | Handling Unit
stpapi.put.field(sync.sess, "whinh521.qadr", str$(l.rmmt)) | Inventory Adjusted
l.vari = v.qhnd - l.rmmt
stpapi.put.field(sync.sess, "whinh521.qrvr", str$(l.vari)) | Variance
stpapi.put.field(sync.sess, "whinh521.adrn", "INV17")

4th Q: Do I use stpapi.insert or stpapi.update ?
rval = stpapi.insert(sync.sess,true,errmsg) | "Get an error here: Lot number not found "
if rval then |If insert fails
ret =, saveerror)



Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Very nasty work around for an ugly problem AFS finds and updates WRONG RECORD OmeLuuk AFS/DDC/OLE: Function servers 5 17th August 2015 12:21
AFS for Insert record in tirou101 sghatge AFS/DDC/OLE: Function servers 9 21st August 2013 04:41
AFS to insert record in tfgld4582m000 session layswan AFS/DDC/OLE: Function servers 5 5th October 2012 16:42
AFS to insert record in tfgld4582m000 session layswan Tools Development 1 3rd October 2012 14:43
how to insert record in type3 form via AFS??? alibaba AFS/DDC/OLE: Function servers 5 17th September 2004 04:19

All times are GMT +2. The time now is 16:43.

©2001-2018 - -