Baanboard.com

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

User login

Frontpage Sponsor

Main

Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
18%
200 - 500 GB
29%
500 - 800 GB
3%
800 - 1200 GB
8%
1200 - 1500 GB
8%
1500 - 2000 GB
12%
> 2000 GB
22%
Total votes: 76

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 31st October 2005, 13:06
FoxZapper's Avatar
FoxZapper FoxZapper is offline
Junior Member
 
Join Date: Jun 2003
Location: UAE
Posts: 24
FoxZapper is on a distinguished road
Baan: BaaN IV c4 - DB: MS SQL - OS: Micrososft
Question Maintain Outbound in AFS fails for Order Type: "Collect Order"

Hello,

I am trying to automate the Collect Order Process.
In this, I managed to:
1. create a new sales order header
2. insert new sales order lines.

And when I save the record, the Maintain Outbound Data session (tdilc4102s000) gets activated immediately as its an order of type "Collect Order" [Note: tcmcs0142m000: Maintain Order Type with Collect Order = Yes]

I have already successfully managed to run the Maintain Outbound Process via the Maintain Outbound Data (tdilc4101m000) and the subsequent occurance of the subsession tdils4102s000.

However, in this case, the program fails as I am assuming there are 2 subsessions (tdsls4105s000 and tdilc4102s000) to be activated from the main session Maintain Sales Order tdsls4101m000Has someone come across this issue?
Any suggestions are welcome.

Regards,

Arun


Code:
function insert.so.lines.and.outbound.data()
{
long	ret.val, ret.val1, ret.val2, ret.val3
string	so.str(8)
string	err.mess(132)
string	so.number.str(10)
string	position.string(5)

get.max.position.for.order() 

		stpapi.put.field("tdsls4101m000", "tdsls040.orno", so.number.str)
		ret.val1 = stpapi.find("tdsls4101m000", error.msg)
	
		if ret.val1 = 1 then
			
			stpapi.handle.subproc("tdsls4101m000", "tdsls4105s000", "add")
			stpapi.continue.process("tdsls4101m000", error.msg)			
			stpapi.get.field("tdsls4105s000", "tdsls041.orno", so.str)
			
			stpapi.put.field("tdsls4105s000", "tdsls041.orno", so.number.str)
			stpapi.put.field("tdsls4105s000", "tdsls041.pono", position.number.str)
			stpapi.put.field("tdsls4105s000", "tdsls041.item", "51209")
			stpapi.put.field("tdsls4105s000", "tdsls041.cwar", "001")
			stpapi.put.field("tdsls4105s000", "tdsls041.oqua", "1")
			stpapi.put.field("tdsls4105s000", "tdsls041.pric", "735")
			stpapi.put.field("tdsls4105s000", "tdsls041.ldam", "0")
			stpapi.put.field("tdsls4105s000", "tdsls041.disc", "0")
			ret.val2 = stpapi.insert("tdsls4105s000", true, err.mesg)
				if ret.val2 <> 1 then
				|* If error, then recover the session
					ret.val3 = stpapi.recover("tdsls4105s000", err.mess)
					create.so.insert.err.file()
				else
					success.rec = success.rec + 1
					|* Maintain Outbound Data						
					stpapi.handle.subproc("tdsls4105s000", "tdilc4102s000", "add")
					get.next.sequence.number.for.sales.sera.serb.from.tdilc401()
					|* Begin the Subsession to maintain the data
					stpapi.put.field( "tdilc4102s000", "tdilc401.koor", str$(etol(tdilc.koob.act.sls)))
					stpapi.put.field( "tdilc4102s000", "tdilc401.orno", order.no.str)
					stpapi.put.field( "tdilc4102s000", "tdilc401.pono", position.number.str)
					ret.val3 = stpapi.change.view("tdilc4102s000", error.msg)
					stpapi.put.field( "tdilc4102s000", "tdilc401.orno", order.no.str)
					stpapi.put.field( "tdilc4102s000", "tdilc401.pono", position.number.str)
					stpapi.put.field( "tdilc4102s000", "tdilc401.sera", sera.str)
					stpapi.put.field( "tdilc4102s000", "tdilc401.serb", serb.str)
					stpapi.put.field( "tdilc4102s000", "tdsls041.item", "51209")					
					stpapi.put.field( "tdilc4102s000", "tdilc401.loca", "RE")
					stpapi.put.field( "tdilc4102s000", "tdilc401.stun", "set")
					stpapi.put.field( "tdilc4102s000", "tdilc401.qstr", "1")
					stpapi.put.field( "tdilc4102s000", "tdilc401.qsts", "1")
						
					ret.val = stpapi.insert("tdilc4102s000", true, err.mesg )
					if ret.val <> 1 then
						ret.val2 = stpapi.recover("tdilc4102s000", err.mess)
						|create.err.file()
					else
						success.rec = success.rec + 1
						first.time = false
					endif
					stpapi.end.session( "tdilc4102s000")
					stpapi.end.session( "tdilc4513s000")
				endif
			stpapi.end.session( "tdsls4105s000")
			stpapi.end.session( "tdsls4504s000")	
		else
			|* Order Not found
			err.mesg = sprintf$("Sales Order:%s could not be found!!", so.number.str)
			create.so.insert.err.file()
		endif
		stpapi.end.session( "tdsls4101m000")
}
Reply With Quote
  #2  
