Agus Mujtahid
25th June 2009, 08:35
Dear All,
We have problem when we run AFS for session Production Order, we got error "Item not Allowed". In this case i am use segmented item for field tisfc001.mitm.(for detail, see attahment).
this is my script :
long ret.syn
long ret.insert
long ret.recover
|string error.msg
message(item.afs(1;9)&" , "&item.afs(10;len(item.afs)-9))
message("series= "&series&"item.afs= "&item.afs&" qty.generate= "&str$(qty.generate)&" routing= "&routing&"str$(etol(tcplcd.backward))= "&str$(etol(tcplcd.backward)))
ret.syn=stpapi.synchronize.dialog("tisfc0501m000","add",error.msg)
message("ret.syn= "&str$(ret.syn))
if ret.syn=1 then
stpapi.put.field("tisfc0101s000","tisfc001.pdno",series)
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.1",item.afs(1;9))
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.2",item.afs(10;len(item.afs)-9))
stpapi.put.field("tisfc0101s000","tisfc001.revi","0")
stpapi.put.field("tisfc0101s000","tisfc001.qrdr",str$(qty.generate))
stpapi.put.field("tisfc0101s000","tisfc001.cwar","P4FGS")
stpapi.put.field("tisfc0101s000","tisfc001.opro",routing)
stpapi.put.field("tisfc0101s000","tisfc001.efdt",str$(utc.num()))
stpapi.put.field("tisfc0101s000","tisfc001.cpla",str$(etol(tcplcd.backward)))
stpapi.put.field("tisfc0101s000","tisfc001.rdld",str$(utc.num()))
stpapi.enum.answer("tisfc0101s000","tisfc01017",tcyesno.yes)
ret.insert=stpapi.insert("tisfc0501m000",true,error.msg)
|error.msg.retrieved=stpapi.get.mess.code("tisfc0101s000",error.msg)
message(" ret.insert= "&str$(ret.insert))
message(error.msg)
if ret.insert=0 then
ret.recover=stpapi.recover("tisfc0101s000",error.msg)
endif
endif
|no.order=tisfc001.pdno
stpapi.end.session("tisfc0501m000",error.msg)
|message(no.order)
Please help me about it, what wrong with my script?
Thanks
Regards,
Mujtahid
som.papai
25th June 2009, 09:13
Hi Mujtahid
I think here session "tisfc0501m000" should be replace by "tisfc0101s000".
ret.insert=stpapi.insert("tisfc0501m000",true,error.msg)
We are generating Production Order AFS through below script.
ret_val = stpapi.find("tisfc0101s000", error)
stpapi.form.command("tisfc0101s000", 5, "exec.add.set",error)
stpapi.put.field( "tisfc0101s000", "tisfc001.pdno", timsl304.pdsr)
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.1","")
stpapi.put.field( "tisfc0101s000", "tisfc001.mitm.segment.2", shiftl$(strip$(timsl305.mitm)))
stpapi.put.field( "tisfc0101s000", "tisfc001.qrdr", str$(timsl305.qnty))
stpapi.put.field( "tisfc0101s000", "tisfc001.cwar", timsl301.dwar)
stpapi.put.field( "tisfc0101s000", "tisfc001.opro", timsl301.opro)
stpapi.put.field("tisfc0101s000", "tisfc001.rdld", str$(timsl305.ddat))
stpapi.put.field("tisfc0101s000", "tisfc001.cdld", str$(timsl305.ddat))
ret_val=stpapi.insert("tisfc0101s000", true, error)
.......
stpapi.end.session("tisfc0101s000", error)
Hope this will help.
Agus Mujtahid
25th June 2009, 11:36
OK, Thanks very much
I have been Tried like your suggestion. I change my script like this (i tried 2 script), but we got the same error, "Item not allowed".
is there other idea?
thanks
Mujtahid
function afs.generate.po.1()
{
long ret.syn
long ret.insert
long ret.recover
ret.syn=stpapi.find("tisfc0101s000",error.msg)
stpapi.form.command("tisfc0101s000", 5, "exec.add.set",error.msg)
stpapi.put.field("tisfc0101s000","tisfc001.pdno",series)
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.1","")
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.2",shiftl$(strip$(item.afs)))
stpapi.put.field("tisfc0101s000","tisfc001.revi","0")
stpapi.put.field("tisfc0101s000","tisfc001.qrdr",str$(qty.generate))
stpapi.put.field("tisfc0101s000","tisfc001.cwar","P4FGS")
stpapi.put.field("tisfc0101s000","tisfc001.opro",routing)
stpapi.put.field("tisfc0101s000","tisfc001.efdt",str$(utc.num()))
stpapi.put.field("tisfc0101s000","tisfc001.cpla",str$(etol(tcplcd.backward)))
stpapi.put.field("tisfc0101s000","tisfc001.rdld",str$(utc.num()))
ret.insert=stpapi.insert("tisfc0101s000",true,error.msg)
stpapi.end.session("tisfc0101s000",error.msg)
}
function afs.generate.po.2()
{
long ret.syn
long ret.insert
long ret.recover
|string error.msg
message(item.afs(1;9)&" , "&item.afs(10;len(item.afs)-9))
message("series= "&series&"item.afs= "&item.afs&" qty.generate= "&str$(qty.generate)&" routing= "&routing&"str$(etol(tcplcd.backward))= "&str$(etol(tcplcd.backward)))
ret.syn=stpapi.synchronize.dialog("tisfc0501m000","add",error.msg)
message("ret.syn= "&str$(ret.syn))
if ret.syn=1 then
stpapi.put.field("tisfc0101s000","tisfc001.pdno",series)
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.1","")
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.2",shiftl$(strip$(item.afs)))
stpapi.put.field("tisfc0101s000","tisfc001.revi","0")
stpapi.put.field("tisfc0101s000","tisfc001.qrdr",str$(qty.generate))
stpapi.put.field("tisfc0101s000","tisfc001.cwar","P4FGS")
stpapi.put.field("tisfc0101s000","tisfc001.opro",routing)
stpapi.put.field("tisfc0101s000","tisfc001.efdt",str$(utc.num()))
stpapi.put.field("tisfc0101s000","tisfc001.cpla",str$(etol(tcplcd.backward)))
stpapi.put.field("tisfc0101s000","tisfc001.rdld",str$(utc.num()))
stpapi.enum.answer("tisfc0101s000","tisfc01017",tcyesno.yes)
ret.insert=stpapi.insert("tisfc0101s000",true,error.msg)
message(" ret.insert= "&str$(ret.insert))
message(error.msg)
if ret.insert=0 then
ret.recover=stpapi.recover("tisfc0101s000",error.msg)
endif
endif
|no.order=tisfc001.pdno
stpapi.end.session("tisfc0501m000",error.msg)
|message(no.order)
}
mark_h
25th June 2009, 14:54
Do you have source code that you can put in debug mode? That would allow you to see what is getting into the item field for tisfc0101s000. Sorry can't help a whole lot on segmented items since we use 4c4.
Agus Mujtahid
26th June 2009, 07:11
Hi this is my latest script:
function afs.generate.po()
{
long ret.syn
long ret.insert
long ret.recover
ret.syn=stpapi.synchronize.dialog("tisfc0501m000","add",error.msg)
message("ret.syn= "&str$(ret.syn))
if ret.syn=1 then
stpapi.put.field("tisfc0101s000","tisfc001.pdno",series)
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.1",item.afs(1;9))
stpapi.put.field("tisfc0101s000","tisfc001.mitm.segment.2",item.afs(10;len(item.afs)-9))
stpapi.put.field("tisfc0101s000","tisfc001.revi",str$(revisi))
stpapi.put.field("tisfc0101s000","tisfc001.qrdr",str$(qty.generate))
stpapi.put.field("tisfc0101s000","tisfc001.cwar",warehouse)
stpapi.put.field("tisfc0101s000","tisfc001.opro",routing)
stpapi.put.field("tisfc0101s000","tisfc001.efdt",str$(reference.date))
stpapi.put.field("tisfc0101s000","tisfc001.cpla",str$(planning.met))
stpapi.put.field("tisfc0101s000","tisfc001.rdld",str$(requirement.date))
stpapi.enum.answer("tisfc0101s000","tisfc01017",tcyesno.yes)
ret.insert=stpapi.insert("tisfc0501m000",true,error.msg)
message(" ret.insert= "&str$(ret.insert))
message(error.msg)
if ret.insert=0 then
ret.recover=stpapi.recover("tisfc0101s000",error.msg)
endif
endif
stpapi.end.session("tisfc0501m000",error.msg)
}
i compiled it with debugger option and i got the debugger for it AFS. i have screen shoot for latest error and i give the latest AFS.Log(see attachment)
In the latest process, error "Not Allowed" still occur.
Please help me to solve it, thanks
Mujtahid
mark_h
26th June 2009, 17:19
What I meant was - can you put tisfc0101s000 in debug mode? This would allow you to see what item you are putting into the session. This might allow you to fix you stpapi.put statements. Plus there is always a possibility that tisfc0101s000 has code for api mode that might be causing the problem.
Agus Mujtahid
29th June 2009, 05:55
Hi, we run it with debugger tisfc0101s000, but we cannot rich it until finish (see attachment).
mark_h
29th June 2009, 15:35
While tisfc0101m000 is in debug mode can you just put a break point on one of the input events for tisfc001.mitm? What you happen - hopefully - is when you do the stpapi.put for tisfc001.mitm this event is executed. Then you can see what is in tisfc001.mitm. I am sorry but the only version of baan I have worked with is 4c4.
Agus Mujtahid
2nd July 2009, 04:27
Hi, we solved it problems.
We use segmented item to treat it and we were not use "stpapi.put" on revision field&Reference date field, and we use "stpapi.put" on production start date field.Everything go on, the program insert new production order number and we can continue the process to release it.I think we got what we want. Thanks you very much
Mujtahid