Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

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
23%
Total votes: 77

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 11th January 2017, 07:46
sachinbaan's Avatar
sachinbaan sachinbaan is offline
Senior Member
 
Join Date: Oct 2013
Posts: 173
sachinbaan is on a distinguished road
Baan: ERP LN - DB: MS SQL - OS: Microsoft Server
Execute Job From Session
Baan: Other/Unknown
C/S: None/Unknown

Hello,

Can i execute job from my 4gl program?

On the click of button i want to execute job.
__________________
Regards,
Sachin

TO DREAM THE PERSON U WOULD LIKE 2 B, IS 2 WASTE THE PERSON U R.
Reply With Quote
  #2  
Old 11th January 2017, 11:17
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,381
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,

What have you tried? Check this thread for a way. Another way you can try is through AFS. Also, if on windows, you can create a task scheduler for the required job and then execute the task scheduler through your 4GL script.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #3  
Old 11th January 2017, 13:11
sachinbaan's Avatar
sachinbaan sachinbaan is offline
Senior Member
 
Join Date: Oct 2013
Posts: 173
sachinbaan is on a distinguished road
Baan: ERP LN - DB: MS SQL - OS: Microsoft Server
Hello,

My requirement is to merge three files in to one, i have one ".exe" which merges all 3 files in one file, i.e, 3 excel file in to 1 excel file (3 tabs).

I used app_start() which executed on BECS, but i want to execute same on LN UI.

I tried different functions like, run.prog(), but it is not working.

So if i run the session using job, there won't be any LN UI specific problem.

I wrote AFS but at the end of the program, the session which gets open using AFS is not closing hence, AFS is also not working, please check if there is anything wrong in AFS, I have attached code.
Attached Files
File Type: txt afs.txt (1.2 KB, 54 views)
__________________
Regards,
Sachin

TO DREAM THE PERSON U WOULD LIKE 2 B, IS 2 WASTE THE PERSON U R.
Reply With Quote
  #4  
Old 12th January 2017, 18:47
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,371
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
My question is - if "on a click of a button" it executes a job - why does it have to be a job? Why not let them click a button and it calls a library, a session or something else to combine the 3 files. I think that might have been where Bhushan was going with the AFS, but I could be wrong. I have not written any AFS code to run jobs - so not much help with that.
__________________
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 12th January 2017, 20:32
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,381
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
I am not sure, but a shot in a dark would be - it's a permission issue.

Few questions -

1. Are you on Windows Server?
2. How did you use run.prog()?
3. Is the .exe executable to the everyone/all users?

You can try passing the output to an error file and see if you can catching anything there. Calling an external utility through Baan/LN has always been more of a trial and error thing. It all depends on the implementation of the external utility.
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote
  #6  
Old 13th January 2017, 06:13
sachinbaan's Avatar
sachinbaan sachinbaan is offline
Senior Member
 
Join Date: Oct 2013
Posts: 173
sachinbaan is on a distinguished road
Baan: ERP LN - DB: MS SQL - OS: Microsoft Server
Hello,

@mark: i want to execute ".exe" which is working fine from BECS, but requirement is to execute same thing from LN UI and i am not getting any LN UI specific function to execute ".exe", so if i do it using job there will be no question of LN UI.

@Bhushan:

1. Yes i am on windows server
2. run.prog() : i have created a bat file and same path is been passed to the function, if same function i execute on BECS it executes properly, but on LN UI it gives return value as 0 (Success) but nothing is happening to the files.
3. Yes, .exe is executable to every user.
__________________
Regards,
Sachin

TO DREAM THE PERSON U WOULD LIKE 2 B, IS 2 WASTE THE PERSON U R.
Reply With Quote
  #7  
Old 16th January 2017, 16:03
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,371
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
I was looking at the AFS code - on you baan version can you actually execute thru ttaad5500m000? I know on my 4c4 session I would actually go straight to ttaad5203m000 and execute it there. So my code would look something like below - what I am not sure of is after the continue I would have to wait for it to complete. I know at times for my afs code I have to use suspend to get my code to pause to give the session I called time to complete cleanly. Also I could not use the exec command for continue, but just copied your code.

