BOI for Sage100 ERP - BM Production Entry - How to Get BOI Logic to Explode Bill Components

I am using BOI to automatically create production entries in BOM in Sage100 ERP. I realize Sage100 ERP support is obsolete, but it is what our company still has and we plan to update in the next year.

I have some code I threw together below for testing that creates a new Production Entry Batch and uses the next production entry number. The code also adds a line item and saves the production entry correctly.

The one thing I cannot figure out how to do is auto-explode the component assemblies. If you use the Production Entry screen in MAS90, when you enter the component item number at the header level, as soon as you go to the Lines (detail) level all sub assemblies are automatically exploded for you based on the component you entered.

At the BM_ProductionHeader table level there is a field called "ExplodeSubAssemblies", which you can see I am setting to "Y" below, but the components still aren't being exploded automatically like they do in the MAS90 Production Entry screen.

Does anyone know if there is some other BOI field value I need to set so that MAS90 will automatically will explode all sub assemblies for a component in BOM?

  • *******************************************************************************************************************

    MY CODE:

    Dim bom_production_entry_module As Object
    Dim bom_production_entry_lines As Object
    Dim batch_number As String = ""
    Dim error_message As String = ""
    Dim production_number = ""
    Dim ret_val As String
    Dim return_results As New List(Of boi_results)()

    '' Load up BM Module
    _sy_session.nSetModule(CONST_BOM_MODULE)
    _sy_session.nSetDate(CONST_BOM_MODULE, Now.Year & Right("0" & Now.Month, 2) & Right("0" & Now.Day, 2))

    _sy_session.nSetProgram(_sy_session.nLookupTask("BM_Production_ui"))
    bom_production_entry_module = _providerx_object.NewObject("BM_Production_bus", _sy_session)
    batch_number = String.Format("P{0}{1}", Right("0" & Now.Month, 2), Right("0" & Now.Day, 2))

    Dim result As New boi_results()
    bom_production_entry_module.nSelectNewBatch(batch_number, "N", "Batch Created by Q-Apps")
    bom_production_entry_module.nGetNextProductionNo(production_number)

    bom_production_entry_module.nSetKey(production_number)

    bom_production_entry_module.nSetValue("ProductionDate$", DateTime.Now)
    bom_production_entry_module.nSetValue("BillNo$", "ABC123ITEM")
    bom_production_entry_module.nSetValue("Revision$", "F")
    bom_production_entry_module.nSetValue("EffectiveDate$", DateTime.Now)
    bom_production_entry_module.nSetValue("ParentWarehouseCode$", "000")
    bom_production_entry_module.nSetValue("DefaultComponentWhseCode$", "000")
    bom_production_entry_module.nSetValue("ExplodeSubAssemblies$", "Y")
    bom_production_entry_module.nSetValue("ProductionQuantity", 0.000000)


    bom_production_entry_lines = bom_production_entry_module.oLines
    bom_production_entry_lines.nAddLine()

    bom_production_entry_lines.nSetValue("ProductionNo$", production_number)
    bom_production_entry_lines.nSetValue("ComponentItemCode$", "ABC123ITEM")
    bom_production_entry_lines.nSetValue("CommentText$", "Victory!")
    'bom_production_entry_lines.nSetValue("", "")

    '' Write Line
    ret_val = bom_production_entry_lines.nWrite()
    If ret_val <> 1 Then
    error_message += "Line Item Creation Error:" + bom_production_entry_lines.sLastErrorMsg() + Chr(10) + Chr(13)
    End If

    If String.IsNullOrEmpty(error_message) Then
    '' Write Header
    ret_val = bom_production_entry_module.nWrite()
    If ret_val <> 1 Then
    error_message += "Production Entry Creation Error:" + bom_production_entry_module.sLastErrorMsg() + Chr(10) + Chr(13)
    End If
    End If

    bom_production_entry_module.DropObject()
    bom_production_entry_module = Nothing
    boi_cleanup()

    *******************************************************************************************************************

    Thanks in advance for your help!

  • in reply to it_q-lab

    I personally haven't attempted to explode bills in production entry via BOI but you might want to try poking around the following classes and see if you can get something to work.  The detail object appears to have a property called ExplodingBill that could be set to 0 or 1 but i don't know if that is something that is meant to trigger a line to be exploded or if it is meant to serve as a flag that a bill is being exploded.

    BM_Production_bus (sage.com)

    BM_CommonEntry_ui (sage.com)

    BM_CommonEntry (sage.com)

    CI_BillExplosion (sage.com)

    BM_CommonEntryDetail (sage.com)

    BM_ProductionDetail_bus (sage.com)

  • in reply to David Speck

    David thanks for the info. I have tried quite a few things but no luck so far. In the documentation you sent, there are some methods that have "PERFORM" in front of the method, like "PERFORM ProcessTierDistribution". How exactly do you go about calling those methods? I have tried using the code I normally use when calling nay method, such as "bom_production_entry_module.nProcessTierDistribution()" but I get the following error:

    {"Public member 'nProcessTierDistribution' on type 'IPvxDispatch' not found."}

    Any ideas?

    There has to be a way to trigger MAS90's canned logic that occurs when you invoke the Lines tab to explode the bill items.

  • in reply to it_q-lab

    Honestly not sure about the PERFORM methods, they may be local methods that aren't exposed to the scripting interface. 

    As for the "canned" logic, hard to say, there are some methods in those links that deal with exploding bills but some of them appear to return providex file channels which require knowledge of the providex language to read through.  There is one that doesn't appear to accept any arguments so I don't know how it works.

  • Did you or did anyone else have luck with this? There must be a method that creates the lines.  do you have some insight here?

  • in reply to BillyVanilli

    There is a method in the Production Entry header business object called: ExplodeBill()

    After all the header fields have been set, invoking that method will create the detail records.

    If there are distributions for lot/serial items that are required that will need to be done before the new production entry can be written.

    That method is what the Sage UI object uses when exiting the header folder before displaying the lines folder.

  • in reply to Steve Passmore

    Thank you so much Steve! That works. The ExplodeBill function is not documented in the Sage help on that object. 

  • in reply to BillyVanilli

     - I believe the explode bill is a separate class try looking for doc on  BM_CommonEntry, and CI_BillExplosion