Default Bill Value to Single Level Report

Hi...

I'm trying to find a way to add a value from the bill of materials bill number field in bill of materials maintenance to autopopulate the bill number when you run the Single Level Report from the screen.  As it works now, the report will appear with no item in the bill number select field.  So, the user will be forced to enter again.  Their bill items are large and it is not a good solution.  

I tried some kind of script to call up the same report, but I don't know if it is possible on a button script to add the same bill number to the select screen.

bom= ""


retVal = oBusObj.GetValue ("BillNo$, bom")

retVal = oSession.InvokeProgram ("BM_SingleLevelReport_ui")

I am trying to get the bill number while in maintenance, but I don't know the rest of the script to add to the bill number value on the report screen.

Thanks for any help...

B

  • 0

    I kinda found an example of what I'm trying to do.  It is an A/P report example.  But, I thought if I can replicate this in A/P, then I can change to reflect B/M.  So, I copied this example, but I get errors when trying.  Any thoughts on this?

    strSelect = AP_Vendor_bus_APDivisionNo & AP_Vendor_bus_VendorNo
    oARReport = oSession.GetObject("AP_AgedInvoiceReport_ui")
    Set oARReport = oSession.AsObject(oARReport)


    sReportSetting = "STANDARD"
    retval = oARReport.SelectReportSetting(sReportSetting)
    retval = oARReport.SetKeyValue("ModuleCode$", oSession.ModuleCode)
    retval = oARReport.SetKeyValue("CompanyKey$", oSession.CompanyKey)
    retval = oARReport.SetKeyValue("ReportID$", arreport.ReportID)
    retval = oARReport.SetKeyValue("ReportSetting$",sReportSetting)
    retval = oARReport.SetKeyValue("RowKey$", "00001")
    retval = oARReport.SetKey()
    retVal = oARReport.SetValue("SelectField$", "Vendor Number")
    retVal = oARReport.SetValue("SelectFieldValue$", "Vendor Number")
    retVal = oARReport.SetValue("KeyReference$", "<APDivisionNo$+VendorNo$>") ' Fields must be enclosed in <>.
    retVal = oARReport.SetValue("Tag$", "TABLE=AP_Vendor;")
    retVal = oARReport.SetValue("Operand$", "=")
    retVal = oARReport.SetValue("Value1$", strSelect)
    retVal = oARReport.Write

    oARReport.LastErrorMsg = ""
    retVal = 0 : retVal = oARReport.ProcessReport("PREVIEW")
    If retVal <> 1 Then oSession.AsObject(oSession.UI).MessageBox "", "Unable to process report." & vbCrLf & "Last Error Msg: " & oARReport.LastErrorMsg