VishalMistry
1st January 2011, 10:05
Hi all,

I have written following code to create BOM line through AFS but getting error "Editable syncronized dialog not starte". Can anyone help me what is missing in the code ?

stpapi.synchronize.dialog("tibom1110m000","add",error.msg)
tibomf1110m000.put.Item.tibom010.mitm(target.mitm)
tibomf1110m000.put.Position(tibom010.pono)
tibomf1110m000.put.Sequence_Number(tibom010.seqn)
tibomf1110m000.put.Item.tibom010.sitm(target.sitm)
tibomf1110m000.put.Net_Quantity(tibom010.qana)
tibomf1110m000.put.Operation(tibom010.opno)
tibomf1110m000.put.Effective_Date(tibom010.indt)
tibomf1110m000.put.Expiry_Date(tibom010.exdt)
tibomf1110m000.insert(0, error.msg)
tibomf1110m000.save(error.msg)
tibomf1110m000.end()

Thanls in advance,
Vishal

mark_h
3rd January 2011, 17:08
Check the documentation. Do you need the synchronize statement? If you do then you put the fields on the subsession and insert on the main. Below is my 4c4 code.


function extern insert_bom_item( domain tcitem makeitem,
domain tcitem subitem,
domain tcpono position,
domain tcyesno cpha,
|domain tcsern sequence,
domain tcexin exin,
domain tiqbm2 quantity,
ref string msg())
{


msg = ""
| Put the make item.
stpapi.clear("tibom1110m000")
stpapi.put.field( "tibom1110m000", "tibom010.mitm", makeitem )
rc = stpapi.change.view( "tibom1110m000", msg )
| rc(return code) is 0,1,2 - we only care when there is an error.
| if rc=0 and not isspace(msg) then
| rc = stpapi.recover("tibom1110m000", some.msg)
| stpapi.end.session("tibom1110m000")
| return
| endif
|

| 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 )
if not isspace(msg) then
| Clear out what was done, do not worry about some.msg yet
rc = stpapi.recover("tibom1110m000", some.msg)
| End the session.
stpapi.end.session("tibom1110m000")
return
endif
stpapi.end.session("tibom1110m000")
}

VishalMistry
4th January 2011, 11:59
Hi Sir,

Thanks for your reply. Will give it a try.

Vishal