Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3017

Re: Update OCRB via SDK

$
0
0

Hi Francesco,

 

For to you can update an object by DI API you need load first into the object, then change the fields that you need and then you need call Update() method. Below a sample how should you do this, explanation in comments.

 

Try  Dim bp As BusinessPartners = oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners)  'First of all, loads the business partner that you need to update  If bp.GetByKey("C08154713") Then  'walk in BpBankAccount list to find the accounts that needs update  For i As Integer = 0 To bp.BPBankAccounts.Count - 1  bp.BPBankAccounts.SetCurrentLine(i)  Dim valueFromExcel As Integer = 0  'internal key from your excel  If bp.BPBankAccounts.InternalKey = valueFromExcel Then  'Update your fields here  'bp.BPBankAccounts.BankCode = ActiveSheet.Cells(Row, 3);  'bp.BPBankAccounts.AccountNo = ActiveSheet.Cells(Row, 4);  End If  Next  'After you update the fields, now you should update the BusinessPartner Object.  If bp.Update() <> 0 Then  MessageBox.Show("Something wrong. ErrorCode: " + oCompany.GetLastErrorCode() + "Error message: " + oCompany.GetLastErrorDescription())  End If  End If
Catch ex As Exception  MessageBox.Show("Something wrong. Error: " + ex.Message)
End Try

Regards,

Diego


Viewing all articles
Browse latest Browse all 3017

Trending Articles