hi all,
i've a problem with activity update (oContacts).
With the same code, when i update an activity, the first time "begintime" and "endtime", they're good (like i wrote) but if i update again the same activity, if the "endtime" is the same that on activity, she takes the value of the "begintime", even if i give a value in this property.
How can i avoid this in a DI context ?
This comportment is like in the UI (if i change "begintime", "endtime" takes the same value)
Below the code to reproduce this phenom :
Sub UpdateActivity(Optional ByVal iActivity As Integer = 642)
'oCompany is a SapBobsCOM object
Dim nErr As String
Dim serr As String
Try
oContact = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oContacts)
If oContact.GetByKey(iActivity) = True Then
oContact.StartTime = "09:00"
oContact.EndTime = "18:00"
If (oContact.Update() <> 0) Then
oCompany.GetLastError(nErr, serr)
MsgBox("1st update failed" + vbCrLf + nErr + " : " + serr)
End If
End If
If oContact.GetByKey(iActivity) = True Then
oContact.StartTime = "14:00"
oContact.EndTime = "18:00"
'IF YOU LOOK THE ACTIVITY ON SAP, EndTIME will be "14:00"
If (oContact.Update() <> 0) Then
oCompany.GetLastError(nErr, serr)
MsgBox("2nd update failed" + vbCrLf + nErr + " : " + serr)
End If
End If
Catch ex As Exception
End Try
End Sub
End Class