cancel
Showing results for 
Search instead for 
Did you mean: 

Error occured during stock transfer

Former Member
0 Kudos

Dear All,

In my scenario am using stock transfer when am click ADD Button In the below code the bolded item shows an error but the error msg will not be displayed on the screen ,

If (pVal.FormUID = "FormEditor") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) And (pVal.ItemUID = "1") And pVal.Before_Action = True Then

Try

Dim oStockTransfer As SAPbobsCOM.StockTransfer

Dim return_value As Integer

Dim SerrorMsg As String

Dim ItemNo As String

Dim Fwh As String

Dim ItemDes As String

Dim ToWh As String

Dim Qua As String

Dim itemCost As String

For i As Integer = 1 To oMatrix.RowCount

ItemNo = oMatrix.Columns.Item("V_2").Cells.Item(i).Specific.Value()

ItemDes = oMatrix.Columns.Item("V_1").Cells.Item(i).Specific.Value()

Fwh = oMatrix.Columns.Item("V_9").Cells.Item(i).Specific.Value()

ToWh = oForm.Items.Item("27").Specific.Value

Qua = oMatrix.Columns.Item("V_7").Cells.Item(i).Specific.Value()

itemCost = oMatrix.Columns.Item("V_11").Cells.Item(i).Specific.Value()

oStockTransfer = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer)

oStockTransfer.FromWarehouse = Fwh

oStockTransfer.Lines.ItemCode = ItemNo

oStockTransfer.Lines.ItemDescription = ItemDes

oStockTransfer.Lines.WarehouseCode = ToWh

oStockTransfer.Lines.Quantity = Qua

oStockTransfer.Lines.Rate = itemCost

oStockTransfer.Lines.Add()

Next

return_value = oStockTransfer.Add

If return_value = 0 Then

ocompany.GetLastError(return_value, SerrorMsg)

oForm.StatusBar.SetText(SerrorMsg, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)

Else

oForm.StatusBar.SetText(SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success)

End If

Catch ex As Exception

oForm.StatusBar.SetText(ex.Message)

End Try

End If

Can Anyone tell me the exact error in the above Code

Regards,

Guru

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Vijay Guru,

Please try to put the code


oStockTransfer = ocompany.GetBusinessObject (SAPbobsCOM.BoObjectTypes.oStockTransfer)

oStockTransfer.FromWarehouse = Fwh

before the For...Next loop since it is should not to call repeatedly in the loop.

Best Regards

Jane Jing

SAP Business One Forums team

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear Vijay Guru,

Please try following code


Catch ex As Exception
  MessageBox.Show(ex.Message)
End Try

Best Regards

Jane Jing

SAP Business One Forums team

Former Member
0 Kudos

Dear JingJong,

Now am able to capture error,But still am not able to to transfer stock it shows an error Like

Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)

How can i Solve it

Regards,

Guru