Baanboard.com

Go Back   Baanboard.com > Forum > Baan SIGs > Code & Utilities

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 10th September 2004, 02:31
trchandra trchandra is offline
Member
 
Join Date: Sep 2001
Location: Orange County
Posts: 99
trchandra is on a distinguished road
Baan: 5.0b - DB: Oracle 8i - OS: HP-UX 11.0
History of run programs

Ever since I started working for baan, I always wanted to have history of run program (ttdsk2080m000) commands so that I can easily select instead of remembering and typing everytime. When I was working for Baan Company, I put a enhancement request to the tools department but it did not happen all these years. One of my friends told me that it is available from Reger 5.2 series onwards. I think this feature is already available on latest worktops.

While I was browsing through UI Objects, I thought why I can't create a similar session like ttdsk2080m000 to run any standard session with provision to run a command from history. I used create.object() function to create a dropdown listbox with command history. I thought this program may be useful for developers and super users who use 'Run Program' more often. Here is the list of screen shot and if anyone is interested I can post the code as well.
Attached Images
File Type: gif runprogram.gif (4.2 KB, 387 views)
__________________
ravi

Last edited by ~Vamsi : 10th September 2004 at 06:16.
Reply With Quote
  #2  
Old 10th September 2004, 06:14
~Vamsi's Avatar
~Vamsi ~Vamsi is offline
Guru
 
Join Date: Aug 2001
Location: San Diego CA, USA
Posts: 590
~Vamsi will become famous soon enough
Baan: ~*~ - DB: ~*~ - OS: ~*~
By definition of this forum - all posts have to have code attached. You may be able to optimize your code by using a tools function that does listboxes, instead of using create.object.

Please post the code with the appropriate license.
__________________
~Vamsi
Vamsi Potluru
Baan XL Yet another tool to format Baan output in Excel from Baan Board
This one just happens to be free :)

Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #3  
Old 10th September 2004, 17:09
trchandra trchandra is offline
Member
 
Join Date: Sep 2001
Location: Orange County
Posts: 99
trchandra is on a distinguished road
Baan: 5.0b - DB: Oracle 8i - OS: HP-UX 11.0
Here is the code

Code:
|******************************************************************************
|* Title	: Run Program Proxy
|* Author	: Ravi Tiruvaipati
|* Date		: 09/09/2004
|******************************************************************************
|* Script Type	: 4GL
|* Description	: 
|* License	:
|* Copyright 2004 by Ravi Tiruvaipati
|* 
|* All Rights Reserved 
|* 
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation. 
|* 
|* Ravi Tiruvaipati and Baanboard.com DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL Ravi Tiruvaipati nor Baanboard.com BE LIABLE FOR ANY
|* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|******************************************************************************
|****************************** DECLARATION SECTION ***************************
declaration:
      table    tttadv111
      table    tttaad121

      extern   domain   tcmcs.str30 prog.name

      string   history(30,30)

      string   err.mess(80)
      string   pacc(20)
      long     isObject
      domain   ttadv.cpac  cpac
      domain   ttadv.vers  vers
      domain   ttadv.rele  rele
      domain   ttadv.cust  cust
      domain   ttadv.cmod  cmod
      domain   ttadv.cprs  cprs
      long     depth
      long     listbox
      long     ret
      long     fp
      string   history.file(80)
      string   command(30)
      string   list.items(4096)
      string   temp.items(4096)
      long     list.length
      long     sel.item
      long     strlen
      long     placeholders(900)
      long     nohistory

#pragma used dll ottdllvrcsearch
|****************************** PROGRAM     SECTION ***************************
|****************************** ZOOM FROM   SECTION ***************************
|****************************** FORM	     SECTION ***************************
form.1:
init.form:
   history.file = bse.tmp.dir$() & "/" & logname$ & ".history"
   create.history.list()