Code:
function extern tccom.runjob.execute.job(domain	tcmcs.str32 i.job)
{
	i.main.session = ""ttaad5203m000"

	stpapi.put.field(i.main.session, "ttaad500.cjob", i.job)

	o.return.value = stpapi.find(i.main.session, o.error.message)

	if o.return.value = 1 then
			stpapi.form.command(i.sub.session,  5, "exec.cont.process", o.error.message)
	endif
	stpapi.end.session(i.main.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
  #8  
Old 9th May 2019, 08:31
saumya's Avatar
saumya saumya is offline
Member
 
Join Date: Feb 2008
Posts: 88
saumya is on a distinguished road
Baan: Infor LN, ION - DB: Oracle - OS: unix
AFS to execute Job

Hi,

I have written below afs code to execute job through session:

stpapi.put.field("ttaad5203m000", "ttaad500.cjob", f.job2)

ret = stpapi.find("ttaad5203m000", error)

if ret = 1 then
stpapi.form.command("ttaad5203m000", 5, "exec.cont.process", error)
endif
stpapi.end.session("ttaad5203m000")

This code will execute session linked to job, but it goes to before.program/field section, but not going to continue option. Please Help?
__________________
The world is a tragedy to those who feel,
but a comedy to those who think.
Reply With Quote
  #9  
Old 9th May 2019, 11:24
BChary's Avatar
BChary BChary is offline
Junior Member
 
Join Date: Apr 2016
Location: Poland
Posts: 17
BChary is on a distinguished road
Baan: Infor LN 10.4/10.5 - DB: SQL Server - OS: W10
I'm not a expert but you should try replace "exec.cont.process" to "cont.process".
Reply With Quote
Sponsored Links
  #10  
Old 9th May 2019, 15:00
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,371
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Some of the examples I have seen have with the stpapi.form command use exec.cont.process in them - like this one stpapi.form.command( "tfacp1110s000", 5, "exec.cont.process", error ). My question is what do you mean it goes to before.program/field section section. Is this code in another session? so when you debug this code what is happening on each statement?
__________________
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
  #11  
Old 10th May 2019, 08:14
saumya's Avatar
saumya saumya is offline
Member
 
Join Date: Feb 2008
Posts: 88
saumya is on a distinguished road
Baan: Infor LN, ION - DB: Oracle - OS: unix
Yes, Linked session is getting invoked.But it doesnt process anything there. When I debug control will go before.program section, field section(in case they exists), but doesnt go to execute processing which can be print or continue option. control will return and AFS will be hanged doing nothing. When we manually execute job, it will go to before.program, field section then will go to print/continue option.
__________________
The world is a tragedy to those who feel,
but a comedy to those who think.
Reply With Quote
  #12  
Old 10th May 2019, 08:56
saumya's Avatar
saumya saumya is offline
Member
 
Join Date: Feb 2008
Posts: 88
saumya is on a distinguished road
Baan: Infor LN, ION - DB: Oracle - OS: unix
replacing "exec.cont.process" to "cont.process" not making any good. Its same for both.
__________________
The world is a tragedy to those who feel,
but a comedy to those who think.
Reply With Quote
  #13  
Old 10th May 2019, 10:11
tmannais's Avatar
tmannais tmannais is offline
Senior Member
 
Join Date: Jul 2017
Location: Thailand, Bangkok
Posts: 215
tmannais is on a distinguished road
Baan: LN 10.5, 10.6, 10.7 - DB: MSSQL - OS: Windows
Check if your session has any messages while in the process. While doing AFS, you need to handle every message that pops up along the way properly, otherwise the program will hang. That might be the reason for why your AFS is hanging. Another reason may be that your
Code:
ret = stpapi.find("ttaad5203m000", error)
returns something that is not 1 so the condition for executing the command is not met.
Reply With Quote
  #14  
Old 10th May 2019, 12:31
BChary's Avatar
BChary BChary is offline
Junior Member
 
Join Date: Apr 2016
Location: Poland
Posts: 17
BChary is on a distinguished road
Baan: Infor LN 10.4/10.5 - DB: SQL Server - OS: W10
I found this command in afs documentation(http://www.baanboard.com/baanboard/s...ead.php?t=7251 first post)
Code:
stpapi.continue.process("ttaad5203m000", error)
try use it as a replacement for stpapi.form.command("ttaad5203m000", 5, "exec.cont.process", error)
Reply With Quote
  #15  
Old 13th May 2019, 08:39
saumya's Avatar
saumya saumya is offline
Member
 
Join Date: Feb 2008
Posts: 88
saumya is on a distinguished road
Baan: Infor LN, ION - DB: Oracle - OS: unix
I try to use command stpapi.continue.process("ttaad5203m000", error), its giving command disable message.


stpapi.form.command("ttaad5203m000", 5, "exec.cont.process", error), this is not returning any error.

I have created a dummy session, which doesnt have any message or field validation.
__________________
The world is a tragedy to those who feel,
but a comedy to those who think.
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
Handling Unit functionality baazigar Distribution, Transportation & Warehousing 4 19th February 2012 16:54
DEM - Can a normal user be authorized for 'Execute SQL Query' session? syarragu DEM & Workflow 4 8th September 2010 15:21
synchronizing different occurrences on parent session from child Ruskin Tools Development 8 18th March 2008 18:56
Session will not run as a job pjohns Tools Administration & Installation 9 17th January 2003 14:10
Fully automated session and job mgmt Paul P Tools Administration & Installation 2 20th December 2002 14:34


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


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