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 30th March 2017, 13:55
VishalMistry's Avatar
VishalMistry VishalMistry is offline
Guru
 
Join Date: Dec 2004
Location: India, Gujarat
Posts: 573
VishalMistry has a little shameless behaviour in the past
Baan: Baan IV, ERPLn - DB: SQL Server 2000 / 2008 - OS: Windows Server 2003 / 2008
Red face Device selection and printing in AFS

Hello Everyone,

NOTE:THIS IS REGARDING BAAN IV

I want to call the Print storage list session through AFS and specify specific order numbers manually. But the session is not printing the storage list report. My code is attached for reference.

I already searched the forum and found one suitable post but still I am not able to get things done.

Please see the attached code and suggest changes.

Thanks and regards,
Vishal
Attached Files
File Type: txt script.txt (556 Bytes, 17 views)
Reply With Quote
  #2  
Old 30th March 2017, 17:27
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
Never could get that to work for our system. So the way I defeated this was to just run the reports(not this specific report) one a time using a look. Worked the same in the end. So basically I asked the user to input 10 orders - then just did a for loop to print all 10 or how ever many they listed. The end result was the same as if they ran the session manually and picked enter specific orders.

Code:
	for i = 1 to 10
		if(ornos(i)=0) then
			break
		endif

| Setup the sessions fields for the tdpur9901m000 session which is a 
| clone of tdpur4401m000.

		stpapi.put.field( "tdpur9901m000", "tdpur999.send", str$(tdpur.dist.account) )
		| 20071004.st Add fields to put onto session
		stpapi.put.field( "tdpur9901m000", "selection", str$(tcyesno.no) )
		stpapi.put.field( "tdpur9901m000", "suno.f", "      " )
		stpapi.put.field( "tdpur9901m000", "suno.t", "ZZZZZZ" )	| 20071004.end
		stpapi.put.field( "tdpur9901m000", "orno.f",str$(ornos(i)))
		stpapi.put.field( "tdpur9901m000", "orno.t",str$(ornos(i)))
__________________
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 March 2017, 14:09
VishalMistry's Avatar
VishalMistry VishalMistry is offline
Guru
 
Join Date: Dec 2004
Location: India, Gujarat
Posts: 573
VishalMistry has a little shameless behaviour in the past
Baan: Baan IV, ERPLn - DB: SQL Server 2000 / 2008 - OS: Windows Server 2003 / 2008
Hi Mark,

Thanks for the update. But it does not serve the purpose. The flow will be like below:

1.User will start session tdpur4421m000
2.In this session, user will set specific order to yes(first field in tdpur4421m000)
3.Now session tdpur4820s000 will start where user can specify specific order numbers. Maximum upto 10 and user will click on Ok then control will return to session tdpur4421m00
4.Now user will select report and report will be fired. Finally the field tdpur045.spur will be updated with next step to be executed (probably 9).

I just want to know how can i call the session tdpur4820s000 and specify order numbers through AFS.

If anyone else faced similar requirement and solved it, please post your code.

Vishal
Reply With Quote
  #4  
Old 31st March 2017, 14:26
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
Maybe you do not understand me - all session tdpur4820s000 does is let you enter 10 order numbers. So what I did was write my own session to get 10 orders. Then I run them thru something like tdpur4401m000 one at a time. It does all the same steps, but you just sent them one at a time. That versus letting the session track all 10 orders. It accomplishes the same as if the user just did them one at a time thru the session.

If you are dead set doing it thru tdpur4820s000 then the first thing you need to look at are these two steps.
Code:
	stpapi.put.field( "tdpur4421m000", "selection", str$(tcyesno.yes))
	stpapi.handle.subproc( "tdpur4421m000", "tdpur4820s000", "send")
First you want the subproc before the action that will start the subsession. That way the main program has control. So I would do something like this
Code:
	stpapi.handle.subproc( "tdpur4421m000", "tdpur4820s000", "add")	
        stpapi.put.field( "tdpur4421m000", "selection", str$(tcyesno.yes))
Now just doing a put on our system to yes would not activate tdpur4820s000. So I suspect you need some kind of action to get it to check that field. So I would try a stpapi.save or stpapi.update - something to make tdpur4421 to start processing and find that the flag is yes and launch tdpur4820s000. Then after that I would do a continue on tdpur4820s000 and not an end 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
  #5  
Old 31st March 2017, 15:35
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
Actually see if this works:
Code:
	stpapi.handle.subproc( "tdpur4421m000", "tdpur4820s000", "add")	
        stpapi.put.field( "tdpur4421m000", "selection", str$(tcyesno.yes))
	stpapi.continue.process("tdpur4421m000",err)
This should get 8420s000 started - it did on my system. I am thinking you want all you setups for tdpur4421m000 done before that continue. Something like this:
Code:
	i.spooler = spool.open("", "", 1)
	stpapi.set.report( "tdpur4421m000", "rtdpur442101100", spool.device, error.msg )
	stpapi.handle.subproc( "tdpur4421m000", "tdpur4820s000", "add")	
        stpapi.put.field( "tdpur4421m000", "selection", str$(tcyesno.yes))
	stpapi.continue.process("tdpur4421m000",err)
	stpapi.put.field( "tdpur4820s000", "orno.select", str$(load.long(receipts.array(pos.orno,1))), 1)
	stpapi.put.field( "tdpur4820s000", "orno.select", str$(load.long(receipts.array(pos.orno,2))), 2)
	stpapi.continue.process( "tdpur4820s000" , error.msg)
I am not really sure what will happen after the continue on 4820s000, but I think tdpur4421m000 might start processing. I could be wrong, not really sure.
__________________
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
  #6  
