Baanboard.com

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

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
37%
Installation Wizard into new VRC
39%
Manual into existing VRC
3%
Manual into new VRC
21%
Total votes: 38

Baanboard at LinkedIn


Reference Content

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10th February 2016, 21: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.clear(main.sess)
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 = stpapi.save(sync.sess, saveerror)

endif



endif

endif
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 13:21
AFS for Insert record in tirou101 sghatge AFS/DDC/OLE: Function servers 9 21st August 2013 05:41
AFS to insert record in tfgld4582m000 session layswan AFS/DDC/OLE: Function servers 5 5th October 2012 17:42
AFS to insert record in tfgld4582m000 session layswan Tools Development 1 3rd October 2012 15:43
how to insert record in type3 form via AFS??? alibaba AFS/DDC/OLE: Function servers 5 17th September 2004 05:19


All times are GMT +2. The time now is 01:45.


©2001-2017 - Baanboard.com - Baanforums.com