sachinbaan
6th May 2014, 12:04
Hi,

I am following below procedure,

1. Generating Installment through AFS.

2. Now using form command i m opening session of "contract Shipment"

3. here i want check "Linked" field to "yes", though AFS, but its not getting.

written below code.
function extern domain tcbool ltpindllafscal.tppin4151m000.link.shipment(
domain tccono i.cono, domain tpctm.cnln i.cnln,
domain tcpono i.dlvr, domain tcpono i.schd,
domain tccprj i.cprj, domain tppdm.cspa i.cspa,
domain tppss.cpla i.cpla, domain tppdm.cact i.cact,
domain whinh.shpm i.shpm, domain tcpono i.pono,
domain tppdm.nins i.nins, ref string error.msg)

{
long ret
ret = stpapi.find("tppin4151m000", error.msg)
if ret = 1 then
stpapi.put.field("tppin4151m000", "tppin020.cono", i.cono)
stpapi.put.field("tppin4151m000", "tppin020.cnln", i.cnln)
stpapi.put.field("tppin4151m000", "tppin020.nins", str$(i.nins))

ret = stpapi.find("tppin4151m000", error.msg)
if ret = 1 then
if ret then
stpapi.form.command("tppin4151m000", 5, "start.shipments", error.msg)
if isspace(error.msg) then
stpapi.put.field("tppin0160m000", "tppin060.cono", i.cono)
stpapi.put.field("tppin0160m000", "tppin060.cnln", i.cnln)
stpapi.put.field("tppin0160m000", "tppin060.dlvr", str$(i.dlvr))
stpapi.put.field("tppin0160m000", "tppin060.schd", str$(i.schd))
stpapi.put.field("tppin0160m000", "tppin060.cprj", i.cprj)
stpapi.put.field("tppin0160m000", "tppin060.cspa", str$(i.cspa))
stpapi.put.field("tppin0160m000", "tppin060.cpla", str$(i.cpla))
stpapi.put.field("tppin0160m000", "tppin060.cact", str$(i.cact))
stpapi.put.field("tppin0160m000", "tppin060.shpm", i.shpm)
stpapi.put.field("tppin0160m000", "tppin060.pono", str$(i.pono))

ret = stpapi.find("tppin0160m000", error.msg)

if ret = 1 then
ret = stpapi.synchronize.dialog("tppin0160m000", "modify", error.msg)
if ret then
stpapi.put.field("tppin0160m000", "tppin060.link", str$(etol(tcyesno.yes))) ret = stpapi.update("tppin0160m000", true, error.msg)

if ret then
stpapi.end.session("tppin0160m000")
return(true)
else
stpapi.end.session("tppin0160m000")
stpapi.end.session("tppin4151m000")
return(false)
endif
endif
endif
else
stpapi.end.session("tppin4151m000")
return(false)
endif
else
stpapi.end.session("tppin4151m000")
return(false)
endif
else
stpapi.end.session("tppin4151m000")
return(false)
endif
else
return(false)
endif
stpapi.end.session("tppin0160m000")
return(true)
}

bhushanchanda
6th May 2014, 12:50
Hi,

Have you tried assigning str$(1)?

mark_h
6th May 2014, 19:41
Moved to the correct forum. And from looking at the code I see where you set the field in question:

if ret = 1 then
ret = stpapi.synchronize.dialog("tppin0160m000", "modify", error.msg)
if ret then
stpapi.put.field("tppin0160m000", "tppin060.link", str$(etol(tcyesno.yes)))

But I do not see where you save the value - either stpapi.save or update should follow the put.

sachinbaan
7th May 2014, 06:19
hi,

i have done following , but still no effect...


function extern domain tcbool ltpindllafscal.tppin4151m000.link.shipment(
domain tccono i.cono, domain tpctm.cnln i.cnln,
domain tcpono i.dlvr, domain tcpono i.schd,
domain tccprj i.cprj, domain tppdm.cspa i.cspa,
domain tppss.cpla i.cpla, domain tppdm.cact i.cact,
domain whinh.shpm i.shpm, domain tcpono i.pono,
domain tppdm.nins i.nins, ref string error.msg)

