Quantcast
Channel: Baanboard.com
Viewing all articles
Browse latest Browse all 4216

AFS for BOM (tibom1110m000)

$
0
0
HI,

I have a problem when using AFS to insert data into tibom1110m000. Until script bom_ret4, it cannot be save it. Prompt message bom_ret4 = 1. Please advise.

Code:

function exec.bom()
{
        long        bom_ret1, bom_ret2, bom_ret3, bom_ret4
        string        find.msg(100), error.msg(100), syn.msg(100), recover.msg(100), sav.msg(100)

        stpapi.put.field("tibom1110m000", "tibom010.mitm", str$(item_with_project_name))

        bom_ret1 = stpapi.find("tibom1110m000", find.msg)

                if bom_ret1 = 1 then
                        message("BOM Item Code already Exist!")
                        message("Item created Failed!")
                else
                        bom_ret2 = stpapi.synchronize.dialog("tibom1110m000", "add", syn.msg)

                        if bom_ret2 then

                                stpapi.put.field("tibom1110m000", "tibom010.mitm", str$(item_with_project_name))
                                stpapi.put.field("tibom1110m000", "tibom010.pono", str$(10))
                                stpapi.put.field("tibom1110m000", "tibom010.seqn", str$(1))
                                stpapi.put.field("tibom1110m000", "tibom010.sitm", str$(full.bom.item))
                                stpapi.put.field("tibom1110m000", "tibom010.qana", str$(bom.qty))
                                stpapi.put.field("tibom1110m000", "tibom010.cwar", "FINFB")
                                stpapi.put.field("tibom1110m000", "tcibd001.cuni", "pcs")
                                stpapi.put.field("tibom1110m000", "tibom010.opno", str$(10))

                                bom_ret3 = stpapi.insert("tibom1110m000", 0, error.msg)
message("bom_ret3: %s",bom_ret3)
                                bom_ret4 = stpapi.save("tibom1110m000", sav.msg)
message("bom_ret4: %s",bom_ret4)
                                if not bom_ret3 or not bom_ret4 then
                                        stpapi.recover("tibom1110m000", recover.msg)
                                        message("BOM Item created Failed!")
                                else
                                        create.stat = "Succeed"
                                endif               
                                        stpapi.end.session("tibom1110m000")
                        endif
                endif

                stpapi.end.session("tibom1110m000")
}


Viewing all articles
Browse latest Browse all 4216

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>