cancel
Showing results for 
Search instead for 
Did you mean: 

How to Change Datatype in Existing UDF in System Table

Former Member
0 Kudos

Hi

I am creating UDF's in OIBT Table.Now i want to change the Datatype SUM to QUANTITY Without removing the Field .(Because Enduser already entered some data's)

Its possible through Coding ?

If yes means pls give some tips to do this.

Thanks

regards

senthilkumar

Accepted Solutions (1)

Accepted Solutions (1)

former_member184566
Active Contributor
0 Kudos

Hi senthilkumar B

Yes you can, here is a sample function below which does that.

'to call the function

UpdateExistingUDFField("@FRT_OQUT", "U_QTY", "", SAPbobsCOM.BoFieldTypes.db_Float, SAPbobsCOM.BoFldSubTypes.st_Quantity, 11)

'function to update fields

Private Function UpdateExistingUDFField(ByVal TableName As String, _

ByVal FieldName As String, _

ByVal Description As String, _

ByVal Type As SAPbobsCOM.BoFieldTypes, _

ByVal SubType As SAPbobsCOM.BoFldSubTypes, _

ByVal Size As Integer)

Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD

oUserFieldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)

Try

If oUserFieldsMD.GetByKey(TableName, 1) Then

'MsgBox(oUserFieldsMD.Name)

oUserFieldsMD.Type = Type

oUserFieldsMD.EditSize = Size

oUserFieldsMD.SubType = SubType

Dim lRetCode As Integer = oUserFieldsMD.Update

'// Check for errors

If lRetCode <> 0 Then

oCompany.GetLastError(lRetCode, sErrMsg)

MsgBox(sErrMsg)

End If

End If

Catch ex As Exception

MsgBox(ex.Message)

'Log.WriteLog("Exception (AddField): " & ex.Message, EventLogEntryType.Error)

Finally

System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserFieldsMD)

oUserFieldsMD = Nothing

GC.Collect()

End Try

End Function

hope this helps

Answers (0)