|****************************** CHOICE      SECTION ***************************
choice.cont.process:
on.choice:
   if not nohistory and get.object(listbox,DsNselectedId,sel.item) and
      sel.item > 0 then
      prog.name = strip$(history(1,sel.item))
   endif
   run.the.process()
|****************************** MAIN TABLE  SECTION ***************************
|****************************** FUNCTION    SECTION ***************************
functions:

function void run.the.process(){
   pacc = curr.pacc$
   if prog.name(1;1) = "o" then
      isObject = true
      cpac = prog.name(2;2)
      cmod = prog.name(4;3)
      cprs = strip$(prog.name(7))
   else
      isObject = false
      cpac = prog.name(1;2)
      cmod = prog.name(3;3)
      cprs = strip$(prog.name(6))
   endif
   select   ttaad121.*
   from     ttaad121
   where    ttaad121._index1 = {:pacc, :cpac}
   and      ttaad121._compnr = 0
   as set with 1 rows
   selectdo
   endselect
   vers = ttaad121.vers
   rele = ttaad121.rele
   cust = ttaad121.cust
   select   ttadv111.*
   from     ttadv111
   where    ttadv111._index1 = {:cpac,:vers,:rele,:cust}
   and      ttadv111._compnr = 0
   as set with 1 rows
   selectdo
   if isObject then
      depth = vrc_search_object(cpac,    |to get right VRC for object lookup
         cmod,
         cprs,
         ttadv111.tdep,
         ttadv111.tver,
         ttadv111.trel,
         ttadv111.tcus)
   else
      depth = vrc_search_session(
          cpac,
          cmod,
          cprs,
          ttadv111.tdep,
          ttadv111.tver,
          ttadv111.trel,
          ttadv111.tcus)
   endif
   endselect
   if prog.name = "ttaad4500" or
      prog.name = "ttaad4100" then
      activate(prog.name)
      add.to.history()
      kill(pid)
   else
      if depth > 0 then
         activate(prog.name)
         add.to.history()
         end()
      else
         message(prog.name & " not found!")
      endif
   endif
}

function add.to.history(){
   long  fp1
   string   temp.file(80)
   string   temp(80)

   temp = strip$(prog.name)
   if component.exists.in.history(temp) then
      return
   endif
   temp.file = creat.tmp.file$(bse.tmp.dir$())
   fp1 = seq.open(temp.file,"w")
   seq.puts(prog.name,fp1)
   seq.flush(fp1)
   fp = seq.open(history.file,"r")
   while not seq.gets(command,30,fp)
      seq.puts(command,fp1)
   endwhile
   seq.close(fp)
   seq.flush(fp1)
   seq.close(fp1)
   ret = file.cp(temp.file,history.file)
   ret = file.rm(temp.file)
}

function long  component.exists.in.history(string comp(80)){
   long i
   string temp1(80)
   for i = 1 to list.length
      temp1 = strip$(history(1,i))
      if comp = temp1 then
         return(true)
      endif
   endfor
   return(false)
}

