Baanboard.com

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

User login

Frontpage Sponsor

Main

Poll
Where is your Baan/LN hardware located?
On Premise
57%
Hosted Data Center
14%
Cloud (Azure/AWS - Not Infor Cloudsuite)
29%
Infor Cloudsuite
0%
Total votes: 7

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 13th June 2019, 16:54
pradeepcr's Avatar
pradeepcr pradeepcr is offline
Member
 
Join Date: Dec 2002
Posts: 32
pradeepcr is on a distinguished road
Baan: BaanIV - DB: Baan - OS: Windows 2000
Call copy item using AFS in Baan IV
Baan: Other/Unknown
C/S: None/Unknown

Hello,
I am trying to call the main session tiitm0101m000 through AFS and then invoke the session tiitm0202s000 using the copy button on the tiitm0101m000 form. I tried stpapi.form.command() but does not work probably because this is Baan IV. Any ideas on how I can achieve this using AFS.

Thanks,
PC
Reply With Quote
  #2  
Old 14th June 2019, 00:34
OmeLuuk's Avatar
OmeLuuk OmeLuuk is offline
Guru
 
Join Date: Mar 2002
Location: The Netherlands
Posts: 1,083
OmeLuuk is on a distinguished road
Baan: Infor LN 6.1 10.2.1 - DB: MS SQL2008 - OS: VM WindowsServer2008R2
I think you're on the right track, but probably with the wrong prerequisites?
Like did you search the record, marked it, perform the form command (if it fails, read the error stack, functional and technical) and tried the AFS_LOG option? What did it teach you?
__________________
Also read Luke 24:4-8
Reply With Quote
  #3  
Old 14th June 2019, 15:52
pradeepcr's Avatar
pradeepcr pradeepcr is offline
Member
 
Join Date: Dec 2002
Posts: 32
pradeepcr is on a distinguished road
Baan: BaanIV - DB: Baan - OS: Windows 2000
stpapi.form.command() is not work in Baan IV. Program script gives a compilation error. AFS guide also clearly says it is only supported in Baan ERP and Ln. It says alternative to that is continue.process() in Baan IV but there is no continue button on tiitm0101m000.

What I am trying to achive - from custom session I need to pass the item code and call maintain item data and from there invoke the copy button which opens tiitm0202s000 to copy the item. All this through AFS.
Reply With Quote
  #4  
Old 17th June 2019, 03:14
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,270
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
When I get to work tomorrow I will look thru my code. I think I did something for this sub-session at one time.
__________________
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 17th June 2019, 14:48
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,270
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Well I can't find any code but in 4c4 you would use stpapi.application.option. I am waiting to get our test server backup. Maybe I only wrote test code. Every since we converted they seem to like to ignore our old baan servers.

Code:
SYNTAX
void stpapi.application.option(string session, long form, long option, ref string err.mesg)
ARGUMENTS
session	Name of the session this command is executed on.
form	Form number on which user option must be executed. User options (the commands on the Special menu) are defined per form.
option	The option number to be executed. User options appear as choice.user.x options in the Baan 4GL code where x is a number that ranges from 0 to 9. The value of x that corresponds to the option that you want to activate is provided as the value of this parameter.
err.mesg	This parameter will contain the text of the error message if the function cannot complete normally
__________________
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
  #6  
Old 17th June 2019, 15:31
pradeepcr's Avatar
pradeepcr pradeepcr is offline
Member
 
Join Date: Dec 2002
Posts: 32
pradeepcr is on a distinguished road
Baan: BaanIV - DB: Baan - OS: Windows 2000
Thanks a lot for checking. stpapi.application.option can only be used for user defined options 0 to 9 in choice.user.o/9 section. It does not support the standard copy option 16(dupl.occur) in this case.
Reply With Quote
  #7  
Old 17th June 2019, 21:45
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,270
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Yep - you are correct. I see a bunch of zoom.to's on the session, but in production I am not seeing any stpapi code.

