FrenkR
21st December 2011, 01:08
Hi,
if I am running a process via UI (worktop) I see a process tree correctly. For add-ing a new tdsls header I am getting a tree as follows(tdsls4100m000 is presented like child (editing) session of tdsls4100mpol):
tdsls4100mpol
|_ tdsls4100m000

if I call the same function via AFS, I am getting sessions on the same level as follows
tdsls4100mpol
tdsls4100m000

It looks like synchronize.dialog does not open an editing form as a child session. Is that OK or I am doing something wrong?

*end.session* correctly releases both sessions.

AFS code is like this:
ret =stpapi.synchronize.dialog("tdsls4100mpol","add", error.msg)
if ret = 1 then
stpapi.put.field("tdsls4100m000", "tdsls400.ofbp", "100000065")
stpapi.put.field("tdsls4100m000", "tdsls400.stbp", "100000065")
stpapi.put.field("tdsls4100m000", "tdsls400.cofc", "P00")
stpapi.put.field("tdsls4100m000", "tdsls400.sotp", "101")
stpapi.put.field("tdsls4100m000", "tdsls400.orno", "10")
ret = stpapi.insert("tdsls4100m000", true, error.msg)
if not ret then
ret = stpapi.recover("tdsls4100m000", error.msg)
endif
stpapi.end.session("tdsls4100mpol", error.msg)

Best regards,
Frenk

mark_h
22nd December 2011, 15:34
Well I am not sure the code is correct - here is a baan example:

stpapi.put.field("dtfsa1501m000", "dtfsa101.seno", str$(i.seno))
ret = stpapi.find("dtfsa1501m000", error.msg)
if ret then
ret = stpapi.synchronize.dialog("dtfsa1501m000", "modify", error.msg)
if ret then
stpapi.put.field("dtfsa1101s000", "dtfsa101.name", new.name)
ret = stpapi.update("dtfsa1501m000", true, error.msg)
endif
endif

Notice it starts the main session, does the sync on the main session, then does put.fields on the subsession, then does the update on the main session.

Sorry I can't answer your question, but the code just looks off to me. Keep in mind I am a 4c4 person and I am no experience with other versions of baan.

FrenkR
23rd December 2011, 10:40
Mark,
why do you do update in a main session? Is a subsession only an editor for the data and main main session is responsible for update? Is this a rule of thumb for update via AFS?
Rgds,
Frenk

mark_h
24th December 2011, 05:51
The only way I can answer that is - because that is what the documentation shows. I really do not know why and have really not read the documentation in the sticky thread from a baan 5 perspective. I only have 4c4 and no experience on baan 5. No this is not a rule of thumb for AFS per se, but it it a rule of thumb for synchronized sessions, from what I have seen.