on 2023 Dec 08 4:13 PM
Hi,
I want to delete item which is never used in SAP B1.
But " retval = vItem.GetByKey("test") " returns "-1" my code is below and same as in SDK help file?
Dim vItem As SAPbobsCOM.Items<br><br> Dim retval As Long<br> Dim ErrCode As Long<br> Dim ErrMsg As String<br><br> vItem = vCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)<br><br> retval = vItem.GetByKey("test")<br><br> Console.WriteLine(retval) ' It returns "-1" here!<br><br> If retval <> 0 Then <br> vCmp.GetLastError(ErrCode, ErrMsg)<br> MsgBox("Item not found!.")<br> MsgBox(ErrCode & " " & ErrMsg)<br><br> Else<br> retval = vItem.Remove<br><br> If retval <> 0 Then<br> vCmp.GetLastError(ErrCode, ErrMsg)<br> MsgBox(ErrCode & " " & ErrMsg)<br><br> Else<br> MsgBox("Başarı ile silindi")<br><br> End If<br><br><br> End If
Regards,
Mucip:)
Request clarification before answering.
Dear dell.stinnett-christy,
OK. Thanks.
By the way I found the solution. I don't know why Retval is sometimes Boolean and sometimes Long.
When I change it long to Boolean than it started to work.
Regards,
Mucip:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 29 | |
| 14 | |
| 14 | |
| 6 | |
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.