Baanboard.com

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

User login

Frontpage Sponsor

Main

Google search


Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
33%
Installation Wizard into new VRC
39%
Manual into existing VRC
6%
Manual into new VRC
22%
Total votes: 49

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 12th November 2001, 11:59
Smiffy's Avatar
Smiffy Smiffy is offline
Member
 
Join Date: Oct 2001
Location: UK
Posts: 64
Smiffy is on a distinguished road
Baan: Baan IV - DB: Baan - Oracle - OS: UNIX
Question stpapi (called session - empty select)

Does anyone know how to handle the following problem.

I have created a session which calls three existing sessions via function server.

The final session is run via stpapi.put commands with the required selection ranges. We have tested the session and the only problem, is when the selection criteria given results in an empty select. Usually the user is given the standard message 'no data within selection' when the called session is run on its own.

How do you cater for this ? I have tried using end() and stop() (within the 'selectempty' section when called by my session), but the program just freezes.

Thanks
Reply With Quote
  #2  
Old 12th November 2001, 15:37
Smiffy's Avatar
Smiffy Smiffy is offline
Member
 
Join Date: Oct 2001
Location: UK
Posts: 64
Smiffy is on a distinguished road
Baan: Baan IV - DB: Baan - Oracle - OS: UNIX
continued...

The third session being called via function server is a report by the way. I have kind of solved my problem, but not in the way that I would like.

My first 2 STPAPI called sessions are run per production order from a list which has been previously compiled to a table. e.g.

select table1.pdno
from table
selectdo
stpapi.calls.for.sess1
endselect

select table1.pdno
from table1
selectdo
stpapi.calls.for.sess2
selectempty
empty.flag = yes
endselect

