vikky28
9th March 2012, 12:02
Need your help as I am stuck in maintaing simple AFS session. It is baan5 and service pack 11.
the session name is copy item production session. Source item and target item given, also tick copy bom and copy routing in session tiipd0202m000. When I click on copy button manually it is working fine.

The same thing I wanted to do through AFS and I write below code :
main.item = " " & "STF-RO-S-TEST-18"
temp.item = " " & "STF-RO-S-TEST-23"

stpapi.put.field("tiipd0202m000","source.item.1","")
stpapi.put.field("tiipd0202m000","source.item.2",shiftl$(strip$(main.item)))
stpapi.put.field("tiipd0202m000","target.item.1","")
stpapi.put.field("tiipd0202m000","target.item.2",shiftl$(strip$(temp.item)))
stpapi.put.field("tiipd0202m000","copy.bom",str$(etol(tcyesno.yes)))
stpapi.put.field("tiipd0202m000","copy.routing",str$(etol(tcyesno.yes)))
stpapi.form.command("tiipd0202m000",5,"continue.process",err)
if(not isspace(err)) then
message("Error! %s",err)
endif
stpapi.end.session("tiipd0202m000",err)


Error : Items not availbe in general item. Unable to find out the error. As it is working fine in manually but not through AFS. Please correct me if I am doing wrong codding.
Thanks.

vikky28
9th March 2012, 12:14
problem is solved now.
Thanks

mark_h
9th March 2012, 15:56
Can I ask what the solution was? I mean at first glance the code seems okay.

vikky28
12th March 2012, 10:47
The correct solution for this:
stpapi.put.field("tiipd0202m000","source.item.segment.1","")
stpapi.put.field("tiipd0202m000","source.item.segment.2",shiftl$(strip$(main.item)))
stpapi.put.field("tiipd0202m000","source.dsca",str$(tcibd001.dsca))
stpapi.put.field("tiipd0202m000","target.item.segment.1","")
stpapi.put.field("tiipd0202m000","target.item.segment.2",shiftl$(strip$(temp.item)))
Here the field name is source.item as it is segmented domain "tcitem" so has to be like source.item.segment.1. I hope you will get answer.

Thanks.