Are there properties somewhere that indicate whether a BO is writable? Can a UI object name be found for a given BO?

SOLVED


I have tested that having a '_bus' entry in the Data Dictionary (DD) maintenance 'Business Object' field doesn't mean the table is writable.

For example: 'AP_InvoiceHistoryHeader' has 'AP_InvoiceHistory_bus' shown in the DD as its Business Object, but after successful nSetKeyValue (using InvoiceNo & HeaderSeqNo), nSetKey and nSetValue using that BO - causes an nWrite returns a zero! (i.e. read only - see sample program below).

How do I tell (preferably programmatically) which business objects are writable and what their UI object names are for use with nSetProgram and nLookupTask respectively?

Dim oSS: Dim oScript: Dim oBus
Dim retVal : retVal = 0
Dim sCommentWas : sCommentWas = ""

Set oScript = CreateObject("ProvideX.Script")
oScript.Init ("C:\Sage\Sage 100 Standard ERP\MAS90\Home")
Set oSS = oScript.NewObject("SY_Session")
retVal = oSS.nLogon()
retVal = oSS.nSetUser("user", "password")
retVal = oSS.nSetCompany("ABC")

retVal = oSS.nSetProgram(oSS.NlookupTask("AP_InvoiceHistory_ui"))

Set oBus = oScript.NewObject("AP_InvoiceHistory_bus", oSS)

retVal = oBus.nSetKeyValue("InvoiceNo$", "1050190")   'retVal = 1
retVal = oBus.nSetKeyValue("HeaderSeqNo$", "000000")  'retVal = 1
retVal = oBus.nSetKey()                               'retVal = 1
sCommentWas = ""
retVal = oBus.nGetValue("Comment$", sCommentWas)      'retVal = 1
retVal = oBus.nSetValue("Comment$", "Testing")        'retVal = 1
retVal = oBus.nWrite()                                'retVal = 0

Parents
  • 0

    Did you check what error code is returned from the write?  To write to AP Invoice History iou must have written at least one line (this table is the header of a header lines relationship) or if sourced from purchase order a value in freight or prepayment.

Reply
  • 0

    Did you check what error code is returned from the write?  To write to AP Invoice History iou must have written at least one line (this table is the header of a header lines relationship) or if sourced from purchase order a value in freight or prepayment.

Children
No Data