function create.history.list(){
   long     gwin
   long     rowcol
   long     index
   long     done
   long     _pos
   long     index1
   long     obj.label
   |125
   fp = seq.open(history.file,"r")
   if (fp < 0) then
      nohistory = true
      return
   endif
   nohistory = false
   gwin = create.object(DsCgwindow, current.mwindow(),
                        DsNbackground,    rgb(192, 192, 192),
                        DsNx,             0,
                        DsNy,             30,
                        DsNwidth,         250,
                        DsNheight,        40)
   rowcol = create.object(DsCrowColumn,   gwin,
                            DsNvspace,    10,
                            DsNhspace,    18,
                            DsNnumColumns,2,
                            DsNfixedDimension, DSHORIZONTAL )
   obj.label = create.object(DsClabel,  rowcol,
                            DsNstring, "Select from History   " )
   index = 0
   list.items = ""
   done = false
   while not done
      ret = seq.gets(command,30,fp)
      index = index+1
      if(index > 30 or ret < 0) then
         done = true
         seq.close(fp)
      else
         history(1,index) = strip$(command)
         list.items = list.items & strip$(command) & "-" & str$(index) & "-"
      endif
   endwhile
   list.length = index
   |list.items = list.items(1;len(list.items)-1)
   strlen = len(list.items)
   done = false
   _pos = 0
   index = 0
   while not done
      _pos = _pos + 1
      if _pos < len(list.items) then
         if list.items(_pos;1) = "-" then
            index = index + 1
            placeholders(index) = _pos
         endif
      else
         done = true
      endif
   endwhile
   for index1 = 1 to index
      store.byte(0,list.items(placeholders(index1)))
   endfor
|    message(list.items)
|    message(str$(len(list.items)))
   listbox = create.object(DsCdDListBox, rowcol,
                            DsNminWidth,      50,
                            DsNminWindowSize, 1,
                            DsNmaxWindowSize, 100,
                            DsNx,             10,
                            DsNy,             45,
                            DsNstringArray,   list.items, strlen,
                            DsNselectedId,    sel.item)
   update.object(gwin)
}
__________________
ravi

Last edited by ~Vamsi : 27th October 2004 at 01:18.
Reply With Quote
  #4  
Old 15th October 2004, 07:13
skoka123 skoka123 is offline
Newbie
 
Join Date: Mar 2004
Posts: 2
skoka123 is on a distinguished road
Baan: 4c - DB: Oracle 8 - OS: HP-UX
Hi Ravi,

Nice utility.

In case you are wondering, I am Srikanth Koka (Baan, Hyd)??? You can reach me at skoka123@yahoo.com
Reply With Quote
  #5  
Old 21st December 2004, 16:15
en@frrom en@frrom is offline
Guru
 
Join Date: Aug 2003
Location: Belgium
Posts: 1,219
en@frrom will become famous soon enough
Baan: B50B - DB: Oracle 8.0 - OS: Win2k AS
Hello Ravi,

Interesting utility!! How do I get it running? What session do I create? What form? Only one field "prog.name" on the form?

Thanks in advance,

En
Reply With Quote
  #6  
Old 21st December 2004, 18:24
trchandra trchandra is offline
Member
 
Join Date: Sep 2001
Location: Orange County
Posts: 99
trchandra is on a distinguished road
Baan: 5.0b - DB: Oracle 8i - OS: HP-UX 11.0
simple session

Hi En,
All you have to do is create a simple 4GL session with a form and keep a field called prog.name on the form. Copy the attached program script as script for the session and you should be ready to run the session!

regards
__________________
ravi
Reply With Quote
  #7  
Old 22nd December 2004, 09:40
en@frrom en@frrom is offline
Guru
 
Join Date: Aug 2003
Location: Belgium
Posts: 1,219
en@frrom will become famous soon enough
Baan: B50B - DB: Oracle 8.0 - OS: Win2k AS
Hey Ravi,

I tried this, but get an error when starting the session: ttstps0168. This error does not even exist in our version -> Baan 5.0B.

Any idea why?
Thanks!!

En.
Reply With Quote
  #8  
Old 22nd December 2004, 10:42
en@frrom en@frrom is offline
Guru
 
Join Date: Aug 2003
Location: Belgium
Posts: 1,219
en@frrom will become famous soon enough
Baan: B50B - DB: Oracle 8.0 - OS: Win2k AS
False alarm, the error occured because I declared the session/form as without main table, yet the script accidently was type 1,2,3 -> with main table.

I quickly ran the session. The session works only for non Tools sessions (and ttaad4100/ttaad4500). I made the necessary adjustments to get it running also for Tools sessions.

If anyone is interested, I can post the adjusted code.


Regards,

En.
Reply With Quote
  #9  
Old 6th August 2005, 13:30
veyant veyant is offline
Senior Member
 