if empy.flag <> yes then
stpapi.call.for.sess3
else
message("Sorry, selection empty....)
endif

Obviously, this is a simplified example of my code. I also found for some reason I was getting a fatal error telling me that a transaction was still open, when I tried quitting the session. This was overcome by using the abort.transaction command after the message.

I would still like to know if there is a way to handle a 'selectempty' of a report, when it is called via STPAPI methodology. Has anyone come across a similar problem ?


Thanks

P.S. I have discovered quite a bit to do with handling printing when using STPAPI calls, so if anyone has any difficulty with this, I might be able to help.
Reply With Quote
  #3  
Old 12th November 2001, 20:56
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,095
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
err = stpapi.get.mess.code("baan session")

Could you use the get.mess code to get the last message from a session? I had to use this with the manual transfer session. The manual transfer session would not return an error, but a warning. So my stpapi.continue always looked like it worked , but it really did not. So I had to start checking for messages. Have not tried this on one of my reporting FS's yet.

I have also had problems with the stpapi.set.report command. In some of the baan sessions they do report.open(I think- can not remember the actual command) and not rprt_open. When they used the report.open command I could not select any report other that the first. This happened in two sessions. We do not own source, so I worked around it.


Mark
Reply With Quote
  #4  
Old 13th November 2001, 10:11
Smiffy's Avatar
Smiffy Smiffy is offline
Member
 
Join Date: Oct 2001
Location: UK
Posts: 64
Smiffy is on a distinguished road
Baan: Baan IV - DB: Baan - Oracle - OS: UNIX
open.report

I think you are referring to the function open.report, which is contained in the baan standard function 'tccom0010’. I have access to source code where I work. Unfortunately, this means my solution isn't of much use to yourself at the moment.

My solution involves allowing the user to define the printer once in the new controlling sessions script. This is done using the spool.open command (last parameter = 1, allowing the user to define the device at runtime). The spool is immediately closed with spool.close.

In the called reports (session scripts), the api.mode has to be temporarily set to false before the execute(print.data) command. After the command it shoudl be set back to its previous value (if called by the new controlling session).

Wherever a spool.open command exists, a conditional statement should be added ; if called by your new controlling session then the spool.open commands last parameter should be zero; otherwise it should be as the original statement. Setting the last parameter to zero, set the device to the previous value given (spool.device)

However, some reports use report.open, this means changing the tccom0010 function in a similar way. The statement which called the function brp.open.language’ had to be made conditional in the same way as spool.open was previously. The device also had to be imported into the script. The device is called 'sp.device' in this functions script.

I hope this information proves useful to you in the future or anyone else that may require it. Obviously, I found the solution to my problem with quite a lot of trial and error and there may be a better way (but I don't know it).


Thanks


Smiffy
Reply With Quote
  #5  
Old 13th November 2001, 14:43
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,095
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Question and statement

The question is would the stpapi.get.mess.code return the "No data" error for the reports? Just wondering if this would work instead of the empty flag.

Without the source I have had always had to use the trial and error method. Nothing is never as it seems. The only ones that run the way I expect them to are the FS's I do on sessions developed for the company. You solution is a good one for those that have source code. Sigh.


Good Luck!

Mark
Reply With Quote
  #6  
Old 14th November 2001, 13:24
p.cole's Avatar
p.cole p.cole is offline
Senior Member
 
Join Date: Nov 2001
Location: Portsmouth, UK
Posts: 265
p.cole is on a distinguished road
Baan: Baan IVc4 SP20, ERP LN FP3 - DB: MSSQL 2005 - OS: W2K3
Re: Question and statement

Quote:
Originally posted by mark_h
The question is would the stpapi.get.mess.code return the "No data" error for the reports? Just wondering if this would work instead of the empty flag.
It works for me: using stpapi.get.mess.code() gives the message code tccoms0024 "No data found for report, no report is printed" after calling stpapi.print.report() for no data

Phil
Reply With Quote
  #7  
Old 15th November 2001, 12:55
Smiffy's Avatar
Smiffy Smiffy is offline
Member
 
Join Date: Oct 2001
Location: UK
Posts: 64
Smiffy is on a distinguished road
Baan: Baan IV - DB: Baan - Oracle - OS: UNIX
get.mess.code

Thanks for your reply.

Stpapi.get.mess.code doesn't work for me. Does this function only work after using stpapi.print.report ? I do not use stpapi.print.report in my code.

Do you have access to any documentation of stpapi commands? The only document I have is not very detailed. As I said earlier, my solution works but may not be the only solution or the best solution.

thanks
Reply With Quote
Sponsored Links
  #8  
Old 15th November 2001, 15:14
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,095
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Another thread

I attached all the documentation I have on the stpapi commands in another thread. It is probably stuff you have already seen, but I just thought I would mention it. And since I am using netscape and do not know how to embed links here is the thread:

http://www.baanboard.com/baanboard/s...=&threadid=286

I use the stpapi.mess.code on my manual transfer FS. For some reason that session does not return an error when the continue takes place and there is something wrong with the transfer data. When running by hand you get warnings. So in the FS after the continue I do a get stpapi.mess.code to see if there was a message. So you can use this function in other places. I have not tried it in any of my reporting FS's yet.


Mark
Reply With Quote
  #9  
Old 16th November 2001, 01:02
p.cole's Avatar
p.cole p.cole is offline
Senior Member
 
Join Date: Nov 2001
Location: Portsmouth, UK
Posts: 265
p.cole is on a distinguished road
Baan: Baan IVc4 SP20, ERP LN FP3 - DB: MSSQL 2005 - OS: W2K3
Re: get.mess.code

Quote:
Originally posted by Smiffy
Stpapi.get.mess.code doesn't work for me. Does this function only work after using stpapi.print.report ? I do not use stpapi.print.report in my code.
Yes. In the instance I tested I needed to call stpapi.print.report to get stpapi.get.mess.code to return an error code.
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
synchronizing different occurrences on parent session from child Ruskin Tools Development 8 18th March 2008 17:56
Problem when invoking a session from another manusatsangi Tools Development 9 18th August 2003 13:40
stpapi call to select an option from menu achautha AFS/DDC/OLE: Function servers 2 15th April 2003 09:28
tfacp9450m000 FIBU Brush Up Kai's Forum Users Deutsches Forum 1 16th November 1999 00:00


All times are GMT +2. The time now is 08:07.


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