Baanboard.com

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

User login

Frontpage Sponsor

Main

Poll
What version of Baan have you installed
Baan IV
36%
FP3
5%
FP4
0%
FP5
0%
FP6
0%
FP7
0%
10.2 (incl. 10.2.1)
0%
10.3
9%
10.4
18%
10.5
27%
Other
5%
Total votes: 22

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 1st June 2011, 11:09
JerryMaWang JerryMaWang is offline
Junior Member
 
Join Date: Jul 2009
Posts: 22
JerryMaWang is on a distinguished road
Baan: Infor LN 6.1 - DB: Oracle - OS: Windows 2003
Use Afs to Create Sales Order and Sales Order Lines

I want to use afs to create sales order and lines. The sales order can be created successfully, and I can find the record in the table tdsls040, but the line can not be created, it told me "Sales Order not allowed" . The code is following, what should I do ? Thanks

stpapi.put.field("tdsls4101m000", "tdsls040.orno", "10")
stpapi.put.field("tdsls4101m000","tdsls040.cuno", "001")
stpapi.put.field("tdsls4101m000","tdsls040.cotp", "SN4")
stpapi.put.field("tdsls4101m000","tdsls040.comp", "700")
stpapi.put.field("tdsls4101m000","tdsls040.odat", str$(date.num()))
ret.insert= stpapi.insert("tdsls4101m000", true, error.msg)
|mess(error.msg,1)
|mess(str$(ret.insert),1)

stpapi.get.field("tdsls4101m000", "tdsls040.orno", returnOrno) | Get orno
| mess(returnOrno,1)

|stpapi.put.field("tdsls4101m000", "tdsls040.orno", "100035")
|ret.find= stpapi.find("tdsls4101m000", error.msg)
|if ret.find= 1 then
|stpapi.handle.subproc("tdsls4101m000", "tdsls4105s000", "add")
stpapi.put.field("tdsls4105s000", "tdsls041.orno", "100035")
stpapi.put.field("tdsls4105s000", "tdsls041.pono", "1")
stpapi.put.field("tdsls4105s000", "tdsls041.cuno", "001")
stpapi.put.field("tdsls4105s000", "tdsls041.item", "005")
stpapi.put.field("tdsls4105s000", "tdsls041.citg", "NSCP01")
stpapi.put.field("tdsls4105s000", "tdsls041.csgs", "------")
stpapi.put.field("tdsls4105s000", "tdsls041.pric", "12")
stpapi.put.field("tdsls4105s000", "tdsls041.cups", "PCS")
stpapi.put.field("tdsls4105s000", "tdsls041.odat", str$(date.num()))
stpapi.put.field("tdsls4105s000", "tdsls041.oqua", "200")
stpapi.put.field("tdsls4105s000", "tdsls041.cuqs", "PCS")
stpapi.put.field("tdsls4105s000", "tdsls041.amta", "2400")
stpapi.put.field("tdsls4105s000", "tdsls041.cwar", "S01")
stpapi.put.field("tdsls4105s000", "tdsls041.cvat", "17%")
stpapi.put.field("tdsls4105s000", "tdsls041.ccty", "CHN")
ret.insert= stpapi.insert("tdsls4105s000", true, error.msg)
|endif
|stpapi.end.session("tdsls4101m000")

|mess(error.msg,1)
if ret.insert<>1 then
ret.recover= stpapi.recover("tdsls4101m000", recover.msg)
endif
Reply With Quote
  #2  
Old 1st June 2011, 15:35
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,949
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Search on the session names in this forum. You will find a ton of threads on these sessions. There are lots of discussions around issues for the various versions.

This process should emulate what you do manually. Usually something like insert record in tdsls4101m000, hit lines button, enter line. I did not include any type of error checking, nor do we use these sessions. Just from glancing at another post or two I would expect to see something like this:

Code:
| Header inserted
stpapi.put.field("tdsls4101m000", "tdsls040.orno", "10") 
stpapi.put.field("tdsls4101m000","tdsls040.cuno", "001")
stpapi.put.field("tdsls4101m000","tdsls040.cotp", "SN4")
stpapi.put.field("tdsls4101m000","tdsls040.comp", "700")
stpapi.put.field("tdsls4101m000","tdsls040.odat", str$(date.num()))
ret.insert= stpapi.insert("tdsls4101m000", true, error.msg)

|Control and activiate lines session
stpapi.handle.subproc("tdsls4101m000", "tdsls4105s000", "add")
stpapi.continue.process("tdsls4101m000",error.msg)

|Put only those fields you would put if doing manually
stpapi.put.field("tdsls4105s000", "tdsls041.cuno", "001") 
stpapi.put.field("tdsls4105s000", "tdsls041.item", "005")
stpapi.put.field("tdsls4105s000", "tdsls041.citg", "NSCP01") 
stpapi.put.field("tdsls4105s000", "tdsls041.csgs", "------") 
stpapi.put.field("tdsls4105s000", "tdsls041.pric", "12") 
stpapi.put.field("tdsls4105s000", "tdsls041.cups", "PCS") 
stpapi.put.field("tdsls4105s000", "tdsls041.odat", str$(date.num())) 
stpapi.put.field("tdsls4105s000", "tdsls041.oqua", "200") 
stpapi.put.field("tdsls4105s000", "tdsls041.cuqs", "PCS") 
stpapi.put.field("tdsls4105s000", "tdsls041.amta", "2400") 
stpapi.put.field("tdsls4105s000", "tdsls041.cwar", "S01")
stpapi.put.field("tdsls4105s000", "tdsls041.cvat", "17%") 
stpapi.put.field("tdsls4105s000", "tdsls041.ccty", "CHN") 
ret.insert= stpapi.insert("tdsls4105s000", true, error.msg)
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #3  
Old 1st June 2011, 23:12
fallguyjg fallguyjg is offline
Member
 
Join Date: Feb 2005
Posts: 31
fallguyjg is on a distinguished road
Baan: B4c - DB: Informix - OS: true 64 unix
Example AFS Sales Order

This might help - See attachment.

fallguyjg
Attached Files
File Type: doc AFS Sales Order Demo.doc (66.5 KB, 183 views)
Reply With Quote
Sponsored Links
Reply


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
Sales Order Lines manasrpadhi AFS/DDC/OLE: Function servers 2 21st September 2011 14:11
AFS for Cancell sales lines order baanfans AFS/DDC/OLE: Function servers 6 18th December 2010 00:18
Baan IV c4 SP18 Sales Order Lines AFS vinceco252 AFS/DDC/OLE: Function servers 6 22nd July 2009 00:23
Sales order through AFS Debdas Banerjee AFS/DDC/OLE: Function servers 1 4th November 2004 17:39
AFS : Create a sales Order Line for a Generic Item van_math AFS/DDC/OLE: Function servers 2 1st June 2004 15:32


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


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