Ajesh
27th March 2018, 12:03
Dear All

I am trying to write an AFS session for the above mentioned session.




stpapi.clear("tipcs2230m000")
stpapi.put.field("tipcs2230m000", "orig.item.segment.1", "")
stpapi.put.field("tipcs2230m000", "orig.item.segment.2", file.stnd.item)
stpapi.put.field("tipcs2230m000", "copy.item.segment.1", file.cprj)
stpapi.put.field("tipcs2230m000", "copy.item.segment.2", file.cust.item)


stpapi.put.field("tipcs2230m000", "use.cfdt", str$(etol(form.ref.check)))
stpapi.put.field("tipcs2230m000", "eff.date", str$(form.ref.date))
stpapi.put.field("tipcs2230m000", "copy.structure", str$(etol(form.meth.prod.struct)))
stpapi.put.field("tipcs2230m000", "copy.items", str$(etol(form.meth.for.items)))
stpapi.put.field("tipcs2230m000", "copy.erela", str$(etol(form.e.item)))
stpapi.put.field("tipcs2230m000", "copy.alt.mat", str$(etol(form.alter.mat)))
stpapi.put.field("tipcs2230m000", "copy.use.up.mat", str$(etol(form.use.up.mat)))
stpapi.put.field("tipcs2230m000", "new.cust.comp", str$(etol(form.gen.item.code)))
stpapi.put.field("tipcs2230m000", "ask.user.conf", str$(etol(form.ask.bef.gen)))
stpapi.put.field("tipcs2230m000", "approve.cfs", str$(etol(form.approve.conv.factor)))


stpapi.form.command("tipcs2230m000", 5,"continue.process",error.msg)
stpapi.get.field("tipcs2230m000", "copy.structure", string.prod.struct)
form.meth.prod.struct = ltoe(lval(string.prod.struct))
string.prod.struct = enum.descr$("ticpst", form.meth.prod.struct, "2")

stpapi.get.field("tipcs2230m000", "copy.items", string.for.items)
form.meth.for.items = ltoe(lval(string.for.items))
string.for.items = enum.descr$("ticpit", form.meth.for.items, "2")
error.msg = "Test Message"
while not isspace(error.msg)
error.code = stpapi.get.mess.code("tipcs2230m000", error.msg)
endwhile
if not isspace(error.msg) then
brp.ready(brp_id1)
else
error.msg = "Product Structure has been Copied."
brp.ready(brp_id1)
endif



But what i have observed is that Standard Item is getting copied to Customized Item but BOM is not getting copied. I have tried fetching all the messages but to no avail.

Any Clues?

Ajesh
31st March 2018, 09:57
The Date was getting passed as a Normal Date rather than UTC. That was the problem.

Now theres another issue, Suppose if a BOM has multiple sequence in one position then only one sequence is getting copied.