[VBNET] Script using SAPbobsCOM doesn't do anything
Michiel Mijdam
I would like to do an update on the Item Master Data when opening a layout. In my layout I have an advanced databand that runs through the items that should be updated. On the detail of this databand I've put the following script in the Generate Script
Dim oITM As SAPbobsCOM.Items
Dim iLeadTime As Integer
oITM = SwissAddonFramework.B1Connector.GetB1Connector().Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
oITM.GetByKey(Items("ItemCode"))
iLeadTime = Items("AvgLeadtime")
oITM.LeadTime = iLeadTime
oITM.Update
I don't get any errors, but it doesn't update anything either.
Philipp Knecht
Hi MicheelExtend your script like follows to see exceptions or B1 Errors:
Dim oITM As SAPbobsCOM.Items
Dim iLeadTime As Integer
Try
oITM = SwissAddonFramework.B1Connector.GetB1Connector().Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
oITM.GetByKey(Items("ItemCode"))
iLeadTime = Items("AvgLeadtime")
oITM.LeadTime = iLeadTime
Dim i As integer = oITM.Update
If i <> 0 Then
SwissAddonFramework.UI.Dialogs.MessageBox.Show(SwissAddonFramework.B1Connector.GetB1Connector().Company.GetLastErrorDescription(),"Ok")
End If
Catch ex As Exception
SwissAddonFramework.UI.Dialogs.MessageBox.Show(ex.Message,"Ok")
End Try
hth
Michiel Mijdam
I get an error telling me:Invalid valid value 'B' in Enum 'BoYesNoEnum', the valid values are 'N','Y'
I have no clue where this comes from.
Philipp Knecht
Hi MichielThis is a Message from the B1 DI.
This normally happens when you are violencing some business logic.
Please consult the sdn.sap.com sdk forums.
hth
0
Please sign in to leave a comment.
Comments
0 comments