Gerrit
22nd November 2004, 14:57
Hello,

Maybe some of you can help me.

I programmed some functionality using the AFS. For a range of customerspecific items tipcs2232m000 (Copy Customized Product Structure to Standard) has to be run. I did this by making a query with easy-sql on tipcs021 and programming the functionality in the reportscript. THe code is put below this :


declaration:
extern domain tcmcs.str50 err.mesg
extern domain tcmcs.long print.regel
long ret

#pragma used dll ottstpapihand

detail.1:
before.layout:
err.mesg = ""
stpapi.put.field("tipcs2232m000","orig.cprj",tipcs021.cprj)
stpapi.put.field("tipcs2232m000","orig.item",tipcs021.item)
stpapi.put.field("tipcs2232m000","copy.item",tipcs021.item)
stpapi.put.field("tipcs2232m000","cust.rc","")
stpapi.put.field("tipcs2232m000","cust.code.dsca","")
stpapi.put.field("tipcs2232m000","copy.structure","1")
stpapi.put.field("tipcs2232m000","copy.erela",str$(etol(tcyesno.no)))
stpapi.continue.process("tipcs2232m000",err.mesg)
stpapi.end.session("tipcs2232m000")

What happens. It looks like that it works. Only the variable err.mesg is filled with the message "Mainitem not allowed". And I don't know why.

Does anyone of you knows.

Regards,
Gerrit

mark_h
22nd November 2004, 15:54
Do you have source for this session? This is pure speculation since I know nothing about the session, but it sounds like one of the field events sets this "mainitem". With source you could debug the script and find out what you need to do to get it to work. With out source you can try this, but no promises that it will work - run ttstpcreatdll. Create a DLL for this session and see what is in it. You may find a put field that may not be on the form. You can try filling it with a put. I never really tried this but it might work.

You can also try a save or update to see if this fills the "mainitem" before doing the continue. Just a couple of things I have had to do to get API funtion servers to work.

Mark