Dhananjay
28th June 2011, 14:31
We are trying to create an AFS which will read main item, revision, component, component qty. from the file and use the AFS to inset the BOM.

Problem is that we always get an error "Engg. item not found in engg item table". Can anyone please verify the code given below and let me know what sequence of commands are needed. Session tiedm1510m000 invokes a subsession tiedm1110s000 on clicking "new" choice.
BOM for main item is not preset still AFS gives an error.

AFS code:

tiedm1510m000f.put.Engineering_Item(file.item)
tiedm1510m000f.get.Engineering_Item()
tiedm1510m000f.put.Revision(hold.rev)
tiedm1510m000f.get.Engineering_Item()

tiedm1510m000f.handle.sub.process("tiedm1110s000", "add")
tiedm1110s000f.set.view(error)
tiedm1110s000f.put.Engineering_Item(file.item)
tiedm1110s000f.put.Revision.tiedm110.revi(hold.rev)
pono = lval(hold.pono)
tiedm1110s000f.put.Position_Number(pono)
item.type = tiedm.cmtp.eitm
tiedm1110s000f.put.Component_Type(item.type)
tiedm1110s000f.put.Component(component)
"After execution of this line we get an error mentioned above"

net.quantity = lval(hold.netqty)
tiedm1110s000f.put.Net_Quantity(net.quantity)
tiedm1110s000f.insert(1,error)

abby13
28th June 2011, 14:34
On which version of Baan are you there?

Dhananjay
28th June 2011, 14:35
I'm on Baan V c

mark_h
28th June 2011, 16:22
We are trying to create an AFS which will read main item, revision, component, component qty. from the file and use the AFS to inset the BOM.

Problem is that we always get an error "Engg. item not found in engg item table". Can anyone please verify the code given below and let me know what sequence of commands are needed. Session tiedm1510m000 invokes a subsession tiedm1110s000 on clicking "new" choice.
BOM for main item is not preset still AFS gives an error.

AFS code:

tiedm1510m000f.put.Engineering_Item(file.item)
tiedm1510m000f.get.Engineering_Item()
tiedm1510m000f.put.Revision(hold.rev)
tiedm1510m000f.get.Engineering_Item()

tiedm1510m000f.handle.sub.process("tiedm1110s000", "add")
tiedm1110s000f.set.view(error)
tiedm1110s000f.put.Engineering_Item(file.item)
tiedm1110s000f.put.Revision.tiedm110.revi(hold.rev)
pono = lval(hold.pono)
tiedm1110s000f.put.Position_Number(pono)
item.type = tiedm.cmtp.eitm
tiedm1110s000f.put.Component_Type(item.type)
tiedm1110s000f.put.Component(component)
"After execution of this line we get an error mentioned above"

net.quantity = lval(hold.netqty)
tiedm1110s000f.put.Net_Quantity(net.quantity)
tiedm1110s000f.insert(1,error)
Do you have to do this using the tiedm1510m000? I notice you put some fields, but don't do anything with them - no find or anything. Then you start the tiedms1110s000f session. Then you do a set view on the tiedm1110s000 subsession without putting any fields. So not exactly sure what you are trying to do.

This my code on 4c4 for our system, straight to tiemd0110m000