Have you tried just running the session directly. Maybe setting the tiitm001.item before calling the session. I know on the zoom.to we include copy.item = zoom.to$("tiitm0202s000",z.session,"tiitm001.item", "copy.item",0) where the copy.item is set to tiitm001.item. You might have to change the session type since it will might not let you activate a subsession.

Or another alternative is to create your own calling session. All it would have to do is set the original item and activate tiitm0202s000. I did that for another session - I had to do that so I could control the subsession that it launched automatically.
__________________
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 18th June 2019, 22:20
pradeepcr's Avatar
pradeepcr pradeepcr is offline
Member
 
Join Date: Dec 2002
Posts: 32
pradeepcr is on a distinguished road
Baan: BaanIV - DB: Baan - OS: Windows 2000
Mark, I want that subsession to run automatically for a set of original items without manual intervention. I guess that is not possible with the solutions that you are suggesting.
Reply With Quote
  #9  
Old 19th June 2019, 14:34
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,270
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Not sure I get that. If you create a session to launch the tiitm0202m000 then no manual intervention would be needed. I can show you an example of one I did - so if you run tpptc9820m00c on our system it automatically runs tpptc9110m00c. I could never get control of the tpptc9110m00c session it ran. So I cheated. I created a new session called tpptc9831m000. This session has one input field x and all it does is launch the session I want to use tpptc9110m00c.
Code:
declaration:
	long	child.id
	extern	domain	tcmcs.str1	x
|****************************** PROGRAM     SECTION ***************************
before.program:
	child.id = 0

|****************************** ZOOM FROM   SECTION ***************************
|****************************** FORM	     SECTION ***************************
|****************************** CHOICE      SECTION ***************************
choice.cont.process:
on.choice:
	if(child.id<>0) then
		kill(child.id)
	endif
	child.id=activate("tpptc9110m00c")
	switch.to.process(child.id)
| Cannot use zoom because tpptc9110m00c is waiting for a
| switch.to.process
	execute(end.program)

choice.interrupt:
before.choice:
	execute(end.program)
	
choice.abort.program:
before.choice:
	execute(end.program)

choice.end.program:
before.choice:
	kill(child.id)

So what I am proposing is let say you create a session tiitm9999m000 - 1 input field the item. Then it does the zoom to as I mentioned above. It should all remain in the background. So what you would see if you looked at your process would be your copy session as the parent, then tiitm9999m000 as a child and then tiitm0202s000 as a child of tiitm9999m000. Then you should be able to put the new item and set the text flags. It does not hurt to give it a try. There should be no manual intervention.

And yes 2 days and I am still waiting on our test system to be started. Or maybe fix my user ID so I can putty into the servers.
__________________
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
  #10  
Old 19th June 2019, 18:20
pradeepcr's Avatar
pradeepcr pradeepcr is offline
Member
 
Join Date: Dec 2002
Posts: 32
pradeepcr is on a distinguished road
Baan: BaanIV - DB: Baan - OS: Windows 2000
Thanks Mark.

"Then you should be able to put the new item and set the text flags." How can I pass these values from Activate(tiitm0202s000)?
Reply With Quote
  #11  
Old 19th June 2019, 23:26
pradeepcr's Avatar
pradeepcr pradeepcr is offline
Member
 
Join Date: Dec 2002
Posts: 32
pradeepcr is on a distinguished road
Baan: BaanIV - DB: Baan - OS: Windows 2000
Mark,
This is what I tried. I created a new session with one field 'Item' on it and a 'Continue' button.

On choice.continue:
zoom.to$("tiitm0202s000",z.session,"tiitm001.item", "copy.item",0)

In the copy item range session I call the new session using AFS:

stpapi.put.field("awitm0230m003", "tiitm001.item", strip$(awitm030.item))
stpapi.handle.subproc("awitm0230m003", "tiitm0202s000", "add")
stpapi.zoom.option("awitm0230m003", 1, "tiitm0202s000", error.msg)
stpapi.put.field("tiitm0202s000", "copy.item", strip$(awitm030.part))
stpapi.put.field("tiitm0202s000", "copy.alt.items", str$(etol(tcyesno.no)))
stpapi.put.field("tiitm0202s000", "copy.alt.suppl", str$(etol(tcyesno.no)))
stpapi.put.field("tiitm0202s000", "copy.erela", str$(etol(tcyesno.no)))
stpapi.continue.process("tiitm0202s000", error.msg)
stpapi.end.session("tiitm0202s000")
stpapi.end.session("awitm0230m003")

error.msg on the continue process (in bold) says "Session not available".

Any idea?
Reply With Quote
  #12  
Old 20th June 2019, 13:26
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,270
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
I would try stpapi.continue after these 2 lines like this:
stpapi.put.field("awitm0230m003", "tiitm001.item", strip$(awitm030.item))
stpapi.handle.subproc("awitm0230m003", "tiitm0202s000", "add")
stpapi.continue.process("awitm0230m003", error.msg)

Based on the where you put the zoom to in in the new session - it was in the continue on the new session:
On choice.continue:
zoom.to$("tiitm0202s000",z.session,"tiitm001.item", "copy.item",0)
__________________
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
  #13  
Old 20th June 2019, 15:11
pradeepcr's Avatar
pradeepcr pradeepcr is offline
Member
 
Join Date: Dec 2002
Posts: 32
pradeepcr is on a distinguished road
Baan: BaanIV - DB: Baan - OS: Windows 2000
It works!!! You rock!!!
Reply With Quote
  #14  
Old 20th June 2019, 16:12
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,270
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Well I got the test system back today - finally. What I actually tested was adding it to the zoom menu. I new I had tried something once before. So if I ran tiitm0101m000 and did tools zoom I see copy item.
Code:
function copy_item()
{
	long ret, count
	stpapi.put.field("tppdm0110m000","tiitm001.item", "MYTEST91528")
	ret = stpapi.find("tppdm0110m000")
	stpapi.handle.subproc("tppdm0110m000", "tiitm0202s000", "add")
	stpapi.handle.subproc("tppdm0110m000", "mtiitm000090011", "7")
	stpapi.zoom.option("tppdm0110m000",1,"tiitm0202s000",err)
	stpapi.put.field("tiitm0202s000", "copy.item", "mark345")
	stpapi.enum.answer("tiitm0202s000", "tiitm0101t", tcyesno.yes)
	stpapi.continue.process("tiitm0202s000",err)
	|stpapi.insert("tppdm0110m000",1,err)
	stpapi.end.session("tiitm0202s000")
	if(ret <> 1) then
		message("err")
	endif
	|stpapi.enum.answer("tppdm0110m000", "tiitm01012", tcyesno.yes)	
	|stpapi.delete("tppdm0110m000",1,err)
	message(err)
	stpapi.end.session("tppdm0110m000")
	
}

So another option if needed.
__________________
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
  #15  
Old 21st June 2019, 15:34
pradeepcr's Avatar
pradeepcr pradeepcr is offline
Member
 
Join Date: Dec 2002
Posts: 32
pradeepcr is on a distinguished road
Baan: BaanIV - DB: Baan - OS: Windows 2000
Thanks for sharing the other option.
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
Interview with Jan Baan in an Indian Magazine bamnsour General Discussion & Chat 1 24th September 2007 14:11
Invitation to SSA Global's BaaN User Group Meeting in Bangkok nopadon ไทยฟอรัม 0 12th January 2005 19:25
Urgent help needed in Baan srivatsrs Miscellaneous 0 7th January 2005 15:04
Service module in Baan en@frrom Project & Services 6 12th September 2003 09:48
BSP-US (LLC) added as a Baan Education Alliance svandenh General Discussion & Chat 1 20th August 2001 19:44


All times are GMT +2. The time now is 14:17.


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