Join Date: May 2003
Location: Gurgaon
Posts: 107
veyant is on a distinguished road
Baan: Baan IV/V - DB: Oracle - OS: Unix/AIX
failed in running this utility

Hi,

while testing this new run program utility, i am facing followingf error " Table doesn't exist (eror506) can't continue in ttdllvrcsreach.

it fails while executing following code

depth = vrc_search_session

thanks
Sandy
__________________
veyant
Reply With Quote
  #10  
Old 6th August 2005, 14:08
Viplov's Avatar
Viplov Viplov is offline
Senior Member
 
Join Date: Dec 2004
Location: Delhi
Posts: 201
Viplov is on a distinguished road
Baan: Baan IV c4 - DB: oracle - OS: Unix,Solaris & windows
Nice utility. Can reduce time for opening sessions
Reply With Quote
  #11  
Old 6th August 2005, 21:24
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,028
NPRao will become famous soon enough
Baan: iBaanERP-5.2a(Reger),SSA-ERP-LN-6.1,Infor LN-10.x - DB: Oracle-10g,11g,12c,MS-SQL - OS: HP-UX, Linux, Windows
Quote:
while testing this new run program utility, i am facing followingf error " Table doesn't exist (eror506) can't continue in ttdllvrcsreach.
it fails while executing following code
depth = vrc_search_session
This is solved by switching to company 000 and switching back to the original company before/after the function calls - vrc_search_object(), vrc_search_session().

add few more statements -
Code:
long	curr.comp
curr.comp = get.compnr()
e = switch.to.company(000) 
depth = vrc_search_session() or vrc_search_object()
....
e = switch.to.company(curr.comp)
This is a very good utility for BW interface. The Run Program History is provided in Worktop and also short cuts to the sessions or table records.
En,

Please post the changes for others benefit.

There is a alternative function set.enum.array.for.field() for create.object(DsCdDListBox...)
__________________
The art of perfection does not lie in doing extraordinary things but, doing ordinary things extraordinarily well. [-N. Prashanth Rao]
How To Ask Questions The Smart Way,BaaNBoard,NPRao
Reply With Quote
  #12  
Old 9th August 2005, 06:44
manojsharma's Avatar
manojsharma manojsharma is offline
Senior Member
 
Join Date: Sep 2002
Location: Delhi
Posts: 200
manojsharma is on a distinguished road
Baan: 4C4, 5, Baan LN - DB: Oracle,informix - OS: Unix, NT, Windows-2000
Hi trchandra,

Will it work for BaaN - IV. It is giving error dsnminwindowsize & dsnstringarray not declarated
__________________
Together we can and we will make a difference
Reply With Quote
  #13  
Old 9th August 2005, 17:51
trchandra trchandra is offline
Member
 
Join Date: Sep 2001
Location: Orange County
Posts: 99
trchandra is on a distinguished road
Baan: 5.0b - DB: Oracle 8i - OS: HP-UX 11.0
Hi Manoj,
I guess it may not work on Baan IV because of the GUI framework. You may have to modify those create.object() functions and parameters to suit Baan IV environment. I will port this program on Baan IV and let u know if it works.

Regards
__________________
ravi
Reply With Quote
  #14  
Old 17th November 2005, 20:15
dstegink's Avatar
dstegink dstegink is offline
Junior Member
 
Join Date: Sep 2002
Location: Michigan, USA
Posts: 18
dstegink is on a distinguished road
Baan: LN , 5.0c, IV - DB: SQL Oracle - OS: Windows, Sun OS
Worktop also provides this

FYI - Worktop provides this capability in a dropdown list.
Reply With Quote
Sponsored Links
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 Off
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic Run Number in Receipts justout Distribution, Transportation & Warehousing 0 21st April 2003 12:20
Where's the setting? (run external command) Mick Andrus Tools Administration & Installation 1 27th November 2002 10:37
Job gives run time error. ajitdon Tools Administration & Installation 1 31st October 2002 08:34


All times are GMT +2. The time now is 19:46.


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