stpapi.put.field( "tiedm0110m000", "tiedm010.eitm", eitm)
stpapi.put.field( "tiedm0110m000", "tiedm010.dsca", dsca)
stpapi.put.field( "tiedm0110m000", "tiedm010.seak", seak)
stpapi.put.field( "tiedm0110m000", "tiedm010.seab", seab)
stpapi.put.field( "tiedm0110m000", "tiedm010.prdr", str$(tcyesno.no))
stpapi.put.field( "tiedm0110m000", "tiedm010.eigp", "ETM")
stpapi.put.field( "tiedm0110m000", "tiedm010.kitm", str$(tckitm.manufacture))
stpapi.put.field( "tiedm0110m000", "tiedm010.citg", "ENGITM")
stpapi.put.field( "tiedm0110m000", "tiedm010.uset", "ALL")
stpapi.put.field( "tiedm0110m000", "tiedm010.cuni", "EA")
stpapi.put.field( "tiedm0110m000", "tiedm010.unom", "1")
stpapi.put.field( "tiedm0110m000", "tiedm010.opol", str$(tcopol.anonymous))
stpapi.put.field( "tiedm0110m000", "tiedm010.effe.a", str$(tiitm.effe.a.unit))
rc = stpapi.insert( "tiedm0110m000", 1, msg )
if not isspace(msg) then
| Clear out what was done, do not worry about some.msg yet
rc = stpapi.recover("tiedm0110m000", some.msg)
| End the session.
stpapi.end.session("tiedm0110m000")
return
endif
stpapi.end.session("tiedm0110m000")

Dhananjay
30th June 2011, 13:07
Hi Mark,
Thank you for your reply. The requirement is we need to enter new egg. BOM items through AFS.
The main session is tiedm1510m000 where we add the main item with revision.
In the subsession tiedm1110s000 we add component item with qty.
I have attached the process flow.

We started from the main session which is tiedm1510m000 and we added the item since it's a new group.

tiedm1510m000f.put.Engineering_Item(file.item)
tiedm1510m000f.get.Engineering_Item()
tiedm1510m000f.put.Revision(hold.rev)
tiedm1510m000f.get.Engineering_Item()

After that by starting the subsession we tried to add component items along with the qty.

tiedm1510m000f.handle.sub.process("tiedm1110s000", "add")
tiedm1110s000f.set.view(error)
tiedm1110s000f.put.Engineering_Item(file.item)
tiedm1110s000f.put.Revision.tiedm110.revi(hold.rev)
pono = lval(hold.pono)
tiedm1110s000f.put.Position_Number(pono)
item.type = tiedm.cmtp.eitm
tiedm1110s000f.put.Component_Type(item.type)
tiedm1110s000f.put.Component(component)

net.quantity = lval(hold.netqty)
tiedm1110s000f.put.Net_Quantity(net.quantity)
tiedm1110s000f.insert(1,error)

when we debug it, at the end we get an error "Engg. item not found in engg item table".

This is wrong because the item is present in engg item table. Still we get this error. We thought that it might be a programming error. Can you please help me in this? I have also attached the process flow.

mark_h
30th June 2011, 15:29
Okay - so you have to call tiedm1510m000 and on our system this is a display session. Your profile says C4, but the screen shots look like Baan 5 or LN. From looking at your screen shot I can propose some changes, but can not be positive. What I expect the code to look like.

tiedm1510m000f.put.Engineering_Item(file.item)
tiedm1510m000f.put.Revision(hold.rev)
tiedm1510m000f.handle.sub.process("tiedm1110s000", "add")
stpapi.insert( "tiedm1510m000", 1, error ) | < The equivalent for your system like hitting new button.
tiedm1110s000f.put.Engineering_Item(file.item)
tiedm1110s000f.put.Revision.tiedm110.revi(hold.rev)
pono = lval(hold.pono)
tiedm1110s000f.put.Position_Number(pono)
item.type = tiedm.cmtp.eitm
tiedm1110s000f.put.Component_Type(item.type)
tiedm1110s000f.put.Component(component)
net.quantity = lval(hold.netqty)
tiedm1110s000f.put.Net_Quantity(net.quantity)
tiedm1110s000f.insert(1,error)

This is what I would expect if this was an input session on our 4c4 system. Now the next issue I potentially see is that it looks like a segmented item. That usually requires something else. Let me try a search on this forum.

mark_h
30th June 2011, 15:34
Yep you can search this forum for segmented item and see multiple threads to get that correct. This is just thread I found (http://www.baanboard.com/baanboard/showthread.php?t=56214&highlight=segmented+item). There are others that talk about using segment 3. I can't help with that since I am on 4c4 and we have nothing like that.