anthony peiris
5th January 2011, 23:32
I need to switch the company using switch.to.company(nnn) before Print Sales Order Acknowledgement session.
When I invoke this function through 'ottstpapihand' it tells me that the
switch.to.company() function is not found
How can I change the company while in the session
VishalMistry
6th January 2011, 05:32
Hi,
Try to use function compnr.check() and check if it works.
Vishal
thieuf
6th January 2011, 14:25
Why would you want to switch to company using API?, just program it directly.Make sure the other company is in the same package combination....
regards
anthony peiris
6th January 2011, 15:28
Why would you want to switch to company using API?, just program it directly.Make sure the other company is in the same package combination....
regards
I have following xml input file which is read by the ole automation and execute verbs (commands) with given parameters.
Based on the Salesorder number I need to switch the company (which is supplied as an arg[uement]) to the verb 'switchtocompany' before remainder of the program (xml declarations) could run.
Hope this clarify.
Thanks - Anthony
<?xml version="1.0" encoding="utf-8" ?>
<!-- Primarily deviced to invoke BaaN sessions
Last Modified
-->
<session name ="tdsls4401m000" domain="baan">
<args>
<!-- any of the verbs/verb/arg can be specified as an arg
: target axis are replaced from specified session/args
un specified args are taken from verb/verbs/parametr defaut value
-->
<arg target="/session/verbs/verb[@action='switchtocompany']/parameter[@name='comp']" type ="int" >200</arg>
<arg target="/session/verbs/verb[@action='put']/parameter[@name='orno.f']" type ="string" >141527</arg>
<arg target="/session/verbs/verb[@action='put']/parameter[@name='orno.t']" type ="string" >141527</arg>
<arg target="/session/verbs/verb[@action='put']/parameter[@name='comp.f']" type ="string" >000</arg>
<arg target="/session/verbs/verb[@action='put']/parameter[@name='comp.t']" type ="string" >999</arg>
<arg target="/session/verbs/verb[@action='setreport']/arg[@name='device']" type ="string" >105</arg>
</args>
<verbs>
<verb action="switchtocompany">
<parameter name="comp" debug="true">200</parameter>
</verb>
<verb action="put">
<parameter name="orno.f" debug="true">141527</parameter>
</verb>
<verb action="put">
<parameter name="orno.t">141527</parameter>
</verb>
<verb action="put">
<parameter name="comp.f">000</parameter>
</verb>
<verb action="put">
<parameter name="comp.t">999</parameter>
</verb>
<verb action="put">
<parameter name="prnt.discount" type="int">1</parameter>
</verb>
<verb action="put">
<parameter name="printed" type="int">1</parameter>
</verb>
<verb action="put">
<parameter name="quan.to.print">1</parameter>
</verb>
<verb action="put">
<parameter name="prnt.options">2</parameter>
</verb>
<verb action="put">
<parameter name="prnt.sellpr" type="int">2</parameter>
</verb>
<verb action="put">
<parameter name="num.copies">1</parameter>
</verb>
<verb action="put">
<parameter name="selection" type="int">2</parameter>
</verb>
<verb action="setreport">
<parameter name="reportname">rtdsls440101000</parameter>
<parameter name="device">105</parameter>
</verb>
<verb action="continue"/>
<verb action="endsession" />
</verbs>
</session>
mark_h
6th January 2011, 15:55
I am not sure if there is a library with switch.to.company in it. As a work around you can write your own library in baan to execute the switch.to.company then execute the follow on commands in ottstpapihand.
thieuf
6th January 2011, 17:19
Hy,
I am not to familiar with the ole automation, but you could perhaps try some things:
invoke session ttdsk2003m000 using api command...which is the switch to company from the menu session.
We had a similar challenge once when importing data into baan from an excel file/macro.
We created a session which was "started" from excell but we used 2 different "users" to get the data in the correct company.
If the "seperation trigger" is in the file itself, then perhaps you could "split" the files before import into to 2 different files and use this split to start it up in a different company...
just some ideas. hope it helps...
regards...
Al Smith
9th January 2011, 03:05
switch.to.company is in ottstp_stddll.
C# call:
BaanObj.ParseExecFunction("ottstp_stddll", "switch.to.company(" + 200 + ")");
Al.
anthony peiris
10th January 2011, 16:50
Hi Al,
Thanks a lot for the lead.. I was about to go the way Mark Suggested. Your's will save me creating dll.