srinivas
3rd July 2005, 18:48
I am trying to create a production order through AFS.

I am on Baan LN.
I could see the production order session tisfc0101m100 getting started in the process window but still I am getting error "Editable synchronized dialogue not started"

Pl. let me know where I am going wrong.

This is the code:

ret1=tisfc0501m000f.synchronize.dialog("add",error.msg)
If ret1=1 then
tisfc0501m000f.handle.sub.process("tisfc0101m100","add")
tisfc0101m100f.put.Production_Order(pdno)
tisfc0101m100f.put.Item(item)
tisfc0101m100f.put.Quantity_Ordered(qnty)
tisfc0101m100f.put.Warehouse(cwar)
tisfc0101m100f.put.Routing(opro)
tisfc0101m100f.put.Reference(trdt)
tisfc0101m100f.put.Planning_Method(plcd)
tisfc0101m100f.put.Production_Start.tisfc001.prdt( trdt)
tisfc0101m100f.put.Confirmed_Delivery( trdt)
tisfc0101m100f.insert(1,error.msg)
tisfc0101m100f.save(error.msg)
tisfc0101m100f.end(error.msg)
tisfc0501m000f.handle.sub.process("tisfc0101m100","kill")
tisfc0501m000f.end(error.msg)
Endif

mark_h
5th July 2005, 15:25
I do not know anything about Baan 5, but Paul recommends a patch in this thread (http://www.baanboard.com/baanboard/showthread.php?t=9562&highlight=synchronize). You might want to check into that - Paul also says make sure you command is "add" in all lower case.

Good Luck!

NPRao
5th July 2005, 20:31
Srinivas,

Try Mark's suggestion.
I am on Baan LN.
I could see the production order session tisfc0101m100 getting started in the process window but still I am getting error "Editable synchronized dialogue not started"
Also, refer to the LN Tools programmer's manual there are differences compared to the BaaN-5 series manuals.
Here are some notes -
SSA ERP LN 6.1 Programmers Guide
Editable grid and Synchronized Dialog
--------------------------------------------------------------------------------
This addressess sessions with both an editable grid and a synchronized dialog only.

TIV Behaviour
<1000 By default the synchronized dialog is used to insert a record.
≥1000 By default the grid is used to insert a record.

In both cases the default can be overriden by specifying the 3rd argument of the set.synchronized.dialog() function.
The set.synchronized.dialog() is changed from Reger to Gemini/LN -
BaanERP Programmers Guide 7.3_a_sp1
set.synchronized.dialog()
--------------------------------------------------------------------------------
Syntax
void set.synchronized.dialog( string sess_code, )

[B]SSA ERP LN 6.1 Programmers Guide
set.synchronized.dialog()
--------------------------------------------------------------------------------
Syntax
void set.synchronized.dialog( string sess_code, [ boolean editable.grid, [ boolean use.dialog.for.insert ] ] )
use.dialog.for.insert
Specifies whether or not the dialog should be started for inserting or duplicating records. (The default is false.) Only valid when the editable.grid is set to true.

NPRao
6th July 2005, 01:57
Srinivas,

Refer to the latest OW/AFS/API-2.5/2.6 manuals for more information.
USAGE NOTES
Function in dll created by creatdll:
Function extern long <fs-name>.insert(long do.update, ref string error))
If err.mesg is filled, stpapi.recover() must be called before any other stpapi.* commands are issued to this session, or the record can be inserted into the
database because the stpapi.end.session() call will perform an update.db action.
The error messages returned can be:
* Session not available.
* Command disabled; no insert is possible in the current state of the session.
* Editable synchronized dialog box not started (Baan ERP 5.x and 6.0 only).
* Any error message from the session.
Only use this function with ‘do.save’ 0 if the calling program must distinguish between errors raised by the insert (for example, check.inputs) and the save
(for example, skip.io’s in before.write). Do not use it to buffer inserts, because inserts will not be buffered, as the next stpapi.insert() call will execute an
‘update.db’ for the previously inserted record. If a record is inserted with a type 3 form, the function stpapi.change.view()
must be called to set the correct key field values. Baan ERP 5.x and 6.0 only: If a record must be inserted with a synchronized
single-occurrence dialog box, the dialog box must be synchronized before the first put.field function is called, because otherwise the field buffer is not
present. The stpapi.insert() call must be issued to the multi-occurrence session, but the stpapi.put.field() calls to the single-occurrence session. For
multi-occurrence sessions of type 3, make sure you call the stpapi.change.view() before the synchronization.

Synchronize Multi-occurrence and Single-occurrence sessions
SYNTAX
long stpapi.synchronize.dialog(string session, string mode, ref string err.mesg)
ARGUMENTS
session Name of the multi-occurrence session this command is executed on.
mode The mode in which the synchronized dialog box must be started. The possible values are:
Add – the dialog box is started and synchronized in Edit mode, view fields are sent from the multi-occurrence session
to the single-occurrence session; use this mode before a stpapi.insert() call
Modify – the dialog box is started and synchronized in Edit mode, use this mode before a stpapi.update() call
display – the dialog box is started in Display mode
“ ” – no dialog box is synchronized (for future use when multioccurrence and single-occurrence sessions have the same
code, focus is set to the multi-occurrence session) err.mesg This parameter will contain the text of the error message if the
function cannot complete normally.
DESCRIPTION
This function synchronizes a multi-occurrence session with its registered synchronized dialog box. Depending on the mode, the session with the
editable window is synchronized or the read-only window.
RETURN VALUES
0 Sessions could not be synchronized (err.mesg is filled)
1 Sessions are synchronized (err.mesg is empty)
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
Explanation:
The record is searched in the multi-occurrence session. When found, the
synchronized dialog box is started, the field changed, and the record
updated.

