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
35%
FP3
4%
FP4
0%
FP5
0%
FP6
0%
FP7
4%
10.2 (incl. 10.2.1)
0%
10.3
9%
10.4
17%
10.5
26%
Other
4%
Total votes: 23

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 4th June 2009, 14:14
confused's Avatar
confused confused is offline
Junior Member
 
Join Date: Apr 2009
Posts: 12
confused is on a distinguished road
Baan: B40Cc4 - DB: oracle - OS: windows xp, unix
Unhappy How to make API if you have more purchase orders for one supplier and item?

I tried to make API which would make maintain receipts form my session. I managed to do it if I have only one purchase order for suppllier and item, but if I have more than one purchase order for supplier/item (which is my case), I cannot mark approppriate record.
Can anybody help me?

there is my code:

function extern long sdanfdll9997.new.receipt(
domain tcsuno suno.i,
domain tcorno orno.i,
domain tcpono pono.i,
domain tcqrd1 diqu.i,
domain tcqrd1 dqua.i,
domain tcqrd1 bqua.i,
domain tcdate date.i,
domain tdpur.dino dino.i,
domain tcyesno disp.y,
ref domain tcrcno reno.e,
ref domain tcmcs.str1 stat.e)
{
long ret
string err(80)
string reno.s(6)
long i.fpom

stpapi.put.field("tdpur4120m000", "tdpur045.reno", str$(serija.prijema))
stpapi.put.field("tdpur4120m000", "form.dino", dino.i)
stpapi.handle.subproc( "tdpur4120m000", "tdpur4131s000", "add")
ret = stpapi.change.view("tdpur4120m000", err)
if ret = 0 then
| error
if disp.y = tcyesno.yes then
message("ERROR API: " & strip$(err))
endif
stpapi.end.session("tdpur4120m000")
return(0)
endif


|**** looking for new reno
stpapi.put.field("tdpur4131s000","tdpur045.suno",suno.i)
stpapi.put.field("tdpur4131s000","tdpur045.orno",str$(orno.i))
stpapi.put.field("tdpur4131s000","tdpur045.pono",str$(pono.i))
stpapi.put.field("tdpur4131s000","tdpur045.ddtb",str$(zdnab501.date))
ret = stpapi.find("tdpur4131s000", err)

ret.mark = stpapi.mark("tdpur4131s000")
stpapi.continue.process("tdpur4131s000",err)
stpapi.end.session("tdpur4224s000")

if ret = 0 then
| error
if disp.y = tcyesno.yes then
message("ERROR API: " & strip$(err))
endif
stpapi.end.session("tdpur4131s000")
stpapi.end.session("tdpur4120m000")
return(0)
endif

stpapi.put.field("tdpur4131s000","tdpur045.mark",str$(1))
ret = stpapi.update("tdpur4131s000", 1 ,err)
if ret = 0 then
if disp.y = tcyesno.yes then
message("ERROR API: " & strip$(err))
endif
stpapi.end.session("tdpur4131s000")
stpapi.end.session("tdpur4120m000")
return(0)
endif
stpapi.end.session("tdpur4131s000")

| zde je nutno pockat, nez se naplni cislo prijmu
reno.s = "0"
i.fpom = 0
while lval(reno.s) = 0
stpapi.get.field("tdpur4120m000", "tdpur045.reno", reno.s)
i.fpom = i.fpom + 1
if i.fpom > 10000 then
break
endif
endwhile
stpapi.put.field("tdpur4120m000", "tdpur045.reno", reno.s)
stpapi.put.field("tdpur4120m000", "tdpur045.orno", str$(orno.i))
stpapi.put.field("tdpur4120m000", "tdpur045.pono", str$(pono.i))
ret = stpapi.find("tdpur4120m000", err)
if ret = 0 then |or ret = 2 then
if disp.y = tcyesno.yes then
message("ERROR API: " & strip$(err) & " ! " &
"Provjerite prijem: " & reno.s)
endif
stpapi.end.session("tdpur4120m000")
return(0)
endif
stpapi.put.field("tdpur4120m000", "tdpur045.diqu", str$(diqu.i))
stpapi.put.field("tdpur4120m000", "tdpur045.date", str$(date.i))
stpapi.put.field("tdpur4120m000", "tdpur045.dqua", str$(dqua.i))
stpapi.put.field("tdpur4120m000", "tdpur045.bqua", str$(bqua.i))
ret = stpapi.update("tdpur4120m000", 1 , err)
if ret = 0 then
if disp.y = tcyesno.yes then
message("ERROR API: " & strip$(err) & " ! " &
"Zkontrolujte příjem číslo: " & reno.s)
endif
stpapi.end.session("tdpur4120m000")
return(0)
endif
| **
stpapi.find("tdpur4120m000", err)
stpapi.get.field("tdpur4120m000", "status", stat.e)
stpapi.end.session("tdpur4120m000")
reno.e = lval(reno.s)
return(1)
}
Reply With Quote
  #2  
Old 4th June 2009, 15:30
confused's Avatar
confused confused is offline
Junior Member
 
Join Date: Apr 2009
Posts: 12
confused is on a distinguished road
Baan: B40Cc4 - DB: oracle - OS: windows xp, unix
I made another attempt: now I can mark appropriate record, but it doesn't make receipt.