Old 3rd April 2017, 16:37
VishalMistry's Avatar
VishalMistry VishalMistry is offline
Guru
 
Join Date: Dec 2004
Location: India, Gujarat
Posts: 573
VishalMistry has a little shameless behaviour in the past
Baan: Baan IV, ERPLn - DB: SQL Server 2000 / 2008 - OS: Windows Server 2003 / 2008
Red face Tried but no luck

Quote:
Originally Posted by mark_h View Post
Actually see if this works:
Code:
	stpapi.handle.subproc( "tdpur4421m000", "tdpur4820s000", "add")	
        stpapi.put.field( "tdpur4421m000", "selection", str$(tcyesno.yes))
	stpapi.continue.process("tdpur4421m000",err)
This should get 8420s000 started - it did on my system. I am thinking you want all you setups for tdpur4421m000 done before that continue. Something like this:
Code:
	i.spooler = spool.open("", "", 1)
	stpapi.set.report( "tdpur4421m000", "rtdpur442101100", spool.device, error.msg )
	stpapi.handle.subproc( "tdpur4421m000", "tdpur4820s000", "add")	
        stpapi.put.field( "tdpur4421m000", "selection", str$(tcyesno.yes))
	stpapi.continue.process("tdpur4421m000",err)
	stpapi.put.field( "tdpur4820s000", "orno.select", str$(load.long(receipts.array(pos.orno,1))), 1)
	stpapi.put.field( "tdpur4820s000", "orno.select", str$(load.long(receipts.array(pos.orno,2))), 2)
	stpapi.continue.process( "tdpur4820s000" , error.msg)
I am not really sure what will happen after the continue on 4820s000, but I think tdpur4421m000 might start processing. I could be wrong, not really sure.
I tried your given code snippet but no luck. The session still hangs. The other way I tried is also attached as a script. Still I am facing session hang.

Vishal
Attached Files
File Type: cln print.storage.list.cln (1.2 KB, 5 views)
Reply With Quote
  #7  
Old 4th April 2017, 15:49
VishalMistry's Avatar
VishalMistry VishalMistry is offline
Guru
 
Join Date: Dec 2004
Location: India, Gujarat
Posts: 573
VishalMistry has a little shameless behaviour in the past
Baan: Baan IV, ERPLn - DB: SQL Server 2000 / 2008 - OS: Windows Server 2003 / 2008
Hello Everybody,

Any clue regarding the above post ? I shall appreciate help in this regard.

Vishal
Reply With Quote
  #8  
Old 5th April 2017, 03:13
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
I will look again when I get back to the office next week. I will have to try with another session, never could find anything to print for this one.
__________________
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
  #9  
Old 7th April 2017, 20:34
cherokee's Avatar
cherokee cherokee is offline
Senior Member
 
Join Date: Jan 2003
Location: Montreal, Canada
Posts: 290
cherokee is on a distinguished road
Baan: Baan IVc3 A&D - DB: Oracle - OS: IBM AIX
Thumbs up

Hello,

I did this and works for me. The only down side is that I couldn't make it work for "Include Printed Lines", other than that works fine.


Code:
function print.storage.list()
{
 domain tcmcs.str100   error.msg
 domain  tcmcs.long      l.pid
 domain  tcmcs.long      l.orno(10)

 stpapi.put.field( "tdpur4421m000", "selection", str$(tcyesno.yes))
 stpapi.handle.subproc( "tdpur4421m000", "tdpur4820s000", "kill")
 l.pid = find.a.process("tdpur4421m000")
 put.var(l.pid,"orno.1",l.orno(1))
 put.var(l.pid,"orno.2",l.orno(2))
 put.var(l.pid,"orno.3",l.orno(3))
 put.var(l.pid,"orno.4",l.orno(4))
 put.var(l.pid,"orno.5",l.orno(5))
 put.var(l.pid,"orno.6",l.orno(6))
 put.var(l.pid,"orno.7",l.orno(7))
 put.var(l.pid,"orno.8",l.orno(8))
 put.var(l.pid,"orno.9",l.orno(9))
 put.var(l.pid,"orno.10",l.orno(10))
 stpapi.set.report("tdpur4421m000", "rtdpur442101101", spool.device, error.msg)
 stpapi.print.report("tdpur4421m000", error.msg)
 stpapi.end.session("tdpur4421m000")
}

function domain tcmcs.long find.a.process(domain tcmcs.str14 i.baan.sess)
{
	long    hold.pno
	long    pno
	long    info(256)
	string  pname(15)
        domain  tcbool  sess.found

	sess.found = false
	pno = 0
	hold.pno = pno
	pno = pstat (pno, pname, info)
	while pno > 0 and not sess.found
		hold.pno = pno
		pno = pstat (pno, pname, info)
		if strip$(pname)=strip$(i.baan.sess) then
			sess.found = true
                        return(info(2))
		endif
	endwhile
        return(0)
}
__________________
Carlos Gonzalez CPIM,CSCP

Last edited by cherokee : 7th April 2017 at 21:28.
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
Programming Question mr_suleyman Tools Development 37 11th November 2016 09:14
PDF problem while running session on AFS saumya AFS/DDC/OLE: Function servers 4 2nd August 2013 19:52
Skip device selection Jordi.Tolra Tools Development 7 13th October 2008 10:08
no data within selection when printing sales invoice for the first time tapzhou Distribution, Transportation & Warehousing 1 14th May 2004 18:29
no data within selection when printing picking lists tapzhou Distribution, Transportation & Warehousing 3 26th April 2004 20:58


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


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