Old 31st October 2005, 14:25
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,365
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Just an observation - does ret.val2 = stpapi.insert("tdsls4105s000", true, err.mesg) then launch tdilc4102s000? If so then move your stpapi.handle.subproc up above the insert statement. Just guessing since I can't see the code in get.next.sequence.number.for.sales.sera.serb.from.tdilc401().

Another question - is it possible for you to use the kill option and then run tdilc4102m000? Not sure since I do not understand this whole process.
__________________
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 31st October 2005, 14:43
FoxZapper's Avatar
FoxZapper FoxZapper is offline
Junior Member
 
Join Date: Jun 2003
Location: UAE
Posts: 24
FoxZapper is on a distinguished road
Baan: BaaN IV c4 - DB: MS SQL - OS: Micrososft
Dear Mark,

Thanks for your reply.
Actually from a UI perspective, the moment the user saves the record in tdsls4105s000, the system activates the tdilc4102s000 session internally. Based on your obeservation, I tried moving the
Code:
stpapi.handle.subproc( "tdsls4105s000", "tdilc4102s000", "add")
before the
Code:
ret.val2 = stpapi.insert("tdsls4105s000", true, err.mesg)
Unfortunately, the moment the focus reaches
Code:
stpapi.put.field( "tdilc4102s000", "tdilc401.koor", str$(etol(tdilc.koob.act.sls)))
the code freezes and gets delayed considerably.

Have you ever come across a case where 2 subsessions needed to be activated in sequence.
My process is similar to the one below (where you had posted some answers too!)
afs problem with tdilc4102s000 out of tdsls4105s000

Any ideas?


Regards,

Arun
Reply With Quote
  #4  