|**** looking for a new reno
stpapi.put.field("tdpur4131s000","tdpur045.suno",suno.i)
stpapi.put.field("tdpur4131s000","tdpur045.orno",str$(orno.i))
stpapi.put.field("tdpur4131s000","tdpur045.pono",str$(pono.i))
stpapi.put.field("tdpur4131s000","tdpur045.ddtb",str$(zdnab501.date))
ret.find = stpapi.find("tdpur4131s000", err.find)

if ret.find = 0 then | error
message("ERROR API: " & strip$(err))
stpapi.end.session("tdpur4131s000")
stpapi.end.session("tdpur4120m000")
return(0)
endif

stpapi.get.field("tdpur4131s000","tdpur045.orno" ,orno.t)
stpapi.get.field("tdpur4131s000","tdpur045.pono" ,pono.t)
stpapi.get.field("tdpur4131s000","tdpur045.srnb" ,srnb.t)

if orno.t = str$(orno.i) and pono.t = str$(pono.i) then
pravi = 1
else
pravi = 0
endif
while pravi = 0 |*** looking for a record

ret.find = stpapi.browse.set("tdpur4131s000","next.set",err.find)
stpapi.get.field("tdpur4131s000","tdpur045.orno" ,orno.t)
stpapi.get.field("tdpur4131s000","tdpur045.pono" ,pono.t)
if orno.t = str$(orno.i) and pono.t = str$(pono.i) then
pravi = 1
| message(orno.t & "/" & pono.t)
stpapi.get.field("tdpur4131s000","tdpur045.orno" ,orno.t)
stpapi.get.field("tdpur4131s000","tdpur045.pono" ,pono.t)
stpapi.get.field("tdpur4131s000","tdpur045.srnb" ,srnb.t)
message(orno.t & "/" & pono.t & "-" & srnb.t)
else
pravi = 0
endif

endwhile

ret.mark = stpapi.mark("tdpur4131s000")
stpapi.get.field("tdpur4131s000","tdpur045.orno" ,orno.t)
stpapi.get.field("tdpur4131s000","tdpur045.pono" ,pono.t)
stpapi.get.field("tdpur4131s000","tdpur045.srnb" ,srnb.t)
message(orno.t & "/" & pono.t & "-" & srnb.t & " prvi put")



stpapi.put.field("tdpur4131s000","tdpur045.mark",str$(1))
ret = stpapi.update("tdpur4131s000", 1 ,err)
if ret = 0 then
if disp.y = tcyesno.yes then
message("ERROR API: " & strip$(err))
endif
stpapi.end.session("tdpur4131s000")
stpapi.end.session("tdpur4120m000")
return(0)
endif
stpapi.continue.process("tdpur4131s000",err)
stpapi.end.session("tdpur4224s000")
| stpapi.end.session("tdpur4131s000")

| zde je nutno pockat, nez se naplni cislo prijmu
reno.s = "0"
i.fpom = 0
while lval(reno.s) = 0
stpapi.get.field("tdpur4120m000", "tdpur045.reno", reno.s)
i.fpom = i.fpom + 1
if i.fpom > 10000 then
break
endif
endwhile
stpapi.put.field("tdpur4120m000", "tdpur045.reno", reno.s)
stpapi.put.field("tdpur4120m000", "tdpur045.orno", str$(orno.i))
stpapi.put.field("tdpur4120m000", "tdpur045.pono", str$(pono.i))
ret = stpapi.find("tdpur4120m000", err)
if ret = 0 then |or ret = 2 then
if disp.y = tcyesno.yes then
message("ERROR API: " & strip$(err) & " ! " &
"Provjerite prijem: " & reno.s)
endif
stpapi.end.session("tdpur4120m000")
return(0)
endif
stpapi.put.field("tdpur4120m000", "tdpur045.diqu", str$(diqu.i))
stpapi.put.field("tdpur4120m000", "tdpur045.date", str$(date.i))
stpapi.put.field("tdpur4120m000", "tdpur045.dqua", str$(dqua.i))
stpapi.put.field("tdpur4120m000", "tdpur045.bqua", str$(bqua.i))
ret = stpapi.update("tdpur4120m000", 1 , err)
if ret = 0 then
if disp.y = tcyesno.yes then
message("ERROR API: " & strip$(err) & " ! " &
"Zkontrolujte příjem číslo: " & reno.s)
endif
stpapi.end.session("tdpur4120m000")
return(0)
endif
| **
stpapi.find("tdpur4120m000", err)
stpapi.get.field("tdpur4120m000", "status", stat.e)
stpapi.end.session("tdpur4120m000")
reno.e = lval(reno.s)
return(1)
Reply With Quote
  #3  
Old 4th June 2009, 19:22
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
The only thing I can thing of is to try a find on tdpur4131s000 versus on browse or change view. I would probably try change view, then find right after it. Seems to me I had to do that in one session.
__________________
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
Sponsored Links
  #4  
Old 18th February 2010, 17:47
jcomboue jcomboue is offline
Junior Member
 
Join Date: Jun 2006
Posts: 7
jcomboue is on a distinguished road
Baan: BaanIVc4 - DB: SQL - OS: Windows2003
see my thread with this code

http://www.baanboard.com/baanboard/s...ad.php?t=57845
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
Purchase item from one supplier only batmush Distribution, Transportation & Warehousing 7 10th July 2007 11:27
subcontracting purchase orders g_someshwar Distribution, Transportation & Warehousing 1 5th April 2007 14:47
Purchase Price by Supplier and item zhuowb Distribution, Transportation & Warehousing 6 17th January 2004 08:05


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


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