cancel
Showing results for 
Search instead for 
Did you mean: 

Document_Installments Object Issue

Former Member
0 Kudos

Hi all!! I have a trouble with the InstallmentID property of the Document_Installments Object . I want to update the invoice installment's duedate by DI API , but when i check the IntallmentID property's value of my Document_Installments object, returns this error:

"Property 'InstallmentID' of 'DocumentInstallment' is invalid "

This is my code:

Dim odoc As SAPbobsCOM.Documents

Dim instmntID As SAPbobsCOM.Document_Installments

odoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)

dim x ,y as integer

For x = 0 To ogrid.Rows.Count - 1

odoc.GetByKey(ogrid.DataTable.GetValue("ID Doc.", ogrid.GetDataTableRowIndex(x)))

instmntID = odoc.Installments

For y = 0 To instmntID.Count

instmntID.SetCurrentLine(y)

' ****Here returns the error*****

If odoc.Installments.InstallmentId = ogrid.DataTable.GetValue("Num Rata", ogrid.GetDataTableRowIndex(x)) Then

If odoc.Installments.DueDate <> ogrid.DataTable.GetValue("Data scad.", ogrid.GetDataTableRowIndex(x)) Then

odoc.Installments.DueDate = ogrid.DataTable.GetValue("Data scad.", ogrid.GetDataTableRowIndex(x))

If odoc.Update() = 0 Then

End If

End If

End If

Exit For

End If

Next

Next

Any suggestion? Please help me! I don't know where i can find anything useful!!!

Thanks

Best Regards

Giancarlo

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Howcome you change from using the sub object on its own, to back accessing it though the parent object again? You are setting the line on the subobject and then return to the parent object?

instmntID.SetCurrentLine(y)
' *****Here returns the error******
If odoc.Installments.InstallmentId = ogrid.DataTable.GetValue("Num Rata", ogrid.GetDataTableRowIndex(x)) Then

Should maybe be

instmntID.SetCurrentLine(y)
' *****Here returns the error******
If instmntID.InstallmentId = ogrid.DataTable.GetValue("Num Rata", ogrid.GetDataTableRowIndex(x)) Then

Former Member
0 Kudos

Thank you, i have tryed it before posting it but nothing appens... i have writed the wrong code this is my code:

Dim odoc As SAPbobsCOM.Documents

Dim instmntID As SAPbobsCOM.Document_Installments

odoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)

dim x ,y as integer

For x = 0 To ogrid.Rows.Count - 1

odoc.GetByKey(ogrid.DataTable.GetValue("ID Doc.", ogrid.GetDataTableRowIndex(x)))

instmntID = odoc.Installments

For y = 0 To instmntID.Count

instmntID.SetCurrentLine(y)

' ****Here returns the error*****

If instmntID.InstallmentId = ogrid.DataTable.GetValue("Num Rata", ogrid.GetDataTableRowIndex(x)) Then

If instmntID.DueDate ogrid.DataTable.GetValue("Data scad.", ogrid.GetDataTableRowIndex(x)) Then

instmntID.DueDate = ogrid.DataTable.GetValue("Data scad.", ogrid.GetDataTableRowIndex(x))

If odoc.Update() = 0 Then

End If

End If

End If

Exit For

End If

Next

Next

Sorry