Old 31st October 2005, 15:03
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,365
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Yes - I have one that interacts with tfgld1101m00 and several of the tfacp sessions. Of course that was one of my uglier processes, but it works. Several questions pop into my mind? One when the insert is executed does this activate the tdilc session? If so does the stpapi.put.field( "tdilc4102s000", "tdilc401.koor", str$(etol(tdilc.koob.act.sls) activate another instance of tdilc4102s000 in the background? If yes - then I have this question? When you run it manually can you just cancel out of the tdilc4102s000 session. Then possible activate it again??

Even better would be if you had source code and could put tdsls4105s000 and tdilc4102s000 in debug 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.

Last edited by mark_h : 31st October 2005 at 15:43. Reason: add the t to tdilc
Reply With Quote
  #5  
Old 31st October 2005, 16:14
FoxZapper's Avatar
FoxZapper FoxZapper is offline
Junior Member
 
Join Date: Jun 2003
Location: UAE
Posts: 24
FoxZapper is on a distinguished road
Baan: BaaN IV c4 - DB: MS SQL - OS: Micrososft
Dear Mark,

This is the flow. The following sessions are activated in sequence.

a. Maintain Sales Order tds4101m000
b. Maintain Sales Order Lines tdsls4105s000
While inserting the lines, it also activates the session tdsls4504s000 in the background.

The moment, we save a record (insert) on this session, the following get activated.
Maintain Outbound Data tdilc4102s000
It also activates the session tdilc4513s000 in the background.

In my script, the AFS successfully inserts the data into the Sales Order Line
stpapi.insert("tdsls4105s000", true, err.mesg)

But the focus is lost from:
Code:
stpapi.handle.subproc("tdsls4105s000", "tdilc4102s000", "add")
stpapi.continue.process("tdsls4105s000", err.mess)
stpapi.get.field("tdsls4105s000", "tdsls041.orno", so.str)[u]
Manually, there is no way to cancel this session tdilc4102s000 as at this moment the focus is lost from all other sessions.
The only way to establish that the other sessions are running is via the Bshell.

Having the source code would have made my life a lot easier.... but life isn't always fair.

Regards,

Arun
Reply With Quote
  #6  
Old 31st October 2005, 16:52
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,365
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Sent an email to you.

I have done a lot of ugly things to get function servers to work with some sessions. I have posted code to kill a session in the background - but I do not know if it would do you any good. In my case I kill the session (no control like yours), but then I re-launch it with another stpapi command which then gives me code. You can try this by hand - run your function server. Once tdilc4102 launches then use the bsehll and kill both tdilc4102 and tdilc4513. See if control returns to your program. Then run tdilc4101m000 by hand and do the outbound stuff. And then let your code just close. Does this process work?

I had to get this in today - I learned that true is not always equal to true in Baan. I know understand how Baan handles boolean. In service pack 19 I had one program where I had api.mode = true. TSK! TSK! It worked before, but now api.mode=2 which is still true yet not equal to true. I just could not resist.
__________________
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
  #7  
Old 3rd November 2005, 11:37
FoxZapper's Avatar
FoxZapper FoxZapper is offline
Junior Member
 
Join Date: Jun 2003
Location: UAE
Posts: 24
FoxZapper is on a distinguished road
Baan: BaaN IV c4 - DB: MS SQL - OS: Micrososft
Dear Mark,

Thanks for your assistance and suggestions.
Your scripts were useful. Managed to establish that all 'COLLECT' orders activate the ilc subsessions.
But, the issue is not with my script, it's with the session itself. According to BaaN tdsls4105m00 and tdsls4105s000 Maintain Sales Order Lines(Wholesale)are not supported on AFS.

Quote:
The session “Maintain Sales Order Lines” (tdpur4102s000) is supported for use with API and Application Function Servers while session “Maintain Sales Order Lines (Wholesale)” (tdpur4105s000) is not. Support is dependent on the session and not the program script. A function server generated for session “Maintain Sales Order Lines (Wholesale)” (tdpur4105s000) is used at your own risk and not supported because Baan has not adapted the session logic to be compatible with API and function server requirements.
I should have checked this before attempting this on AFS. My bad!
Surprisingly, even though BaaN does not support these sessions, I was able to insert Sales Order Lines using my AFS script.

I plan to activate this via tdsls4102s000 and try the same. Will let you know how it turns out.

Regards,

Arun
Reply With Quote
  #8  
Old 3rd November 2005, 14:45
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,365
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Glad to be of help. I have plenty of function servers for non-supported sessions. So far it has not stopped me and plus I think Baan should make all sessions API friendly.
__________________
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
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
maintain outbound using afs timb25 AFS/DDC/OLE: Function servers 7 18th September 2006 12:16
AFS on Maintain Production Order jp.aalders AFS/DDC/OLE: Function servers 6 23rd December 2004 12:40
Baan & Connectware Driver Hangs Rajasekhar Tools Administration & Installation 2 18th February 2004 21:32
AFS Issues (maintain Outbound) vishbaan AFS/DDC/OLE: Function servers 3 14th July 2003 22:04
Question : Maintain Outbound Order (Production Order) nopadon Manufacturing & Supply Chain 4 18th October 2002 23:28


All times are GMT +2. The time now is 18:38.


©2001-2018 - Baanboard.com - Baanforums.com