schweizer
19th February 2007, 15:02
Hi folks,
in afs for session tibom1110m000 the procedure is as follow.

stpapi.put.field("tibom1110m000",tibom010.mitm,"l_mitm")
ret = stpapi.change.view("tibom1110m000",o.mess)
while tmp_mitm <> l_mitm
ret = stpapi.browse.view("tibom1110m000" ,"next.view" ,tmp_mitm)
endwhile
stpapi.put.field("tibom1110m000",tibom010.sitm,"z_item")
stpapi.put.field("tibom1110m000","tibom010.qana",str$(5))
stpapi.insert("tibom1110m000",1,mess)
stpapi.end.session("tibom1110m000")

but then debugging tibom1110m000, the field values of tibom010.sitm and qana are empty.
Not even the record with the main item is found and I have to use the stpapi.browse.view() function.
tibom1110m000 the form type is 3.

I,m absolutly at a loss.
Thanks in Advance
Schweizer

mark_h
19th February 2007, 17:03
Is this C4 or LN. Here is my code that works:

| Put the make item.
stpapi.clear("tibom1110m000")
stpapi.put.field( "tibom1110m000", "tibom010.mitm", makeitem )
rc = stpapi.change.view( "tibom1110m000", msg )

| Put the bom fields on the session form.
stpapi.put.field( "tibom1110m000", "tibom010.pono", str$(position) )
stpapi.put.field( "tibom1110m000", "tibom010.sitm", subitem )
stpapi.put.field( "tibom1110m000", "tibom010.cpha", str$(cpha) )
stpapi.put.field( "tibom1110m000", "tibom010.exin", exin )
stpapi.put.field( "tibom1110m000", "tibom010.qana", str$(quantity) )

stpapi.put.field( "tibom1110m000", "tibom010.seqn", str$(1) )
stpapi.put.field( "tibom1110m000", "tibom010.ltom", str$(tcyesno.no))

rc = stpapi.insert( "tibom1110m000", 1, msg )

Note I include position and in this routine the user is not to give me a position that already exists. This is only to add new items to an existing BOM or create a new BOM. I would not expect sitm or qana to be filled until you did the actual insert.

schweizer
19th February 2007, 18:04
Thank you very much Mark,
it works.
Maybe I did not fill all necessary fields?

mark_h
19th February 2007, 18:07
I can't say for sure - I do not know for a fact that the position number gets filled correctly when using API code. Glad it worked.

baancust
1st November 2007, 14:35
Dear Mark,
I used the same code given by u but after insert msg was captured with a error "Editable Sychronised dialog not started".Please help me.

Regards,
Sai Prasad