blanchap
11th January 2018, 18:07
Hi,
I'm creating a function server for a baan session and the process is giving me messages during the process.
how can I send a "enter" to the message so that the stpapi process continue?
Thanks.
PB
NPRao
11th January 2018, 18:23
Refer to the AFS manual -
[QUOTE]Send Start processing command to session
SYNTAX
void stpapi.continue.process(string session, ref string err.mesg)
ARGUMENTS
session Name of the session this command is executed on.
err.mesg This parameter will contain the text of the error message if the
function cannot complete normally.
DESCRIPTION
This causes the choice option cont.process to be executed in the specified
session
RETURN VALUES
None
EXAMPLE
stpapi.put.field("dtfsa1201s000", "seno.f", str$(i.seno))
stpapi.put.field("dtfsa1201s000", "seno.t", str$(i.seno))
stpapi.put.field("dtfsa1201s000", "proc.date", str$(date.num()))
stpapi.put.field("dtfsa1201s000", "do.update", str$(etol(dtyesno.no)))
stpapi.continue.process("dtfsa1201s000", error.msg)
Explanation:
For a processing session, the input fields are sent to the session, and the
continue process function of the session is executed.
USAGE NOTES
Functions in dll created by creatdll:
Function extern void <fs-name>.continue(ref string error)
This function is for Baan IV only. For Baan ERP 5.x and 6.0, use the
stpapi.form.command().
The error messages returned can be:
blanchap
11th January 2018, 20:11
Hi,
do i need to do an update between fields?
here's what i'm doing.
stpapi.put.field("tisfc0101m000", "tisfc001.prdt", date1)
stpapi.put.field("tisfc0101m000", "tisfc001.dldt", date2)
stpapi.put.field("tisfc0101m000", "tisfc001.dldp", perc)
stpapi.update("tisfc0101m000", true, errmsg1)
but when i check errmsg1, it's like field tisfc001.dldt never changed.
blanchap
11th January 2018, 20:13
here is the full function.
stpapi.put.field("tisfc0101m000", "tisfc001.pdno", pdno.str)
rc = stpapi.find("tisfc0101m000", errmsg1)
if rc <> 1 then
errmsg1 = "Production order not found"
stpapi.end.session("tisfc0101m000")
display("errmsg1")
end()
endif
stpapi.put.field("tisfc0101m000", "tisfc001.prdt", date1)
stpapi.put.field("tisfc0101m000", "tisfc001.dldt", date2)
stpapi.put.field("tisfc0101m000", "tisfc001.dldp", perc)
stpapi.update("tisfc0101m000", true, errmsg1)
stpapi.end.session("tisfc0101m000")
am i missing something?
mark_h
12th January 2018, 00:05
Based off the original post it sounds like you are receiving messages from the session as the process is running. Depending on the message (and or question) on what you need to do. If it is just warning messages or informational messages then you really need to do nothing. If they are questions then you need to use stpapi.enum.answer with the question number before the session asks the message. So typically before the stpapi.update.
On the fields you sending in the put are they all strings and in the correct format (date1,date2,perc)?
mark_h
12th January 2018, 00:08
FYI - I moved it to this form. One of the things I recommend is searching this specific forum to see what others are doing for a given session. Like this thread - http://www.baanboard.com/baanboard/showthread.php?t=55753&highlight=tisfc0101m000 and this one http://www.baanboard.com/baanboard/showthread.php?t=24324&highlight=tisfc0101m000 - you can usually see samples of what others are trying. Not sure I have done one on tisfc0101m00 on our system.
blanchap
12th January 2018, 17:50
date1, date2 and perc are strings.
the process is not a question but a message where i need to press enter.
in the regular Baan session, i get the message after i update the dates.
when i press enter, the dates get saved.
PB
blanchap
12th January 2018, 21:28
is the process is the same since i'm trying to modify a date field?
blanchap
12th January 2018, 23:46
ok, i'm at the point were i'm going crazy.
i'm trying to update the production start date and the delivery date in tisfc0101m000
here is my script
function update.record()
{
long ret
perc = "100"
stpapi.put.field("tisfc0101m000", "tisfc001.pdno", pdno.str)
rc = stpapi.find("tisfc0101m000", errmsg1)
| if rc <> 1 then
| errmsg1 = "Production order not found"
| stpapi.end.session("tisfc0101m000")
| display("errmsg1")
| end()
| else
stpapi.put.field("tisfc0101m000", "tisfc001.prdt", date1.str)
stpapi.put.field("tisfc0101m000", "tisfc001.dldt", date2.str)
stpapi.put.field("tisfc0101m000", "tisfc001.dldp", perc)
ret = stpapi.update("tisfc0101m000", true, errmsg1)
stpapi.handle.subproc("tisfc0101m000","tisfc0505m000","kill")
stpapi.end.session("tisfc0101m000", errmsg1)
| endif
}
if i follow in debug, errmsg1 has the mesaage: ''estimated BOM and Routing will reset to standard press <return>
when i check the data, nothing is changed.
help!
mark_h
14th January 2018, 00:44
It might be a case where you need to see what the code is doing. There is always a possibility where a field (or session variable) does not get filled while running in api mode. If it is not a question then what you can try to do is first do a stpapi.save - then follow it with an update. Sometimes that gets things to work.
blanchap
15th January 2018, 21:21
Hi,
fsaw and fixed the issue.
problem was my date field.
it needs to be in the internal baan 3gl format.
so not stpapi.put.field("tisfc0101m000", "tisfc001.dldt", date2.str)
but stpapi.put.field("tisfc0101m000", "tisfc001.dldt", str$(date.num()))
it's working now.
thanks for all the info about this,
PB