Multi-occurrence / Single-occurrence
Baan ERP 5.x and 6.1 only.
For most inserts and updates in Baan ERP, a combination of a multioccurrence and single-occurrence sessions are used. The programmer is
responsible to get the sessions in a synchronized state. This is not done automatically for better performance and because the AFS cannot determine
whether the editable dialog box or the read-only dialog box must be opened. With the normal interface, synchronizing the multi-occurrence and singleoccurrence
session is an asynchronous process, so the processes do not wait until the other is synchronized. The AFS however, will wait until the
synchronization is ready. The sequence of the stpapi.* calls is as much as possible the same as the
actions performed with the user interface to do actions on a combination of a multi-occurrence and single-occurrence session.
Synchronization is necessary to:
* Insert records.
* Update records.
* Execute a form command of the single-occurrence session.
* Retrieve data from the single-occurrence session.
In the next paragraphs, these actions are described in more detail and for
each an example is given.
Inserting records
To insert a record, the multi-occurrence session must be started and also the editable single-occurrence dialog box. The values for the new record must be
sent to the single-occurrence session. The stpapi.insert() call is sent to the multi-occurrence session, the stpapi.recover() is sent to the singleoccurrence
session. To insert records in a type 3 multi-occurrence session (with view), the view
must first be set.
Example type 2, multi-occurrence:
ret = stpapi.synchronize.dialog("dtfsa1501m000", "add", error.msg)
if ret then
stpapi.put.field("dtfsa1101s000", "dtfsa101.seno", str$(new.seno)
stpapi.put.field("dtfsa1101s000", "dtfsa101.name", new.name)
ret = stpapi.insert("dtfsa1501m000", true, error.msg)
if not ret then
ret = stpapi.recover("dtfsa1101s000", error.msg)
endif
endif
stpapi.end.session("dtfsa1501m000", error.msg)
Explanation:
By calling the stpapi.synchronize.dialog() function, the multi-occurrence and single-occurrence sessions are both started. The fields are filled for the
single-occurrence session. The insert is sent to the multi-occurrence session (the Add button is there). If the insert fails, the recover must be performed on
the single-occurrence session (where the Revert button resides). The synchronized dialog box is killed when the multi-occurrence session is ended.
Example type 3, multi-occurrence:
stpapi.put.field("dtfsa1502m000", "dtfsa102.seno", str$(i.seno)
ret = stpapi.change.view("dtfsa1502m000", error.msg)
if ret = 1 then
ret = stpapi.synchronize.dialog("dtfsa1502m000", "add", error.msg)
if ret then
stpapi.put.field("dtfsa1102s000", "dtfsa102.pono", str$(new.pono)
stpapi.put.field("dtfsa1102s000", "dtfsa102.name", new.name)
ret = stpapi.insert("dtfsa1502m000", true, error.msg)
if not ret then
ret = stpapi.recover("dtfsa1102s000", error.msg)
endif
endif
stpapi.end.session("dtfsa1502m000", error.msg)
Explanation:
Almost the same as the previous example. However, a stpapi.change.view() must be called to fill the View field. During the synchronization, the view
fields are copied to the single-occurrence session.

srinivas
10th July 2005, 18:09
The session to be used is tisfc0101s000 and not tisfc0101m100.

brewskizzle
20th July 2005, 09:11
Hi N. Prashanth Rao,

I looked for the documents you mentioned in Baan support site but couldn't find it... Can you please tell me where I can get it, or can you attache it here? I'm looking for both "SSA ERP LN 6.1 Programmers Guide" and "OW/AFS/API-2.5/2.6 manuals"...

Thanks,
Yusuke

NPRao
20th July 2005, 09:28
Yusuke,

I am not sure if its allowed to attach BaaN/SSA standard documents here due to copyright issues.

"SSA ERP LN 6.1 Programmers Guide" is automatically installed when you install the LN - DFE (Dynamic Form Editor).

"OW/AFS/API-2.5/2.6 manuals" - These documents/software are provided in the latest OW Installations/Documentations CDs.

Moon Lok
20th July 2005, 09:40
U8233A US 
SSA® OpenWorldX Studio 2.5 - Developer's Guide for Application Function Sever

brewskizzle
20th July 2005, 10:00
Hi Rao,

Thanks for your quick reply.
I have DFE 7.6a.4 installed on my pc but cannot find the document. Can you tell me where I can find it? I started help from DFE menu, but it gives only windows help for SSA Enterprise Studio 7.6, and not showing anything like Programmers Guide...

regards,
Yusuke

brewskizzle
20th July 2005, 10:03
Hi Rao,

I just found it under the help directory!
Thanks for your help.

Paul P
21st July 2005, 08:25
Aaah, Srinivas, that was an annoying problem wasn't it, working with API DLL :) ? You actually have to create separate DLLs for tisfc0501m000 and tisfc0101s000. I personally like to code directly in API rather than using API DLL. To me, debugging the script becomes easier that way. Good to hear you got it solved though

Rgds,
Paul