ianglen
28th November 2012, 23:43
I want to be able to have people run 'convert user to database user' without giving them the 'baan' password. Need to call 'ttdba0915m000' and then sub-session 'ttdba0200s000'. I have tried the following:-
stpapi.find("ttdba0915m000", err.msg)
stpapi.put.field("ttdba0915m000", "ttaad410.dbse", str$("001"))
stpapi.put.field("ttdba0915m000", "baan.user.f", str$(form.user))
stpapi.put.field("ttdba0915m000", "baan.user.t", str$(form.user))
stpapi.put.field("ttdba0915m000", "ttdba020.db.group", str$("baandb"))
stpapi.put.field("ttdba0915m000", "dba.def.pwd.chk", str$(ttyeno.yes))
stpapi.put.field("ttdba0915m000", "dba.default.pwd", str$("Complex101!"))
stpapi.put.field("ttdba0915m000", "db.logon.type", str$(ttyeno.yes))
stpapi.put.field("ttdba0915m000", "dba.display.error", str$(ttyeno.no))
stpapi.form.command("ttdba0915m000", 5, "ttadv.convert", err.msg)
stpapi.update("ttdba0915m000", do.save, err.msg)
stpapi.find("ttdba0200s00", err.msg)
stpapi.handle.subproc("ttdba0915m000", "ttdba0200s000", err.msg)
stpapi.put.field("ttdba0200s000", "baan", str$("baan"))
stpapi.put.field("ttdba0200s000", "xxxxxx", str$("baan_pw"))
stpapi.continue.process("ttdba0200s000", err.msg)
stpapi.end.session("ttdba0200s000")
stpapi.end.session("ttdba0915m000")
I am unable to get 'ttdbs0200s000' to process correctly. I would appreciate any suggestions.
Thanks
Ian
mark_h
29th November 2012, 15:38
I would suspect this needs to be arranged first:
stpapi.handle.subproc("ttdba0915m000", "ttdba0200s000", err.msg)
stpapi.form.command("ttdba0915m000", 5, "ttadv.convert", err.msg)
stpapi.update("ttdba0915m000", do.save, err.msg)
stpapi.find("ttdba0200s00", err.msg)
..
Then I have to wonder what version of baan you are on, because in one case you use stpapi.form.command and in another you use stpapi.continue - which is baan 4 only. Now I don't have this session, but from what I see you want to update a record in ttdba0915m000, then launch subsession ttdba0200s000. I can only assume the subsession the continue does the save and exits the session back to ttdba0915m000.
Pure speculation on my part with my comments:
stpapi.find("ttdba0915m000", err.msg)
stpapi.put.field("ttdba0915m000", "ttaad410.dbse", str$("001"))
stpapi.put.field("ttdba0915m000", "baan.user.f", str$(form.user))
stpapi.put.field("ttdba0915m000", "baan.user.t", str$(form.user))
stpapi.put.field("ttdba0915m000", "ttdba020.db.group", str$("baandb"))
stpapi.put.field("ttdba0915m000", "dba.def.pwd.chk", str$(ttyeno.yes))
stpapi.put.field("ttdba0915m000", "dba.default.pwd", str$("Complex101!"))
stpapi.put.field("ttdba0915m000", "db.logon.type", str$(ttyeno.yes))
stpapi.put.field("ttdba0915m000", "dba.display.error", str$(ttyeno.no))
stpapi.handle.subproc("ttdba0915m000", "ttdba0200s000", err.msg) |Used to control subsession and must be called before subsession is started.
stpapi.update("ttdba0915m000", do.save, err.msg) | Update the record
stpapi.form.command("ttdba0915m000", 5, "ttadv.convert", err.msg) | Launch subsession
stpapi.find("ttdba0200s00", err.msg) | Is this really needed - if run manually does the subsession launch to where you need it to be???
stpapi.put.field("ttdba0200s000", "baan", str$("baan"))
stpapi.put.field("ttdba0200s000", "xxxxxx", str$("baan_pw"))
stpapi.form.command("ttdba0200s000", 5, "continue",err.msg) |Assuming I got format correct
stpapi.end.session("ttdba0200s000")
stpapi.end.session("ttdba0915m000")
I am not sure this will work, but I think that is the theory behind it based off my guesses.
ianglen
29th November 2012, 16:28
Mark,
Thanks - I will try it out. I am using Baan LN.
Ian
ianglen
5th December 2012, 21:37
Here is the log I am getting, but the 'database users' is not getting updated neither is the database:-
LOGGING STARTED
12-05-2012
>ttdba0915m000 Find
47dll->serv (getxml)
47dll->serv (startttdba0915m000100)
50serv<-4gl (api.child.startedttdba0915m00047)
50serv<-4gl (init.ready)
ttdba0915m000(50)-RUNNING:
47dll->serv (def.find50)
ttdba0915m000(50)-RUNNING:def.find
50serv<-4gl (def.find01)
ttdba0915m000(50)-RUNNING:
<ttdba0915m000 record found (1)
>ttdba0915m000(50) put.field:ttaad410.dbse 001
>ttdba0915m000(50) put.field:baan.user.f DIT2943
>ttdba0915m000(50) put.field:baan.user.t DIT2943
>ttdba0915m000(50) put.field:ttdba020.db.group baandb
>ttdba0915m000(50) put.field:dba.def.pwd.chk 1
>ttdba0915m000(50) put.field:dba.default.pwd Complex101!
>ttdba0915m000(50) put.field:db.logon.type 2
>ttdba0915m000(50) put.field:dba.display.error 2
>ttdba0915m000 handle.subproc ttdba0200s000
47dll->serv (handle.subsessionttdba0200s000250)
>ttdba0915m000 update
47dll->serv (modify.set50)
ttdba0915m000(50)-RUNNING:modify.set
50serv<-4gl (modify.set00)
ttdba0915m000(50)-RUNNING:
<ttdba0915m000
>ttdba0915m000 form.command command type: 5 command prog: ttadv.convert
47dll->serv (form.command5ttadv.convert50)
ttdba0915m000(50)-RUNNING:form.command
50serv<-4gl (form.command0)
ttdba0915m000(50)-RUNNING:
<ttdba0915m000
>ttdba0200s000 Find
47dll->serv (startttdba0200s000100)
51serv<-4gl (api.child.startedttdba0200s00047)
51serv<-4gl (init.ready)
ttdba0200s000(51)-RUNNING:
47dll->serv (def.find51)
ttdba0200s000(51)-RUNNING:def.find
51serv<-4gl (def.find01)
ttdba0200s000(51)-RUNNING:
<ttdba0200s000 record found (1)
>ttdba0200s000(51) put.field:dba_name baan
>ttdba0200s000(51) put.field:pass.wd md8$67
>ttdba0200s000 form.command command type: 5 command prog: continue
47dll->serv (form.command5continue51)
ttdba0200s000(51)-RUNNING:form.command
51serv<-4gl (form.command0)
ttdba0200s000(51)-RUNNING:
<ttdba0200s000
>ttdba0200s000 end.session
47dll->serv (end.program51)
ttdba0200s000(51)-RUNNING:end.program
51serv<-4gl (end.program0)
ttdba0200s000(51)-RUNNING:
51dll->serv (ttdba0200s000: exit(51))
>ttdba0915m000 end.session
47dll->serv (end.program50)
ttdba0915m000(50)-RUNNING:end.program
50serv<-4gl (end.program0)
ttdba0915m000(50)-RUNNING:
50dll->serv (ttdba0915m000: exit(50))
47dll->serv (afsscript: exit(47))
mark_h
6th December 2012, 01:00
Okay - so the first part is not working either. The database is not getting updated even with the update command - correct?
stpapi.find("ttdba0915m000", err.msg)
stpapi.put.field("ttdba0915m000", "ttaad410.dbse", str$("001"))
stpapi.put.field("ttdba0915m000", "baan.user.f", str$(form.user))
stpapi.put.field("ttdba0915m000", "baan.user.t", str$(form.user))
stpapi.put.field("ttdba0915m000", "ttdba020.db.group", str$("baandb"))
stpapi.put.field("ttdba0915m000", "dba.def.pwd.chk", str$(ttyeno.yes))
stpapi.put.field("ttdba0915m000", "dba.default.pwd", str$("Complex101!"))
stpapi.put.field("ttdba0915m000", "db.logon.type", str$(ttyeno.yes))
stpapi.put.field("ttdba0915m000", "dba.display.error", str$(ttyeno.no))
stpapi.handle.subproc("ttdba0915m000", "ttdba0200s000", err.msg) |Used to control subsession and must be called before subsession is started.
stpapi.update("ttdba0915m000", do.save, err.msg)
And the above code relates to this in the log:
LOGGING STARTED
12-05-2012
>ttdba0915m000 Find
47dll->serv (getxml)
47dll->serv (startttdba0915m000100)
50serv<-4gl (api.child.startedttdba0915m00047)
50serv<-4gl (init.ready)
ttdba0915m000(50)-RUNNING:
47dll->serv (def.find50)
ttdba0915m000(50)-RUNNING:def.find
50serv<-4gl (def.find01)
ttdba0915m000(50)-RUNNING:
<ttdba0915m000 record found (1)
>ttdba0915m000(50) put.field:ttaad410.dbse 001
>ttdba0915m000(50) put.field:baan.user.f DIT2943
>ttdba0915m000(50) put.field:baan.user.t DIT2943
>ttdba0915m000(50) put.field:ttdba020.db.group baandb
>ttdba0915m000(50) put.field:dba.def.pwd.chk 1
>ttdba0915m000(50) put.field:dba.default.pwd Complex101!
>ttdba0915m000(50) put.field:db.logon.type 2
>ttdba0915m000(50) put.field:dba.display.error 2
>ttdba0915m000 handle.subproc ttdba0200s000
47dll->serv (handle.subsessionttdba0200s000250)
>ttdba0915m000 update
So I would solve this piece before moving on to the subsession. For this what do you do manually if you did it by hand? For example I would document it like this:
(1) Start session ttdba0915m000
(2) Hit find - enter user id or what ever you enter. Click okay
(3) Record found. Update db.logon.type.
(4) Hit save button.
Keep in mind this is different than something like this:
(1) Start session ttdba0915m000
(2) hit insert button
(3) add new user and fields xxx, xxx, xxx
(4) exit session
It makes a difference to me on figuring out which commands to run and there is no guarantee that every session will work. Sometimes you have to play around with the commands. But the first thing before worrying about launching ttadv.convert. To me you need to get first part working before launching the second part.
ianglen
6th December 2012, 17:02
Mark,
I certainly appreciate all the advice. I don't believe that 'ttda0915m000' actually updates a table or the database. I think it just gathers data and then 'ttdba0200s000' updates table 'ttdba015' and then creates the user in the database. I think these sessions are the same in most versions of Baan.
I am getting nothing returned in the 'msg' error field when I run my session in debug.
Thanks again
Ian
mark_h
7th December 2012, 16:41
Can you document it like I showed. What you just posted makes sense, but then there is no reason for the update on the ttda0915m000 session. So from what I read - I speculate something like this then:
stpapi.put.field("ttdba0915m000", "ttaad410.dbse", str$("001"))
stpapi.put.field("ttdba0915m000", "baan.user.f", str$(form.user))
stpapi.put.field("ttdba0915m000", "baan.user.t", str$(form.user))
stpapi.put.field("ttdba0915m000", "ttdba020.db.group", str$("baandb"))
stpapi.put.field("ttdba0915m000", "dba.def.pwd.chk", str$(ttyeno.yes))
stpapi.put.field("ttdba0915m000", "dba.default.pwd", str$("Complex101!"))
stpapi.put.field("ttdba0915m000", "db.logon.type", str$(ttyeno.yes))
stpapi.put.field("ttdba0915m000", "dba.display.error", str$(ttyeno.no))
stpapi.handle.subproc("ttdba0915m000", "ttdba0200s000", err.msg) |Used to control subsession and must be called before subsession is started.
stpapi.find("ttdba0915m000", err.msg)
stpapi.form.command("ttdba0915m000", 5, "ttadv.convert", err.msg) | Launch subsession
stpapi.put.field("ttdba0200s000", "baan", str$("baan"))
stpapi.put.field("ttdba0200s000", "xxxxxx", str$("baan_pw"))
stpapi.form.command("ttdba0200s000", 5, "continue",err.msg) |Assuming I got format correct
stpapi.end.session("ttdba0200s000")
stpapi.end.session("ttdba0915m000")
Notice I took the find out of it on the ttdba0200s000 session - just did not make sense to me. Another key things is this statement - stpapi.form.command("ttdba0915m000", 5, "ttadv.convert", err.msg). When you run the session in debug mode - make sure this actually starts the subsession. You should be able to use the option dialog to watch the processes start and stop. You should actually see the ttdba0200s000 session have a parent process id that is the ttdba0915m000 session. Because if the stpapi.put.field("ttdba0200s000", "baan", str$("baan")) starts the session then the ttdba0915m000 is not controlling it like it should and it may not work as expected.
ianglen
10th December 2012, 22:33
Mark,
Getting closer. I ran 'ttstpcreatdll' and found that I needed:-
stpapi.form.command("ttdba0915m000", 5, "user.processing", err.msg)
I also used debug and shell to confirm that now the sub-session is owned by the parent. However the sub-session is still not performing its updates.
The sub-session 'ttdba0200s000' does have a progress bar. Is that a problem?
Ian
mark_h
11th December 2012, 15:29
Honestly - I have no idea if a progress bar would cause an issue. I do know that some subsessions that are automatically zoomed to can cause issues. I can't say since we don't have these sessions.
Did you try ttstpcreatdll on the ttdba0200s000 session also? See if there is anything in it to give a clue on how to get it updated or what other commands might be needed.