on 12-08-2008 5:54 AM
Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
oUserFieldsMD = OCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
Try
oUserFieldsMD.TableName = "@PR_PAYCODE"
oUserFieldsMD.Name = "gratuity"
oUserFieldsMD.Description = "gratuity"
oUserFieldsMD.Type = SAPbobsCOM.BoFieldTypes.db_Alpha
' oUserFieldsMD.SubType = SAPbobsCOM.BoFldSubTypes.st_Price
oUserFieldsMD.EditSize = 1
'// Adding the Field to the Table
lRetCode = oUserFieldsMD.Add <- error point
'// Check for errors
If lRetCode <> -2035 Then
If lRetCode <> 0 Then
If lRetCode = -1 Then
' chkUDOAfter.SetItemChecked(3, True)
Else
OCompany.GetLastError(lRetCode, sErrMsg)
MsgBox(sErrMsg)
End If
Else
'chkUDOAfter.SetItemChecked(3, True)
' MsgBox("Field: '" & oUserFieldsMD.Name & "' was added successfuly to " & oUserFieldsMD.TableName & " Table")
End If
End If
error : The server threw an exception
i have faced this error from today.
Note : still error ii encounter in first field though it has created that fields.
Note : same code i have used yesterday ..it was working fine.
Any idea .. wht prob it is............
Regards,
Avijit
Hi Avijit,
Only one meta data object (UserFieldsMD, UserTablesMD etc...) can be alive at any given time.
When you are done with the object, call ReleaseComObject in .NET to make sure that the object is released synchronously.
System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserFieldsMD)
oUserFieldsMD = Nothing
HTH
Aravind
Edited by: Aravind Gadagottu on Dec 9, 2008 10:03 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Avijit,
Is it different in the environment? The modification of UserFieldsMD works only if no other objects are in memory. Otherwise, exception will throw.
Best regards,
Zhu, Lin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
97 | |
10 | |
9 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.