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

Reply
 
Thread Tools Display Modes
  #1  
Old 19th November 2007, 10:26
maclezhang maclezhang is offline
Junior Member
 
Join Date: Dec 2006
Posts: 22
maclezhang is on a distinguished road
Baan: ssaln - DB: oracle - OS: aix
how to add sales order with AFS

We try to use AFS to develop some sessions to reduce the data inputting labour .
we wish to add salse order ,production order automatically from a middle table defined by ourself .
we import the data into middle table ,and let AFS to add records automatically into baan standard tables . we meet some errors .For sales order ,if we put values for all fields in the form ,AFS can add new records ,but the order quantity changed to Zero,but the amount is correct. if we only put value for order quantity,the records cannot be added . for production order ,afs cannot add new records , but can modify existed records .
please refer the attached program .

afs-sales-order
Code:
|******************************************************************************
|* tdsls0241  0  VRC B61C a  gr  
|*|******************************************************************************
|* Main table tdsls041 ? Form Type 4
|******************************************************************************
                                                                                
|****************************** declaration section ***************************
 
declaration:
 

 table ttdsls400  
 table ttdsls401
 

 #pragma used dll "otdsls4100m000f"
 #pragma used dll "otdsls4100m900f"
 #pragma used dll "otdsls4101m000f"
 #pragma used dll "otdsls4101mt00f"
 #pragma used dll "ottstpapihand"

 
 
 
 

|****************************** choice section ********************************
 

choice.cont.process:
on.choice:
 insert_tdsls401()
 
 
|****************************** function section ******************************
 
functions:
 

function insert_tdsls401()
{
 long ret,retval1
 string error
 stpapi.put.field("tdsls4101mt00","tdsls401.orno","210000001")
 stpapi.put.field("tdsls4101mt00","tdsls401.pono","50")
 ret=stpapi.find("tdsls4101mt00")
 if not ret=1 then
  stpapi.put.field("tdsls4101mt00","tdsls401.orno","210000001")
  ret=stpapi.find("tdsls4101mt00")
  if ret=1 then  
   ret=stpapi.synchronize.dialog("tdsls4101mt00","add",error)
   if ret=1 then 
    stpapi.put.field("tdsls4101m000","tdsls401.orno","210000001")
    stpapi.put.field("tdsls4101m000","tdsls401.pono","50")
    stpapi.put.field("tdsls4101m000","tdsls401.citt","CKB")
    stpapi.put.field("tdsls4101m000","tform.aitc","")
    stpapi.put.field("tdsls4101m000","tdsls401.item.segment.2","KA02300321")
    stpapi.put.field("tdsls4101m000","tdsls401.sdsc","1")
    stpapi.put.field("tdsls4101m000","tdsls401.effn","0")
    stpapi.put.field("tdsls4101m000","tdsls401.dltp","15")
    stpapi.put.field("tdsls4101m000","tdsls401.cwar","500")
    stpapi.put.field("tdsls4101m000","tdsls401.qoor","10")
    stpapi.put.field("tdsls4101m000","tdsls401.cprj","")
    stpapi.put.field("tdsls4101m000","tdsls401.opol","2")
    stpapi.put.field("tdsls4101m000","tdsls401.cuqs","SET")
    stpapi.put.field("tdsls4101m000","tdsls401.qohb","0")
    stpapi.put.field("tdsls4101m000","tdsls401.pric","1")
    stpapi.put.field("tdsls4101m000","tdsls401.oamt","10")
    retval1=stpapi.insert("tdsls4101m000",true,error)
   endif
   if not retval1  then
    retval1=stpapi.recover("tdsls4101m000",error)
   endif
  endif 
  stpapi.end.session("tdsls4101mt00")
  commit.transaction()
 endif
}



afs-production-order
declaration:
 
 table ttisfc001
 
       #pragma used dll "ottstpapihand"
       #pragma used dll "otisfc0501mt00f"
       #pragma used dll "otisfc0101s000f"

|****************************** group section **********************************
 

form.all:                                                         
init.form:
        get.screen.defaults()

choice.cont.process:
on.choice: 
  read.main.table()
 
 
functions:
 
function read.main.table()
{
 
 long ret,retval1
 string error
 ret=stpapi.find("tisfc0501mt00")
 ret=stpapi.synchronize.dialog("tisfc0501mt00","add",error)
 if ret=1 then
  stpapi.put.field("tisfc0101s000","tisfc001.pdno","201") 
  stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.2","CC04000010") 
  stpapi.put.field("tisfc0101s000","tisfc001.qrdr","1")
  stpapi.form.command( "tisfc0101s000", 5, "default.qty", error )
  stpapi.put.field("tisfc0101s000","tisfc001.cpla","1")
  stpapi.put.field("tisfc0101s000","tisfc001.prdt",str$(utc.num()+10))
  stpapi.put.field("tisfc0101s000","tisfc001.rdld",str$(utc.num()+7200))
  stpapi.put.field("tisfc0101s000","tisfc001.efdt",str$(utc.num()))
  stpapi.put.field("tisfc0101s000","tisfc001.cwar","500")
  stpapi.put.field("tisfc0101s000","tisfc001.opro","   23") 
  |stpapi.put.field("tisfc0101s000","tisfc001.pldt",str$(utc.num()))
  retval1=stpapi.insert("tisfc0101mt00",true,error)
  if not retval1  then
   retval1=stpapi.recover("tisfc0101mt00",error)
  endif
 endif
 stpapi.end.session("tisfc0101mt00")
 commit.transaction()
 message("End")
}

Last edited by george7a : 19th November 2007 at 10:29. Reason: adding Baan code tags
Reply With Quote
Sponsored Links
  #2  
Old 19th November 2007, 15:29
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,935
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Under LN (based on your profile) it seems that most people use the DAL functionality instead AFS. Search this forum and you will find plenty of threads with code - such as this one here.
__________________
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 20th November 2007, 03:39
maclezhang maclezhang is offline
Junior Member
 
Join Date: Dec 2006
Posts: 22
maclezhang is on a distinguished road
Baan: ssaln - DB: oracle - OS: aix
thanks mark
we are trying the dal mode
Reply With Quote
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 Line Deletion learner Distribution, Transportation & Warehousing 2 1st May 2007 22:42
Sales order AFS in different company bahwesh.bharti AFS/DDC/OLE: Function servers 6 15th March 2007 06:14
problem in AFS - Sales Order Splitting veyant AFS/DDC/OLE: Function servers 7 10th May 2006 07:40
Extension to sales order header being updatesd thru AFS or update table will work darpan Tools Development 4 16th April 2005 10:16
Sales order through AFS Debdas Banerjee AFS/DDC/OLE: Function servers 1 4th November 2004 17:39


All times are GMT +2. The time now is 06:12.


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