Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Adding New Date field to System form and column to Table

Hi,

Iam trying to create a new edit box field on the quotes system form for the purposes of recording an Original Predicted closing date to accompany the predicted closing date field.

I have created the column in the Table OQUT as "U_OPCDate" DATETIME

Then the relevant parts of my code reads as follows:

Dim oItem As SAPbouiCOM.Item

Dim oForm As SAPbouiCOM.Form

Dim oCombo As SAPbouiCOM.ComboBox

Dim oEdit As SAPbouiCOM.EditText

Dim oLabel As SAPbouiCOM.StaticText

Dim oTempItem As SAPbouiCOM.Item

Dim iUnitMove As Integer

Dim iCentralLocation As Integer

Dim oUDS As SAPbouiCOM.UserDataSource

Dim oDS As SAPbouiCOM.DBDataSource

Dim oDate As SAPbobsCOM.Recordset

oForm = oApp.Forms.Item(FormUID)

oUDS = oForm.DataSources.UserDataSources.Add("U_OPCDate", SAPbouiCOM.BoDataType.dt_DATE) 'Original Predicted Closing Date

oDS = oForm.DataSources.DBDataSources.Add("OQUT")

oTempItem = oForm.Items.Item("12")

oItem = oForm.Items.Add("oEdit1", SAPbouiCOM.BoFormItemTypes.it_EDIT)

With oItem

.Height = oTempItem.Height

.Width = oTempItem.Width

.Left = oTempItem.Left

.Top = oForm.Items.Item("4").Top

.LinkTo = "oLbl1"

End With

oEdit = oItem.Specific

oEdit.DataBind.SetBound(True, "OQUT", "U_OPCDate")

I've gotten into a really confused state looking at two previous example and need help tidying up.

If I use oEdit.DataBind.SetBound(True, "OQUT", "U_OPCDate") I get an Alias error even though the tble name and column name are correct

I also get errors about invalid date type, but the only date type for SQL base is DATETIME

If I Omitt oUDS = oForm.DataSources.UserDataSources.Add("U_OPCDate", SAPbouiCOM.BoDataType.dt_DATE) I get invalid data type message.

Any solid examples anyone?

Do you have to add the column name to the table before the new data source can be used for the first time?

Dave A.

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question