jmathew
14th September 2012, 16:25
Hi,
I have been struggling with a code to update data in Transactions schedule in Finance module. The main session is tfgld0512m000 and is sychronised with session tfgld0612m000 and it also opens tfgld0113m000 where the lines are updated for journal transactions. I have been trying a lot but get a message that "Insert is not allowed on this session, try synchronized dialogue". Can someone help me on this and the code that I have written is given below;

stpapi.put.field("tfgld0512m000", "tfgld012.trsc", trsc)
ret = stpapi.find("tfgld0512m000", error.msg)
ret10 = stpapi.synchronize.dialog("tfgld0512m000", "add", error.msg)
stpapi.put.field("tfgld0612m000", "tfgld012.trsc", trsc)
ret = stpapi.find("tfgld0612m000", error.msg)

stpapi.put.field( "tfgld0113m000", "tfgld013.lino", str$(lino) )
stpapi.put.field( "tfgld0113m000", "tfgld013.tcom", str$(tcom) )
stpapi.put.field( "tfgld0113m000", "tfgld013.leac", leac )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim1", dim1 )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim2", dim2 )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim3", dim3 )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim4", dim4 )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim5", dim5 )
stpapi.put.field( "tfgld0113m000", "tfgld013.amnt", str$(amnt) )
stpapi.put.field( "tfgld0113m000", "tfgld013.dbcr", str$(dbcr) )
stpapi.put.field( "tfgld0113m000", "tfgld013.refr", refr )
if not retval1 then
retval2 = stpapi.recover( "tfgld0113m000", recover.msg )
rprt_send()
endif

mark_h
17th September 2012, 06:02
Not familiar with ln - but which session gets the sync command tfgld0512 or tfgld612? When you debug the code where does it first run into issues? Are the sessions starting in the correct order?

jmathew
17th September 2012, 11:56
Hi Mark,
The session tfgld0512m000 is synched with tfgld0612m000 and when we open tfgld0512m000 it opens tfgld0612m000 which has the header details and also the multi-occurance lines which is session tfgld0113m000. So when we try to update data in session tfgld0113m000 it gives the error message as "Insert not possible in this session, Please use the Synchronized dialogue". I also tried to insert record in session tfgld0612m000 but it does not go thru and says that "Record already exist" as the header details already exists. I want to insert the data into the lines. Can you please try this session at your end on ERP LN and let me know where I am going wrong and how I could achieve this upload of transactions.

mark_h
17th September 2012, 15:44
I do not have access to LN. It almost sounds like the session which needs the sync command is tfgld0612m000. Maybe if you tried sync'ing it - this is all spculation on my part

stpapi.put.field("tfgld0612m000", "tfgld012.trsc", trsc)
ret = stpapi.find("tfgld0612m000", error.msg)
ret10 = stpapi.synchronize.dialog("tfgld0612m000", "add", error.msg)
stpapi.put.field( "tfgld0113m000", "tfgld013.lino", str$(lino) )
stpapi.put.field( "tfgld0113m000", "tfgld013.tcom", str$(tcom) )
stpapi.put.field( "tfgld0113m000", "tfgld013.leac", leac )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim1", dim1 )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim2", dim2 )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim3", dim3 )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim4", dim4 )
stpapi.put.field( "tfgld0113m000", "tfgld013.dim5", dim5 )
stpapi.put.field( "tfgld0113m000", "tfgld013.amnt", str$(amnt) )
stpapi.put.field( "tfgld0113m000", "tfgld013.dbcr", str$(dbcr) )
stpapi.put.field( "tfgld0113m000", "tfgld013.refr", refr )
ret10 = stpapi.insert("tfgld0612m000", true, error.msg)

jmathew
20th September 2012, 04:51
Hi Mark,
I had tried the code that you had mentioned also earlier. However, I tried again but the problem is that the session "tfgld0612m000" does not have a synchronized dialogue. Hence, when we define the line as follows;

stpapi.put.field("tfgld0612m000", "tfgld012.trsc", trsc)
ret = stpapi.find("tfgld0612m000", error.msg)
ret10 = stpapi.synchronize.dialog("tfgld0612m000", "add", error.msg)

The return value of ret is 1 and successfull. The return value of ret10 is "0" and the error message is "Session has no synchronized dialog".

mark_h
20th September 2012, 18:20
Post your actual code. Which you originally tried the insert was it on tfgld0113 or on tfgld0512?

Side notes and thoughts - Does this code work? Both the finds work okay?

stpapi.put.field("tfgld0512m000", "tfgld012.trsc", trsc)
ret = stpapi.find("tfgld0512m000", error.msg)
ret10 = stpapi.synchronize.dialog("tfgld0512m000", "add", error.msg)
stpapi.put.field("tfgld0612m000", "tfgld012.trsc", trsc)
ret = stpapi.find("tfgld0612m000", error.msg)

Now - when does session tfgld0113m000 start? Is it after the find? Here I am talking about running the code in debug mode, starting a shell and tracing which process starts when.

It is tough to try this stuff on LN without a system to play with. Do you own source code? Being about to put these sessions in debug mode might help determine what you need to put in an AFS session.

Another thought - since tfgld0612m000 is a main session you mentioned trying it by itself. So if it is not sync'ed maybe it is just a normal AFS interaction where you would use a stpapi.subproc command with it.

Sorry not much help on this since it is LN.

jmathew
20th September 2012, 19:08
Hi Mark,
I have also put the AFS code in debug mode and when we find the record on session tfgld0512m000 the other sessions which is tfgld0612m000 and tfgld0113m000 also opens up. The insert is required into table tfgld013. I also tried opening session tfgld0612m000 instead tfgld0512m000 in debug mode and find that session tfgld0113m000 opens up although in session tfgld0612m000 there is no synchronised dialogue.

Another finding is that, if I insert a record manually in session tfgld0113m000 and then run the AFS code by opening tfgld0612m000 and insert the remaining records in tfgld0113m000, the records get uploaded. However, if there are no records then nothing gets uploaded.

mark_h
20th September 2012, 20:39
Hi Mark,
Another finding is that, if I insert a record manually in session tfgld0113m000 and then run the AFS code by opening tfgld0612m000 and insert the remaining records in tfgld0113m000, the records get uploaded. However, if there are no records then nothing gets uploaded.

Now that is interesting - is there a header record or something that gets inserted somewhere a long the way with the first insert? Then with that it allows the rest of the records to load.

jmathew
20th September 2012, 21:24
Hi Mark,
I further analysed and find that the session tfgld0113m000 is a MMT Satellite session in tfgld0612m000 and that is how the session tfgld0113m000 also is opened while we open tfgld0612m000 manually. The header data is in session tfgld0612m000 which is already available with a find as this is defined in session tfgld0512m000.
Is there a way to update the MMT Satellite session data through AFS?

mark_h
20th September 2012, 21:53
If I recall correctly AFS did not support MMT sessions - need to confirm that since I am not 100% sure.

benito
20th September 2012, 22:24
mark is correct , AFS does not work on MMT.