zakir_h
19th July 2004, 14:32
BAAN: 5.0c SP 12
Porting Set 7.1d.04
Database: Oracle 8i
Hi,
When i am trying to insert a new line in the session tscfg2100s000 through AFS, the value of the field tscfg200.cogr disappears just before insert.
Below is the code.
stpapi.put.field("tscfg2100s000","tscfg200.ccfg",new.ccfg)
stpapi.put.field("tscfg2100s000","tscfg200.crob",tsafi004.crob)
stpapi.put.field("tscfg2100s000","tscfg200.desc",temp.crob.desc)
stpapi.put.field("tscfg2100s000","tscfg200.oseq","1")
stpapi.put.field("tscfg2100s000","tscfg200.sear",toupper$(temp.crob.desc(1;16)))
stpapi.put.field("tscfg2100s000","tscfg200.obtp",str$(etol(tscfg.obtp.product)))
stpapi.put.field("tscfg2100s000","tscfg200.cogr",temp.obgr)
stpapi.put.field("tscfg2100s000","tscfg200.mobl",str$(etol(tcyesno.no)))
stpapi.put.field("tscfg2100s000","tscfg200.incc",str$(etol(tcyesno.no)))
stpapi.put.field("tscfg2100s000","tscfg200.dldt",str$(utc.num()))
stpapi.put.field("tscfg2100s000","tscfg200.indt",str$(date.num()))
stpapi.put.field("tscfg2100s000","tscfg200.cndt",str$(utc.num()))
stpapi.put.field("tscfg2100s000","tscfg200.manu",str$(etol(tscfg.manu.party)))
retval = stpapi.insert("tscfg2500m000",false,err.mesg)
|THE AFS returns an error message "object group not allowed"
stpapi.get.field("tscfg2100s000","tscfg200.cogr",test.obgr)
if not retval then
err.mesg=""
stpapi.recover("tscfg2100s000",recover.msg)
endif
When i check the value of the field it is blank after the insert command is executed.
I tried putting a constant in to the field tscfg200.cogr but still it disappears.
zakir :confused:
Baan OpenWorld
19th July 2004, 15:40
Hello Zakir
You should be synchronizing tscfg2100s000 with the main session tscfg2500m000. Check the AFS Developer's guide (Sticky post at the top of this discussion) under the section "Synchronize Multi-occurrence and Single-occurrence sessions". There is an example in there which should get you started.
Always remember that the AFS can only do whatever a normal user could have done. Meaning, you can't log into to Baan, and start the session 'tscfg2100s000' since it is a subsession. The user would have to go thru tscfg2500m000, set their view, and proceed from there.
regards
Marco
zakir_h
20th July 2004, 10:46
Hi,
Here is how the code is actually written.
--------------------
stpapi.put.field("tscfg2500m000","tscfg2500.ccfg",new.ccfg)
ret.orview= stpapi.change.view("tscfg2500m000",err.mesg)
if ret.orview = 1 then
ret.orline = stpapi.synchronize.dialog("tscfg2500m000","add",err.mesg)
if ret.orline then
stpapi.put.field(........
stpapi.put.field("tscfg2100s000","tscfg200.cogr",temp.obgr)
........
retval = stpapi.insert("tscfg2500m000",true,err.mesg)
| The err.mesg returned "object group not allowed" as seen in the debug
| mode.
stpapi.get.field("tscfg2100s000","tscfg200.cogr",test.obgr)
| test.obgr shows a blank value.
endif
endif
----------------
I tried putting a constant("abcd") in to the field tscfg200.cogr but still the stpapi.insert... returns the same error message and the test.obgr field is blank.
Any ideas why this could be happenning.
zakir :confused:
mark_h
20th July 2004, 15:44
Is this a segmented field? Do not know anything about Baan V sessions, but thought I would ask it. Sometimes fields in sessions do not populate correctly, source code to debug is usually helpful. Something else you can try is update versus insert. You may also want to try insert, then put this object group, then do a save or update.
Mark
Baan OpenWorld
20th July 2004, 16:32
Hello Zakir
I just tested it on my Vc system and it seems to work, see the screen shot attached.
You may want to check to see if you are running the latest version of the standard program objects (namely the object ttstpapihand). My compile date for that object is
C:\>bic_info -w ottstpapihand
---------------------------OBJECT IDENTS--------------------------------
@(#)/usr5/BaanERP/Corelli/bse/tools/gvdwal/tt7.1_a_dev/pttstp/pstpapihand0, 04/01/05 [08:39], From gvdwal
For tscfg2100
C:\>bic_info -w otscfg2100
---------------------------OBJECT IDENTS--------------------------------
@(#)/d10/BAAN50/bse/application/tsB50_c_wrk/ptscfg/pcfg2100g, 02/05/16 [13:03], From dalvarez
For tscfg2500
C:\>bic_info -w otscfg2500
---------------------------OBJECT IDENTS--------------------------------
@(#)/d10/BAAN50/bse/application/tsB50_c_wrk/ptscfg/pcfg2500g, 03/05/01 [13:09], From kkishor1
Hope this helps
regards
Marco
zakir_h
21st July 2004, 17:57
Hi Marco,
Will check on the versions of the objects and let u know. In the meantime
having looked at your code, i was a bit puzzled because, in line # 30 u are putting the value in tscfg200.cogr as "0100", then how come when u get the field value in test.obgr it returns a different value i.e; "ws " as seen in your debug shot.
zakir
Baan OpenWorld
22nd July 2004, 16:23
Hello Zakir
Looking at the code, it appears to default the object group (first to blank) and then looks up Service Item Data for object group (WS in my case). Workaround which solved the problem, after the stpapi.insert and before the stpapi.save I re-put the object group field (stpapi.put.field("........."), ....., "0100") ) and that solved the problem. You may want to try that.
regards
Marco
zakir_h
25th July 2004, 10:42
Hi Marco,
I have tried what u have said ,but it doesn't seem to work with me. Below is the code which i modified i.e; i re-put the object group after insert and then called the stpapi.save command.
-******************
stpapi.put.field("tscfg2100s000","tscfg200.ccfg",new.ccfg)
stpapi.put.field("tscfg2100s000","tscfg200.crob",tsafi004.crob)
stpapi.put.field("tscfg2100s000","tscfg200.desc",temp.crob.desc)
stpapi.put.field("tscfg2100s000","tscfg200.oseq","1")
stpapi.put.field("tscfg2100s000","tscfg200.sear",toupper$(temp.crob.desc(1;16)))
stpapi.put.field("tscfg2100s000","tscfg200.obtp",str$(etol(tscfg.obtp.product)))
stpapi.put.field("tscfg2100s000","tscfg200.cogr",temp.obgr)
stpapi.put.field("tscfg2100s000","tscfg200.mobl",str$(etol(tcyesno.no)))
stpapi.put.field("tscfg2100s000","tscfg200.incc",str$(etol(tcyesno.no)))
stpapi.put.field("tscfg2100s000","tscfg200.dldt",str$(utc.num())) stpapi.put.field("tscfg2100s000","tscfg200.indt",str$(date.num()))
stpapi.put.field("tscfg2100s000","tscfg200.cndt",str$(utc.num()))
stpapi.put.field("tscfg2100s000","tscfg200.manu",str$(etol(tscfg.manu.party)))
retval = stpapi.insert("tscfg2500m000",false,err.mesg)
| It still returns the error message " Object Group not allowed"
stpapi.put.field("tscfg2100s000","tscfg200.cogr",temp.obgr)
retval = stpapi.save("tscfg2100s000",err.mesg)
if not retval then
err.mesg=""
stpapi.recover("tscfg2100s000",recover.msg)
endif
-****************
I have also tried putting in all the key fields again after the insert, but still
the record is not inserted.
Can u tell me what exactly have u done, so that i can simulate it in the same way.
regards
zakir
Baan OpenWorld
26th July 2004, 23:23
Hello Zakir,
The following is the exact code that I used... if it does not work... I would check the objects that I previously mentioned.
|********************************
long ret.orview, ret.orline, retval
string err.mesg(256)
domain tscfg.cogr test.obgr
#pragma used dll ottstpapihand
function main()
{
stpapi.put.field("tscfg2500m000","tscfg2500.ccfg","300000.1")
ret.orview= stpapi.change.view("tscfg2500m000",err.mesg)
if ret.orview = 1 then
ret.orline = stpapi.synchronize.dialog("tscfg2500m000","add",err.mesg)
if ret.orline then
stpapi.put.field("tscfg2100s000","tscfg200.ccfg","300000.1")
stpapi.put.field("tscfg2100s000","tscfg200.crob"," 280067 ")
stpapi.put.field("tscfg2100s000","tscfg200.desc","MM-Test")
stpapi.put.field("tscfg2100s000","tscfg200.oseq","1")
stpapi.put.field("tscfg2100s000","tscfg200.sear","MM-TEST")
stpapi.put.field("tscfg2100s000","tscfg200.obtp",str$(etol(tscfg.obtp.product)))
stpapi.put.field("tscfg2100s000","tscfg200.cogr","0100")
stpapi.put.field("tscfg2100s000","tscfg200.mobl",str$(etol(tcyesno.no)))
stpapi.put.field("tscfg2100s000","tscfg200.incc",str$(etol(tcyesno.no)))
stpapi.put.field("tscfg2100s000","tscfg200.dldt",str$(utc.num()))
stpapi.put.field("tscfg2100s000","tscfg200.indt",str$(date.num()))
stpapi.put.field("tscfg2100s000","tscfg200.cndt",str$(utc.num()))
stpapi.put.field("tscfg2100s000","tscfg200.manu",str$(etol(tscfg.manu.party)))
retval = stpapi.insert("tscfg2500m000",false,err.mesg)
|THE AFS returns an error message "object group not allowed"
stpapi.put.field("tscfg2100s000","tscfg200.cogr","0100")
stpapi.get.field("tscfg2100s000","tscfg200.cogr",test.obgr)
if not retval then
err.mesg=""
stpapi.recover("tscfg2100s000",err.mesg)
else
retval = stpapi.save("tscfg2500m000",err.mesg)
endif
endif
endif
stpapi.end.session("tscfg2100s000", err.mesg)
stpapi.end.session("tscfg2500m000", err.mesg)
|********************************
Hope this helps.
regards
Marco
zakir_h
27th July 2004, 17:31
Hi Marco,
I just noticed that in the line before the command stpapi.change.view(...),i.e; the field name 'tscfg2500.ccfg' u r stuffing the value into should actually be 'tscfg200.ccfg'.
In anycase , i now get a diff. error while setting the view of the session 'tscfg2500m000' i.e; stpapi.change.view(...) returns a value of 2. This error was coming all the time, i was not able to notice it b'coz the stpapi.put.field(....) for the lines session 'tscfg2100s000' was outside this condition.
Pls. find attached the info of the objects and a snapshot of the debug mode.
Is the error 'Object group not allowed related to the view not being set... or is it something else. This is completely driving me crazy..... I have used the set view in one my earlier AFS and works perfectly fine.. So any help would be appreciated.
Baan OpenWorld
30th July 2004, 00:01
Hello Zakir
I changed the field to be 'tscfg200.ccfg' and it still worked. (Probably because I was dealing with only one record in the table [tscfg200]). However, I would update your standard objects. Your apihandler (ttstpapihand) is from 04/05/03 (mine is 04/01/05), however you session objects are upto date.
Hope this helps
regards
Marco
zakir_h
15th August 2004, 19:37
Hi marco,
I have tried updating my standard objects to the latest ones, but still i get the error message. write now i can't proceed b'coz this AFS is very critical.
i am really confused as to what might be causing the problem at my end.
r
zakir