VishalMistry
23rd March 2012, 13:17
I have created AFS for session tirou1101m000 and trying to add record of item routing through following code but getting the error "Editable synchronized dialog not started" on statement tirouf1101m000.insert(0,error.msg)


tirouf1101m000.put.Manufactured_Item(item.t)
tirouf1101m000.put.Routing("1")
tirouf1101m000.put.Description("Test Descr")
tirouf1101m000.insert(0,error.msg)
tirouf1101m000.save(error.msg)
tirouf1101m000.end()

Can anybody guide me where I am missing ?

Vishal

mark_h
23rd March 2012, 16:28
What version? I suspect this is ln from your profile and this requires synchronized dialog of some sort. Below is where I copied the help from the sticky document. The format did not work.

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 multi-occurrence 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.
USAGE NOTES
This function is for BaanERP only.
The error messages returned can be:
 Command disabled; no insert/update is possible in the current state of the session.
 Session has no synchronized dialog box.

VishalMistry
24th March 2012, 06:54
What version? I suspect this is ln from your profile and this requires synchronized dialog of some sort. Below is where I copied the help from the sticky document. The format did not work.

Hi,

I have already tried it but no luck.

Vishal

mark_h
27th March 2012, 15:38
When you manually start the session what processes are running in the back ground? I can add a record into tirou1102m000 and it appears in tirou1101m000 - I am not really familiar with how these sessions all work. Maybe that is an option instead. Also when I put a record manually in tirou1101m000 I have to put both the routing, the routing unit and up to order quantity for the record to insert and look correct. Maybe our systems are vastly different - not sure.

VishalMistry
5th April 2012, 11:39
When you manually start the session what processes are running in the back ground? I can add a record into tirou1102m000 and it appears in tirou1101m000 - I am not really familiar with how these sessions all work. Maybe that is an option instead. Also when I put a record manually in tirou1101m000 I have to put both the routing, the routing unit and up to order quantity for the record to insert and look correct. Maybe our systems are vastly different - not sure.

Hello Everyone,

after using statement tirouf1102m000.synchronize.dialog("add",error.msg), after the insert call, the error.msg variable contains the error "Record already exists". The full code is as given below:

tirouf1102m000.synchronize.dialog("add",error.msg)
tirouf1102m000.put.Manufactured_Item(item.t)
tirouf1102m000.put.Routing("1")
tirouf1102m000.put.Operation(opno)
tirouf1102m000.put.Sequence_Number(sern)
tirouf1102m000.put.Task("CCR-PPS")
tirouf1102m000.put.Work_Center("BPL")
tirouf1102m000.put.Average_Setup_Time(sutm)
tirouf1102m000.insert(0,error.msg)
tirouf1102m000.save(error.msg)
tirouf1102m000.end()

Can anybody guide me where I am missing ?

Vishal

mark_h
5th April 2012, 15:47
I would expect something like this with the synchronize dialog:


|This would start the tirou1101m000 session
tirouf1101m000.put.Manufactured_Item(item.t)
ret = stpapi.find("tirou1101m000", error.msg)

| Sync with the 1102 session
stpapi.synchronize.dialog("tirou1102m000", "add", error.msg)
tirouf1102m000.put.Manufactured_Item(item.t)
tirouf1102m000.put.Routing("1")
tirouf1102m000.put.Operation(opno)
tirouf1102m000.put.Sequence_Number(sern)
tirouf1102m000.put.Task("CCR-PPS")
tirouf1102m000.put.Work_Center("BPL")
tirouf1102m000.put.Average_Setup_Time(sutm)
| Now insert the record. Notice I use 1 also. I always try with that flag as 1
| then try other formats.
tirouf1101m000.insert(1,error.msg)


If you notice in the example I posted about, and this documentation can be found in the sticky thread on this forum, you start the main session, then sync with the other sub-session. Then you do the insert on the main session.

I do not know these sessions and am on 4c4 so this is only speculating based off what I have gathered from your posts.

VishalMistry
6th April 2012, 09:14
Thank you for your help but I am still getting the same error.

Vishal

I would expect something like this with the synchronize dialog:


|This would start the tirou1101m000 session
tirouf1101m000.put.Manufactured_Item(item.t)
ret = stpapi.find("tirou1101m000", error.msg)

| Sync with the 1102 session
stpapi.synchronize.dialog("tirou1102m000", "add", error.msg)
tirouf1102m000.put.Manufactured_Item(item.t)
tirouf1102m000.put.Routing("1")
tirouf1102m000.put.Operation(opno)
tirouf1102m000.put.Sequence_Number(sern)
tirouf1102m000.put.Task("CCR-PPS")
tirouf1102m000.put.Work_Center("BPL")
tirouf1102m000.put.Average_Setup_Time(sutm)
| Now insert the record. Notice I use 1 also. I always try with that flag as 1
| then try other formats.
tirouf1101m000.insert(1,error.msg)


If you notice in the example I posted about, and this documentation can be found in the sticky thread on this forum, you start the main session, then sync with the other sub-session. Then you do the insert on the main session.

I do not know these sessions and am on 4c4 so this is only speculating based off what I have gathered from your posts.

mark_h
6th April 2012, 15:23
Sorry not any help, but our system is 4c4 and the sessions are very different. You will need to wait to see if someone else has something on this.