Skip to Content
Former Member
May 14, 2004 at 02:12 PM

DI - Service Contract 'Lines' item not adding to database


I am writing an application to load service contract data into SBO from a CSV file.

I am having a problem using the DI to add lines to a service contract.

The 'Add' method on the SAPbobsCOM.ServiceContract_Lines object does not add a record to the CTR1 table in the database.

The add method on the SAPbobsCOM.ServiceContract_Lines object is unique amongst similar add methods in that is a void function. It does not return a Boolean indicating it's success or failure, as all of the other Add methods seem to do.

I though perhaps there would be an error code waiting, but calling SAPbobsCOM.Company.GetLastErrorCode returns no error code.

It seems that I am going to have to use a RecordSet object to manually perform an insert into this table in order to do my data load.

Has anybody handled this condition before?

Here is the I am using code, for reference.

With Contract.Lines

.ItemCode = EquipCard.ItemCode

.StartDate = Data.StartDate.Value

.EndDate = Data.ExpiryDate.Value

.ManufacturerSerialNum = EquipCard.ManufacturerSerialNum

.InternalSerialNum = EquipCard.InternalSerialNum

.UserFields.Fields.Item("U_UDF1").Value = Data.CUSTOM_FIELD1.Value

' More UDF's are here, but have been removed for brevity

Call .Add '<> 0 Then ' this is a Sub, not a Function like the others

' check to see if maybe an error condition is waiting

Call mCompany.GetLastError(ErrorCode, ErrorMessage)

Debug.Print ErrorCode & " - " & ErrorMessage

Call MsgBox(ErrorCode & " - " & ErrorMessage)

End With