{
long ret

ret = stpapi.find("tppin4151m000", error.msg)
if ret = 1 then
stpapi.put.field("tppin4151m000", "tppin020.cono", i.cono)
stpapi.put.field("tppin4151m000", "tppin020.cnln", i.cnln)
stpapi.put.field("tppin4151m000", "tppin020.nins", str$(i.nins))

ret = stpapi.find("tppin4151m000", error.msg)
if ret = 1 then
if ret then
stpapi.handle.subproc("tppin4151m000","tppin0160m000","search")
stpapi.form.command("tppin4151m000", 5, "start.shipments", error.msg)
if isspace(error.msg) then
stpapi.put.field("tppin0160m000", "tppin060.cono", i.cono)
stpapi.put.field("tppin0160m000", "tppin060.cnln", i.cnln)
stpapi.put.field("tppin0160m000", "tppin060.dlvr", str$(i.dlvr))
stpapi.put.field("tppin0160m000", "tppin060.schd", str$(i.schd))
stpapi.put.field("tppin0160m000", "tppin060.cprj", i.cprj)
stpapi.put.field("tppin0160m000", "tppin060.cspa", str$(i.cspa))
stpapi.put.field("tppin0160m000", "tppin060.cpla", str$(i.cpla))
stpapi.put.field("tppin0160m000", "tppin060.cact", str$(i.cact))
stpapi.put.field("tppin0160m000", "tppin060.shpm", i.shpm)
stpapi.put.field("tppin0160m000", "tppin060.pono", str$(i.pono))

ret = stpapi.find("tppin0160m000", error.msg)
ret = stpapi.mark("tppin0160m000", error.msg)

if ret = 1 then
ret = stpapi.synchronize.dialog("tppin0160m000", "modify", error.msg)
if ret then
stpapi.put.field("tppin0160m000", "tppin060.link", str$(etol(tcyesno.yes)))
ret = stpapi.update("tppin0160m000", true, error.msg)

if ret then
stpapi.end.session("tppin0160m000")
return(true)
else
stpapi.end.session("tppin0160m000")
stpapi.end.session("tppin4151m000")
return(false)
endif
endif
endif
else
stpapi.end.session("tppin4151m000")
return(false)
endif
else
stpapi.end.session("tppin4151m000")
return(false)
endif
else
stpapi.end.session("tppin4151m000")
return(false)
endif
else
return(false)
endif
stpapi.end.session("tppin0160m000")
return(true)
}

mark_h
7th May 2014, 19:30
(1) Not sure about LN but in 4c4 I use tgyenox.no or tgyenox.yes for the domain. Are you sure you have the correct domain for the field?
(2) Did you try a stpapi.save? Not sure about LN, but in 4c4 sometimes I have to play with stpapi.save and stpapi.update to get a record to actually save. One session I know I did an update with false, followed by stpapi.save to actually get the record saved.

vinceco252
7th May 2014, 23:48
Mark,

Just an FYI, tcyesno can be used for checkboxes in LN.

Vince

bhushanchanda
8th May 2014, 13:42
Hi,

I have faced a similar issue with a checkbox, and it was resolved by using str$(1) instead of str$(etol(tcyesno.yes)).

mark_h
8th May 2014, 15:25
Good suggestion bhushan - try that with an update or save.

sachinbaan
9th May 2014, 11:07
hi,

Problem is there with standard session, when m putting str$(1) / str$(etol(tcyesno.yes)), without synchronizing m getting error, "Command disabled", if m synchronizing it, then error comes as "Record Not Found", even in manual process , same problem is there, that particular session is not able to get synhronized...

bhushanchanda
9th May 2014, 12:06
Hi,

You can also try "Modify" instead of "modify". The cases in the command name matters.