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
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 9th August 2017, 13:31
frenny's Avatar
frenny frenny is offline
Member
 
Join Date: Oct 2013
Posts: 48
frenny is on a distinguished road
Baan: ERP LN - DB: sqlserver 2012 - OS: winxp
Planned Order Distribution AFS Issue

Hello All,

I am Trying To create Planned Purchase Order for Manufacturing Item
But It is giving Error During Order Line Distribution

Code:
Quote:
|Get Defult Scenario
select cprpd400.plnc
from cprpd400
where cprpd400.plfd > :1
wherebind(1, utc.num())
selectdo
endselect

stpapi.put.field("cprrp1600m000", "cprrp100.plnc", cprpd400.plnc)
stpapi.put.field("cprrp1600m000", "cprrp100.type", str$(etol(tckoor.cp.pur)))
stpapi.put.field("cprrp1600m000", "cprrp100.item.segment.3", trim$(i.item))
stpapi.put.field("cprrp1600m000", "cprrp100.quan", str$(i.qnty))
if not isspace(i.cwar) then
stpapi.put.field("cprrp1600m000", "cprrp100.dwar", str$(i.cwar))
endif
ret = stpapi.insert("cprrp1600m000", true, error_message)
if ret = 1 then
stpapi.get.field("cprrp1600m000", "cprrp100.orno", get.orno)
stpapi.handle.subproc("cprrp1600m000","cprrp1105m000","add")
stpapi.put.field("cprrp1105m000", "cprrp001.cprj", i.cprj)
stpapi.put.field("cprrp1105m000", "cprrp001.cspa", i.cspa)
stpapi.put.field("cprrp1105m000", "cprrp001.cact", i.cact)
stpapi.put.field("cprrp1105m000", "cprrp105.oqan", str$(i.qnty))
stpapi.enum.answer("cprrp1105m000","cprrp150101",tcokca.ok)
ret = stpapi.insert("cprrp1105m000",true, error_message)
if ret = 1 then
stpapi.end.session("cprrp1105m000")
stpapi.end.session("cprrp1600m000")
return("")
endif
endif
stpapi.end.session("cprrp1105m000")
stpapi.end.session("cprrp1600m000")

return(error_message)
It is Giving Error:
Enter a value for Project Field.:\\n\\n Reason:Project is Mandatory
Reply With Quote
  #2  
Old 9th August 2017, 14:06
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,905
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Not sure if this thread helps or not http://www.baanboard.com/baanboard/s...=cprrp1105m000

If this was 4c4 I would expect it to look the handle.subproc before the insert - assuming the insert kicks off the subsession. If it does not kick off the subsession then look at the attached thread where they use the form command to kick off the distribution session.

stpapi.handle.subproc("cprrp1600m000","cprrp1105m000","add")
ret = stpapi.insert("cprrp1600m000", true, error_message)

If you have source code you can always put it in debug and see what happens in api mode.
__________________
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 10th August 2017, 05:37
frenny's Avatar
frenny frenny is offline
Member
 
Join Date: Oct 2013
Posts: 48
frenny is on a distinguished road
Baan: ERP LN - DB: sqlserver 2012 - OS: winxp
Hi Mark,

I have tried all solution mention in thread but still it is not working.
Reply With Quote
  #4  
Old 10th August 2017, 17:27
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,905
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
This isn't one of the mmt sessions is it?

Can you confirm that when the subsession opens it is controlled by the parent session? Then once the sub-session is open can you do some gets and to make sure it is where you expect. By this I mean can you see that it zoomed to the right purchase order to add distribution to?

It is always possible that something in the initial zoom to the subsession is not setting everything it should. Without source code sometimes this can be very difficult to trouble shoot. In the mean time hopefully someone comes along and has a solution.
__________________
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
  #5  
Old 11th August 2017, 05:03
frenny's Avatar
frenny frenny is offline
Member
 
Join Date: Oct 2013
Posts: 48
frenny is on a distinguished road
Baan: ERP LN - DB: sqlserver 2012 - OS: winxp
Hi mark ,

I have tried all combination, with MMT cprrp1600m000, with Single Distribution session cprrp1105m00, with Header session cprrp1100m000.

But its still giving error.
Reply With Quote
  #6  
Old 11th August 2017, 21:45
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,905
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
I can't think of anything else to try - hopefully someone comes along with a solution.
__________________
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
  #7  
Old 13th August 2017, 05:43
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Hi,

