ramon_marquez
26th March 2002, 18:53
Help, help, help !!
I'm trying to uninstall PMC solutions by stpapi* primitives.
When I'm look for one solution (stpapi.put.field, stpapi.find) in ttpmc2101m000 ("Process solutions"), the API primitives work fine.
The problem arrives when trying to start the attached sub-sessions ttpmc2206s000 (Check Solution to Uninstall) and ttpmc2208s000 (Uninstall Solution). May the code be clear than my words:rolleyes: :
|* Where fille.vers, fille.rele, fille.cust and fille are respectively the
|* Version, the release, the customer and the solution code.
|* The status of the solution is "Installed".
|* message.erreur is a string(200)
stpapi.handle.subproc( "ttpmc2101m000", "ttpmc2206s000", "add" )
stpapi.put.field( "ttpmc2101m000", "ttpmc201.uver", fille.vers )
stpapi.put.field( "ttpmc2101m000", "ttpmc201.urel", fille.rele )
stpapi.put.field( "ttpmc2101m000", "ttpmc201.ucus", fille.cust )
stpapi.change.view( "ttpmc2101m000" )
stpapi.put.field( "ttpmc2101m000", "ttpmc201.csol", fille )
stpapi.return = stpapi.find( "ttpmc2101m000" )
stpapi.continue.process( "ttpmc2101m000", message.erreur )
stpapi.zoom.option( "ttpmc2101m000", 1, "ttpmc2206s000", message.erreur )
stpapi.set.report( "ttpmc2206s000", "rttpmc2206110004", "ATI_001", message.erreur )
stpapi.continue.process( "ttpmc2206s000", message.erreur )
This code stops with a message:
Erreur fatale: bis_alloc_mem: sym 'baanapi_input_data', i = 0
Erreur fatale: bis_alloc_mem: sym 'baanapi_field_put', i = 0
... when going throug the stpapi.zoom.option.
I've tried to trace the AFS and the result is the next:
LOGGING STARTED
26/03/2002
>ttpmc2101m000 handle.subproc ttpmc2206s000 add
62->get.fields
62<-get.fields...
>ttpmc2101m000 put.field:ttpmc201.uver B40U
>ttpmc2101m000 put.field:ttpmc201.urel c4
>ttpmc2101m000 put.field:ttpmc201.ucus sch0
>ttpmc2101m000 change.view
62->start.set
62<-start.set01
<ttpmc2101m000 1 view found
>ttpmc2101m000 put.field:ttpmc201.csol 156665
>ttpmc2101m000 Find
62->def.find
62<-def.find01
<ttpmc2101m000 record found (1)
>ttpmc2101m000 continue.process
62->cont.process
62<-cont.process
<ttpmc2101m000
>ttpmc2101m000 zoom.option ttpmc2206s000 of form:1
62->zoom.option1ttpmc2206s000
64<-api.child.startedttpmc2206s00062
64->get.fields
64<-get.fields...
<ttpmc2101m000
Does someone has already encountered this kind of problems ?
Thanks for your help !!
Ramón
msjumbu
26th March 2002, 19:07
Hi ,
Some time back I tried to automate this PMC process, but I also encountered problems like this. Up on further investigation I found that the problem was due to some import n export of variables between those sub sessions which open when you process the solution. And also there were some form fields involved in it, the situation become quite difficult to manage and I dint want to risk with PMC, so I have to leave the automation process it self :).
mark_h
26th March 2002, 19:39
Msjumbu might have a good idea about leaving them alone. But I would expect even these sessions to work correctly, but we do not have these sessions. So I am basing this just on the function servers I have done in the past.
(1) Is stpapi.return = stpapi.find(ttpmc2101m000") working correctly? Is it returning a 1?
(2) After the find I see a stpapi.continue.process - is this intended to start the sub-session ttpms2106s000? If the answer is yes then I would expect to see a stpapi.handle.subproc before the continue.
(3) I only use the zoom option in one or two sessions. When I have used it the sub-sessions I start can usually be found under application on the tool bar. So without these sessions I am just guessing on whether stpapi.zoom or the stpapi.handle.subproc should be used.
Just some friendly observations. Hope it helps. OH yeah - I have seen errors like these in a couple of cases. Usually it was were I filled out something incorrectly on the screen. The other time I needed the admin to install new tools patches.
Good Luck!
Mark
ramon_marquez
27th March 2002, 10:59
Hi again,
Thanks for your help to solve the problem !!
Here's the response to your questions:
1._ YES: The stpapi.find returns 1.
2._ The stpapi.continue is supposed to simulate the "mark" of the record in the screen. In fact, the session ttpmc2101m000 has a form of type 3. To uninstall a solution you must "mark" (choice <m>) it, then go back to choice field and validate your choice (choice <o>). Then you must zoom to the right session (choice <Ctrl-z>), ttpmc2206s000 choosen from a menu. I'm not sure that this is the right way to proceed but I've tested a lot of sequences of primitives without success.
3._ In the code I attached, the stpapi.handle.subproc is done at the beginning.
As you can see in the result of the log, after starting the sub-session ttpmc2206s000, it seems that session ttpmc2101m00 tries to send something back (line "<ttpmc2101m000"). May be, the session is trying to tell us something but after getting out of the stpapi.zoom.session the program stops and any other primitive is ignored (so it's impossible to get the error message from atpapi.get.mess.code).
Thanks a lot for your help. See you later in the board.
Ramón
mark_h
27th March 2002, 16:04
On number (2) Continue is suppose to simulate a mark on a record. Today I created a new library using ttstpcreatdll, it had a stpapi command in it I have not seen before stpapi.mark. Here is a snippet of the library:
function extern long f4120m000.mark( )
{
DLLUSAGE
Function to mark the current record in session tdsls4120m000
ENDDLLUSAGE
return( stpapi.mark( "tdsls4120m000" ) )
}
Maybe you need to try something like that, maybe it does not think a record is marked. I do not have any documentation on this command - found it by accident when answering another post. You may also want to try getting a few fields in the sub-session, before doing the continue.
Hope it helps.
Mark
ramon_marquez
27th March 2002, 16:10
:D :D :D :D
GREAT, I'll try right now. I'll let youk now the results of the tests !!
Thanks !!
:D :D :D :D
ramon_marquez
27th March 2002, 18:59
Mark,
Your proposition did not work :( :( :( :(
I need some precisions about the stpapi.handle.subproc primitive:
1._ If my sub-session is not a main session (I mean if it's not posible to start it from a menu), can I drive it anyway by the stpapi primitives ? (calling stpapi.handle.subproc with the argument "add").
2._ If I want to drive a sub-session in calling stpapi.handle.subproc with the argument "send". What session code do I have to put in the session argument in the next stpapi calls ? The main session I started or the sub-session code ?
3._ The session "ttpmc2101m000" (Process Solutions) has several valid sub-sessions that are called from a menu (called by Ctrl-z, the zoom option). Do I have to set explicitly the way API is going to drive these sub-sessions for every one ?
Thanks for your help !!
Ramón
mark_h
27th March 2002, 19:54
Sorry it did not work.
1. Yes you can use it without the main session. At least that is what I saw from another post in this forum. You just have to make sure that everything the subsession needs to run is present.
2. I have never used the send option. I have always used "add" option. Typically I assume that if you get to the session by doing application, zoom you use the stpapi.zoom.option and if the main session activates it the you use the stpapi.handle.subproc. This is not always the case. In one of my function servers (Create PO Lines) the distribution sub-session gets activated using the stpapi.zoom.
3. No - only the ones you plan on using in the function server.
Did you get the same error as before? Are these 4gl sessions?
Mark
mark_h
28th March 2002, 15:19
Here is a link to a new document I found on this board. New afs.doc (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=889).
Not sure if this helps or not, but it did have the stpapi.mark statement in it.
Mark
ramon_marquez
28th March 2002, 15:32
Mark,
Thanks for the link, I'll check soon.
Anyway, I have found a document published on September 2001 describing the AFS primitives and the preconised method to develop AFS applications (here's the url):
ftp://ftp.support.baan.com/updates/B40_c/afs.doc (MS word version)
ftp://ftp.support.baan.com/updates/B40_c/afs.pdf (PDF version)
"En plus", loking for latest version of standard objects, I found that api standard most recent objects are now delivered with most recent version of standard objects (Generic solution 10923).
Load solution 123466 that is the most recent version (March 22nd of 2002).
I've tried this issue and following the document precognitions it begins to work !!!! :D :D :D :D :D
When application will be ready, if you're interested, I'll join the code to this thread !!
I thank you very much for your interest and the time you spent helping to solve the problem !!
Ramón
mark_h
28th March 2002, 15:51
I am glad you have a solution and please do post it. I am always interested in seeing how others solve problems. And if you want to you could always post the complete solution in the Code and Utilities area. A good function server is needed in that forum.
Congrats on finding a solution. :)
Mark
ramon_marquez
4th April 2002, 14:37
Mark,
Here's a the script of a little tool that automatizes the uninstall of one solution using the PMC tool.
It's based in a table tupmc001 that contains the list of pre-requisites solutions for a given solution.
So the main "select" loop executes the two PMC sessions that uninstall a solution.
Don't hesitate to contact me if you're interested on it. I hope it will be useful !! :) :) :)
Good Luck
Ramón
mark_h
4th April 2002, 16:03
Thanks for posting the solution. Our admin keeps talking about installing the PMC tool, but he hasn't yet. Hopefully others besides me can make use of your solution.
Thanks again.
Mark
mostrightfuture
22nd June 2004, 18:06
hi Ramon,
I am facing some problem using that stpapi. I am trying to to launch another print request with one order number, while I am in the middle of a print request started with the range of order numbers. it not works well. If you have some time then please look at this post.
http://www.baanboard.com/baanboard/showthread.php?t=15615&page=1
I found that you have good experience with stpapi (AFS commands)
Thanks in advance
Mahmood