gilforum
21st October 2002, 19:59
I am trying to simulate the session tisfc0203m000.
I generated a dll with AFS and i created a new session.
My source code is the following:
declaration:
#pragma used dll ottstpapihand | Baan API Handler
long rc
string erro(60)
domain tcpdno value
choice.cont.process:
on.choice:
value=1950
gilfm0203.put.Ordem_de_fabrico(value)
rc=gilfm0203.find()
if rc<>1 then
message("erro record")
endif
gilfm0203.continue(erro)
message(erro)
When i execute the session it gives me the error:
"Zero pointer: name '' in qss.search"
"Can not continue in tisfc0203m000 in DLL: ottstpstandard ()"
mark_h
21st October 2002, 20:24
On our system the tisfc0203m000 session when clicking continue it starts the reason code subsession tcmcs9551m00b. Does your system? If so then I would expect to see a stpapi.handle.subproc for the subsession.
Next on our system it does print a report when the session is cancelled and that could be causing the error. So I would expect to see a stpapi.set.report command - this would tell the session which report and which spool.device to use. This command would be placed before the continue statement.
Good Luck!
Mark
gilforum
21st October 2002, 20:34
Thank You. I will try.
gfasbender
21st October 2002, 21:36
I've never been able to get an API to work for a session that has a start option of Find(7).
Symptoms of this happening are receiving dialog error:
"Zero pointer: name '' in qss.search"
"Use of NULL pointer on ''"
"Can not continue in <session> in DLL: ottstpstandard()"
If this is the case, try changing the session start option to something like GetDefaults.
gilforum
22nd October 2002, 13:21
I trying get.screen.defaults() in section on.choice:, but continues the same error.
I think that error is relative to the function qss.search().
My source code:
declaration:
#pragma used dll ottstpapihand | Baan API Handler
extern domain tcpdno pdno.f
extern domain tcpdno pdno.t
domain tcpdno i
long rc
string erro(60)
domain tcpdno value
domain tcitem artigo
choice.cont.process:
on.choice:
get.screen.defaults()
value=1950
gilfm0203.put.Ordem_de_fabrico(value)
rc=gilfm0203.find()
if rc<>1 then
message("erro record")
endif
gilfm0203.continue(erro)
message(erro)
gilforum
22nd October 2002, 13:33
When the session is opened it appears a find box.
Do it is possible to disable this box?
Do it is possible to accept (button), throught the source code?
mark_h
22nd October 2002, 15:59
You do not need source for this change. Just copy the session(only the session) to you devolopment VRC and change the start option to something like 44. You do this with ttadv2100m000.
You may also want to make sure you have the latest patch for the stpapi commands.
I would expect this to work:
get.screen.defaults()
value=1950
gilfm0203.put.Ordem_de_fabrico(value)
rc=gilfm0203.find()
if rc<>1 then
message("erro record")
endif
Mark
gilforum
22nd October 2002, 16:28
I have copied the session tisfc0203m000 to development VRC and changed the start option to 44.
I executed my source code and it give me the same error.
mark_h
22nd October 2002, 18:41
I checked our system and it looks like in the init.form section it does a execute(def.find). This will override the start option on the session itself and is what probably causes the error. So Gordon is there a work around of any sort for this problem? I could probably get around this using qkey to disable the init.form section and ~Vamsis' extended source solution, but is it possible another way?
Mark
gilforum
22nd October 2002, 18:59
I have not much experience in programming 4 GL.
Like in Visual Basic do you know if exists any function to send key?
mark_h
22nd October 2002, 20:33
Not that I am aware of, at least the way I understand the sendkey method.
I do know that if you disable the execute(def.find) in the script the API code will work. You could probably delete the orders through tisfc0101m000 - more complicated, but probably would work.
Mark
gilforum
23rd October 2002, 13:35
We have not the sources of the session.
Our Baan seller did not gave us the sources of Baan.
I will follow your suggestion and try through the session tisfc0101m000.
Thank You.
Daniel
21st November 2002, 09:11
Hi, everybody!
I had the same problem with this session. The trouble is the code of this session is:
form.1:
init.form:
execute(def.find)
...in other words you try to put value into the form field
when the form was not initialized, so the only way to fix
this problem is to do following with this code:
form.1:
init.form:
if not api.mode then
execute(def.find)
endif
And if you are not having the sources, try to ask your baan support for help.
All the best, Daniel.
gilforum
21st November 2002, 11:04
Thanks.
I will try.
gilforum
21st November 2002, 12:47
Hi, Daniel.
Do i put the source code in the tisfc0203m000 program, or in my session's program?
Thanks in advance.
Daniel
21st November 2002, 13:24
Hi, gilforum.
Yes, it is necessary to modify the tisfc0203m000 session code, everything should be OK i suppose.
Good luck.
gilforum
21st November 2002, 14:57
I will ask for the source code.
Thank you.
gilforum
4th December 2002, 14:05
Hi Daniel.
I have the source of the session.
I made the correction like you told me and the error message disappeared.
When i execute my source code, the system did not cancel the order.
I think my code have no errors.
My source code.
|******************************************************************************
|* tisfc0202gil01 0 VRC B40O c4 exp1
|* Contabilizar stocks para ordens de fabrico
|* gil
|* 24/09/02 [12:00]
|******************************************************************************
|* Script Type: 123
|******************************************************************************
declaration:
#pragma used dll ottstpapihand | Baan API Handler
long rc
string erro(60)
domain tcpdno value
choice.cont.process:
on.choice:
gilfm0203.define.enum.answer("tisfcs0196",tcyesno.yes)
value=2919
gilfm0203.put.Ordem_de_fabrico(value)
rc=gilfm0203.find()
if rc<>1 then
message("registo nao encontrado")
endif
gilfm0203.continue(erro)
Daniel
5th December 2002, 08:18
Hi, gil.
May be the point of your problem is you've forgotten to set a report. Try something like that:
function extern domain tcbool bzsfcdll000001.delete.sfc.order(
domain tuole.data pdno.in)
{
domain tcpdno pdno.l
string err.msg(100)
ret.msg = ""
pdno.l = lval(pdno.in)
f0203m000.put.Production_Order(pdno.l)
if f0203m000.find() <> 1 then
ret.msg = sprintf$(get.err.msg(7), pdno.l)
f0203m000.end()
return (false)
endif
stpapi.set.report("tisfc0203m000", "rtisfc020301000", PR.DEVICE, err.msg)
if not isspace(err.msg) then
ret.msg = sprintf$(get.err.msg(9), strip$(err.msg))
f0203m000.end()
return (false)
endif
f0203m000.continue(err.msg)
if not isspace(err.msg) then
ret.msg = sprintf$(get.err.msg(10), strip$(err.msg))
f0204m000.end()
return (false)
endif
f0204m000.end()
return (true)
}
Good luck,
Daniel.
gilforum
5th December 2002, 16:56
I applied the code for the report and it works.
Tank You.
Aart Bieleman
16th May 2008, 15:14
Hi,
In case you don't have access to the source code or just don't want to mess with it, there's another workaround which I use:
As the problem is the init.form.1 in the source, just make sure there won't be a form 1 on which the find command can be executed. You do this by copying the original session tisfc0203m000 to a new session. Now move the original form to the second position. At the first position, add a new form, which doesn't have any fields. Now set the startup option of the session to "last screen".
Now you can use this session in AFS. There's only one catch: Now even the find command in AFS won't work anymore for some reason. So you need to browse to the right record using the browse command, whilst checking if you found the right record already with the get command. For performance reasons, just start with the first record and don't end the session until all is done (assuming you ordered the table by order number).
Good luck!