Have you tried using DAL here?
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #8  
Old 14th August 2017, 05:51
frenny's Avatar
frenny frenny is offline
Member
 
Join Date: Oct 2013
Posts: 48
frenny is on a distinguished road
Baan: ERP LN - DB: sqlserver 2012 - OS: winxp
Hello Bhushan sir,

We can not use DAL in this case
because Pegging fields are from different table cprrp001 ,
and main table for session cprrp1105m000 is cprrp105, and according to standard functionality it will create one specification number based on project, element, activity during planned distribution entry and that number update in cprrp105.

Quote:
|Insert New Entry
dal.clear.messages(MSG.ALL)
num.messages = 0
ret = dal.new.object("cprrp105")
dal.set.field("cprrp105.plnc", cprpd400.plnc) |Value - "ACT"
dal.set.field("cprrp105.koor", tckoor.cp.pur )
dal.set.field("cprrp105.orno", get.orno) |Value - generated order number
dal.set.field("cprrp105.lpon", 1)
dal.set.field("cprrp001.cprj", i.cprj) |Diffrent Maintable field - Any project
dal.set.field("cprrp001.cspa", i.cspa)
dal.set.field("cprrp001.cact", i.cact)
dal.set.field("cprrp105.oqan", i.qnty)
ret = dal.save.object("cprrp105", db.skip.dupl)
num.messages = dal.count.messages(MSG.ALL)
if ret then
for j = 1 to num.messages
ret = dal.get.error.message(error_message)
endfor
abort.transaction()
else
error_message = ""
commit.transaction()
endif
In Above case , It will insert planned distribution but with Blank Project, element, activity

Last edited by frenny : 14th August 2017 at 06:03.
Reply With Quote
  #9  
Old 14th August 2017, 08:40
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,286
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
The Specification and its Hash fields in cprrp001 should get defaulted when you call dal.new.object("cprrp001")

I do not see you calling dal.new.object("cprrp001")

Can you try that?

Unfortunately, I do not have Project Pegged based environment to try this. But, I verified calling dal.new.object("cprrp001") and it generated the spid field nicely.

You may give it a try.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #10  
Old 14th August 2017, 10:42
frenny's Avatar
frenny frenny is offline
Member
 
Join Date: Oct 2013
Posts: 48
frenny is on a distinguished road
Baan: ERP LN - DB: sqlserver 2012 - OS: winxp
Thank you very much sir .. It is Working Fine with below code..
Quote:
|Insert New Entry
dal.clear.messages(MSG.ALL)
num.messages = 0

ret = dal.new.object("cprrp001")
dal.set.field("cprrp001.cprj", i.cprj)
dal.set.field("cprrp001.cspa", i.cspa)
dal.set.field("cprrp001.cact", i.cact)
dal.set.field("cprrp001.copr", tcpeg.cpor.manual)
ret = dal.save.object("cprrp001", db.skip.dupl)
commit.transaction()

select cprrp001.spid
from cprrp001
where cprrp001.cprj = :i.cprj
and cprrp001.cspa = :i.cspa
and cprrp001.cact = :i.cact
selectdo
endselect

ret = dal.new.object("cprrp105")

dal.set.field("cprrp105.plnc", cprpd400.plnc)
dal.set.field("cprrp105.koor", tckoor.cp.pur )
dal.set.field("cprrp105.orno", get.orno)
dal.set.field("cprrp105.lpon", 1)
dal.set.field("cprrp105.spid", cprrp001.spid)
dal.set.field("cprrp105.oqan", i.qnty)
ret = dal.save.object("cprrp105", db.skip.dupl)

num.messages = dal.count.messages(MSG.ALL)
if ret then
for j = 1 to num.messages
ret = dal.get.error.message(error_message)
endfor
abort.transaction()
else
error_message = ""
commit.transaction()
endif

Last edited by frenny : 14th August 2017 at 11:14.
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
Order Planning Issue Cindytan Manufacturing & Supply Chain 7 22nd August 2016 14:52
How to generate the Purchase Order No. with AFS tracylee AFS/DDC/OLE: Function servers 3 25th March 2016 21:35
Best Practice for Planned Order Analysis & processing quelle Manufacturing & Supply Chain 0 23rd February 2011 10:57
how to add sales order with AFS maclezhang AFS/DDC/OLE: Function servers 2 20th November 2007 02:39
Planned Order Quantities LittleJohn Manufacturing & Supply Chain 8 2nd June 2004 18:39


All times are GMT +2. The time now is 20:34.


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