mkurniadi
5th October 2010, 03:05
Hi mark,
I have been using and managing Baan server for quite some time now for my company. Now that the sales processes are increasing, we need some kind of automation over Baan. I have read the forums and i couldn't find anything like the problem that i encountered.
The manual (human operated) Baan sales order is done by opening the sales order session tdsls4101m000 and then continue to subsession tdsls4105s000 of sales order lines. Upon entering each item into this session, when we click the save button, a subsession tdilc4102s000 appears. This subsession also can be open from the zoom menu, Maintain Deliveries (ILC).
This session shows by default tdilc401.koor as Sales Order, tdilc401.orno as the sales order number from the parent session, and tdilc401.pono as the number of the line from parent session. However, when i tried to do it using AFS, i couldn't get the sales order number from tdilc401.orno. I got it empty and it took quite a while to complete stpapi.get.field. Shouldn't it be there just like when we do it manually?
For clearness, ill include my code (I'm using the ottstpapihand library). The code is taken from the opening of the sales order line:
stpapi.handle.subproc("tdsls4101m000","tdsls4105s000","add")
stpapi.continue.process("tdsls4101m000",err.msg)
stpapi.put.field("tdsls4105s000", "tdsls041.item", "100-001")
stpapi.put.field("tdsls4105s000", "tdsls041.oqua", "2")
stpapi.put.field("tdsls4105s000", "tdsls041.pric", "20")
stpapi.insert("tdsls4105s000", 1,err.msg)
stpapi.handle.subproc("tdsls4105s000", "tdilc4102s000", "add")
stpapi.zoom.option( "tdsls4105s000",2,"tdilc4102s000",error.msg)
--there i put 2 as the form number since i had to open 2 sessions beforehand
stpapi.get.field("tdilc4102s000", "tdilc401.orno", value)
The value always returns empty. I wonder if i have put the wrong form number there? How do we determine the form number anyway? The number of open sessions before we can open this subsession? Do we have to do stpapi.find first? Is there any other workaround?
Thank you. Any help would be greatly appreciated.
Regards,
Michael.
mark_h
5th October 2010, 15:37
(1) On the insert are you sure tdilc4102s000 is not running in the back ground? Move the stpapi.handle.suproc to in front of the insert. Then in debug mode once the insert command is executed look at the processes you have running. Not sure if you know how to do this - on option dialog box, click start shell, then do PS. I want to confirm the insert is not really starting the tdilc subsession.
Now something to try if the above does not work - try using maybe the stpapi.save command after the insert. Sometimes that initiates subsessions. If that does not work - then try stpapi.update, followed by stpapi.save. At times you just have to play with them to get the code to work.
(2) On the stpapi.zoom option - on tdsls4105s000 which form do you initiate the zoom from when doing it manually? My suspicion is form 1. The form number is for the current active session - on which form do you zoom from. That might work.
Also I did not search the forum for tdsls4101m000 or tdsls4105s000 - there might be a solution for this already posted some where.
mkurniadi
6th October 2010, 08:05
Hi Mark,
Thanks for your reply.
But i have strange problem, no matter what i did, i didn't see the tdilc4102s000 on the shell. I tried using update and save and pretty much everything that you suggested. No new session was initialized. I also tried to put number 1, 2 ,3 and even 10 on the zoom, but it seems like the zoom didn't work. Can we somehow determine the number to put in the zoom from the shell?
With manual operation however, i saw tdsls4504s000 also opened. But i can't see its window. Do i need to open it first to be able to open the tdilc4102s000? What would be the zoom number?
I have tried to search in the forum, but apparently nobody has the same problem as me.
Thanks,
Michael.
mark_h
6th October 2010, 16:02
Do you own source code? It would make it easier to debug.
For the zoom command it is the form number of the session where the zoom will be executed. Is this session directly on the zoom menu? Even though we do not use these modules I do not see it on the zoom menu. The session needs to be directly on the zoom menu. I know in one case I put the session directly on the menu. If you have to click on zoom, then pick from a menu - that is a whole other ball game, something I have never done.
I also noticed that on our tdsls4105s000 session some of the choices off the special menu were actually defined as choice.user.x options which would be a different command. Is this session defined on there?
mkurniadi
7th October 2010, 08:38
Hi Mark,
Unfortunately we dont have the source code.
The zoom menu is a submenu of Special menu on the menubar of the tdsls4105s000. And this submenu has a list of sessions. The Maintain Deliveries (ILC) appears as the 10th item on the list. And according to this, the zoom number should be 2, isn't it? Because the first is the tdsls4101m000, and the second is the tdsls4105s000. What are CWIN and MWIN numbers on the shell anyway?
With manual, we dont have to click zoom. We just enter the item number and the price and so on, then when we click save button, the tdilc4102s000 session just appears out of nowhere. Why didn't the tdilc4102s000 get invoked when i did stpapi.insert or stpapi.update? We even added the stpapi.save to make sure. This is quite strange. Did we miss something? Or is it just not available using ole connection?
I couldn't find the choice.user.x under special menu like you said.
I really want to give you screenshots, but i dont know how to post the images.
mark_h
7th October 2010, 15:43
I just thought of something - can you use tdsls4105m000 instead of 4105s000? Using the main session versus a subsession might work. You would create the header with tdsls4101m000 - close it up, launch tdsls4105m000 then try inserting. Having the code would make this easier. It would allow you to see what was keeping the automatic zoom from working - it could be anything from a "if api.mode" to boi variable(used for some modules) that is preventing the session from working correctly in the api mode.
Also - have you tried a stpapi.update("tdsls4105s000, 0, error) followed by a stpapi.save("tdsls45105s000",error)? That worked for me once, doubt it will work here - just thought I would mention it.
Also are you on the current version of the session and stpapi libraries?
See my attachment. If you look at what we have under special - you see three sessions and a zoom. The first three are actually choice.user.x sessions. Then the last choice is zoom. What I did before was to move the session directly to the special menu so I did not have to zoom to a menu and pick a session. Doing this allowed the stpapi.zoom command to work. I know there is code on the board for a zoom to a menu, but this was for an automatic menu(I think). I will look for it.
Adding attachments is easy just click on go advanced. Then below is a manage attachments - click on that. Then browse - find your image(or attachment) and click on upload. Not sure what the size limit is.
mark_h
7th October 2010, 15:55
Hmmm - this thread (http://www.baanboard.com/baanboard/showthread.php?t=54578&highlight=tdsls4105s000) mentions having to set a boi variable. I have no clue what that might be without source code.
Then you can read this thread (http://www.baanboard.com/baanboard/showthread.php?t=5833&highlight=stpapi.zoom) which mentions zoom and it links to a thread by Doug Stroud. I would read through this thread completely and I think Doug even posted how he solved it. I have never had to do anything like this.
mkurniadi
13th October 2010, 07:10
Hi Mark,
Sorry i've been doing something else these 2 days.
I've tried tdsls4105m000 and i couldnt find a way to add items to the particular order created on tdsls4101m000. The find feature only finds the record before and after. Am i missing something?
I also tried stpapi.update("tdsls4105s000, 0, error) followed by a stpapi.save("tdsls45105s000",error), but no luck.
How do i check the session and library, anyway?
Those options under special menu are exactly the same as mine. It would be great if you can tell me how to add tdsls4105s000 into this menu.
Those posts dont use tdilc4102s000 and i couldnt see boi.call is used anywhere else after it is declared. I just dont understand the logic for those boi.call and where to put it in my code. Anyway, i dont have the same problem as them since i can insert the sales headers and items into both sessions successfully. Its just we need to use tdilc4102s000, since in the manual operation this session is open automatically while saving an item. In the ole, this session is not open automatically so i guessed we need to invoke it somehow. I have tried and found that if i didnt put anything on the session, the deliveries are not confirmed thus the items dont appear on the invoice. So it must have been a confirmation stage for the items to be delivered or something.
mark_h
13th October 2010, 15:53
boi variables are things baan added in for working with other applications like this warehouse package they used to have. Not sure how it ties into the sales module.
You would have to log a ticket with infor to get the latest libraries and session code and I would even tell them the issue you are having.
Well I can add it to the menu - i checked real quick, but the problem was that it removed the zoom option. Without source code not sure how to prevent that.
The like to the thread was so you could try something like this - stpapi.handle.subproc("tdsls45105s000", "mtdsls00009009","13"). When you would put in the correct menu(not sure if I got it correct) and the value for the item. I have never tried this - I usually use qkey to solve most of my issues.