tomzak
14th December 2009, 12:40
Hallo @all
i'm writing a function to insert data via AFS into a table. This table is created by us. It has a dynamic session with the session type "display" and the window type "modal window with menu" as main. Then there is a secend session with session type "maintain" and window type "list window". My code to insert data is the following:
retVal = stpapi.browse.set("lhpai0154m000","last.set",w.err.msg)
retVal = stpapi.mark("lhpai0154m000",w.err.msg)
retVal = stpapi.synchronize.dialog("lhpai0154m000", "add", error.msg)
| retVal = stpapi.synchronize.dialog("lhpai0154m000", "modify", error.msg)
if (retVal = 0) then
return (retVal)
endif
stpapi.put.field("lhpai0154s000", "lhpai054.year", str$(p.year))
stpapi.put.field("lhpai0154s000", "lhpai054.prod", str$(p.prod))
stpapi.put.field("lhpai0154s000", "lhpai054.sern", str$(CheckSern(p.year, p.prod)))
stpapi.put.field("lhpai0154s000", "lhpai054.emnp", str$(p.emnp))
stpapi.put.field("lhpai0154s000", "lhpai054.pdno", str$(p.pdno))
stpapi.put.field("lhpai0154s000", "lhpai054.opno", str$(p.opno))
stpapi.put.field("lhpai0154s000", "lhpai054.cprj", str$(p.cprj))
stpapi.put.field("lhpai0154s000", "lhpai054.cwoc", str$(p.cwoc))
stpapi.put.field("lhpai0154s000", "lhpai054.ccos", str$(p.ccos))
stpapi.put.field("lhpai0154s000", "lhpai054.gmka", str$(p.gmka))
stpapi.put.field("lhpai0154s000", "lhpai054.izst", str$(p.izst))
stpapi.put.field("lhpai0154s000", "lhpai054.ddtp", str$(p.ddtp))
retVal = stpapi.insert("lhpai0154s000", 1, error.msg)
| retVal = stpapi.update("lhpai0154s000", 1, error.msg)
if (retVal = 0) then
rc = stpapi.recover("lhpai0154s000", w.err.msg)
endif
When i execute the code then I get an errormessage "Command disabled" at the stpapi.insert. When I change the "add" and "insert" to "modify" and "update" then the record is updated correctly. Has anyone an idea what's wrong in my code
thank's
Thomas
i'm writing a function to insert data via AFS into a table. This table is created by us. It has a dynamic session with the session type "display" and the window type "modal window with menu" as main. Then there is a secend session with session type "maintain" and window type "list window". My code to insert data is the following:
retVal = stpapi.browse.set("lhpai0154m000","last.set",w.err.msg)
retVal = stpapi.mark("lhpai0154m000",w.err.msg)
retVal = stpapi.synchronize.dialog("lhpai0154m000", "add", error.msg)
| retVal = stpapi.synchronize.dialog("lhpai0154m000", "modify", error.msg)
if (retVal = 0) then
return (retVal)
endif
stpapi.put.field("lhpai0154s000", "lhpai054.year", str$(p.year))
stpapi.put.field("lhpai0154s000", "lhpai054.prod", str$(p.prod))
stpapi.put.field("lhpai0154s000", "lhpai054.sern", str$(CheckSern(p.year, p.prod)))
stpapi.put.field("lhpai0154s000", "lhpai054.emnp", str$(p.emnp))
stpapi.put.field("lhpai0154s000", "lhpai054.pdno", str$(p.pdno))
stpapi.put.field("lhpai0154s000", "lhpai054.opno", str$(p.opno))
stpapi.put.field("lhpai0154s000", "lhpai054.cprj", str$(p.cprj))
stpapi.put.field("lhpai0154s000", "lhpai054.cwoc", str$(p.cwoc))
stpapi.put.field("lhpai0154s000", "lhpai054.ccos", str$(p.ccos))
stpapi.put.field("lhpai0154s000", "lhpai054.gmka", str$(p.gmka))
stpapi.put.field("lhpai0154s000", "lhpai054.izst", str$(p.izst))
stpapi.put.field("lhpai0154s000", "lhpai054.ddtp", str$(p.ddtp))
retVal = stpapi.insert("lhpai0154s000", 1, error.msg)
| retVal = stpapi.update("lhpai0154s000", 1, error.msg)
if (retVal = 0) then
rc = stpapi.recover("lhpai0154s000", w.err.msg)
endif
When i execute the code then I get an errormessage "Command disabled" at the stpapi.insert. When I change the "add" and "insert" to "modify" and "update" then the record is updated correctly. Has anyone an idea what's wrong in my code
thank's
Thomas