cancel
Showing results for 
Search instead for 
Did you mean: 

Fill EditText (Date)

Former Member
0 Kudos

Hello,

i will fill a Edittext ( Date) from the database.

Now i get an Error that i have a wrong Datetype....

this is my code how the Error occured.

oItem = oForm.Items.Item("Datum" + m);

oEditText = (SAPbouiCOM.EditText)(oItem.Specific);

oEditText.Value = orec.Fields.Item(1).Value.ToString();

I tried to Convert in DateTime , but that also did not work.

In the Database its a Datefield.

THANKS

Dhomas

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi.

Also, you can use User Data Source, which works in a more efficient. E.g.:

1.- Add UDS to form:

 oForm.DataSources.UserDataSources.Add("UDSfec", SAPbouiCOM.BoDataType.dt_DATE, 10);

2.- link to item:

  oEdit = (SAPbouiCOM.EditText)oItem.Specific;
              oEdit.DataBind.SetBound(true, "", "UDSfec");

3.- and assign the value converted in String:

  oForm.DataSources.UserDataSources.Item("UDSfec").ValueEx = orec.Fields.Item(1).Value.ToString("yyyyMMdd");

In the SAP-SDK UI API Help, you can find more examples.

Former Member
0 Kudos

Hi,

Try This........


orec.DoQuery("SELECT convert(char(8),T0.[DocDate],112) FROM ORDR T0 WHERE T0.[DocNum] ='314'");
 oItem = oForm.Items.Item("Datum" + m);
oEditText = (SAPbouiCOM.EditText)(oItem.Specific);
 oedit.Value = orec.Fields.Item(0).Value;

thanks

Shafi

Former Member
0 Kudos

Hi Dhomas,

Try This......


string tmpdate = null;
string newtemp = null;
  oItem = oForm.Items.Item("Datum" + m);
oEditText = (SAPbouiCOM.EditText)(oItem.Specific);
tmpdate = orec.Fields.Item(0).Value;
newtmp = tmpdate.Substring(6, 4) + tmpdate.Substring(0, 2) + tmpdate.Substring(3, 2);
oedit.Value = newtmp;

Thanks

Shafi

Former Member
0 Kudos

hmmm i get the same Error.

Former Member
0 Kudos

Hi

If you are using the result of a query ,you convert the value in the query itself.

convert(varchar, YourDate, 112)

Regards

Vivek

Former Member
0 Kudos

Hi

When you are pushing a date value into a edit text field it should have to be in "yyyyddmm" format.

Convert your value into the format and try setting it.

Regards

Vivek

Edited by: viveksr on Sep 14, 2011 1:43 PM

Edited by: viveksr on Sep 14, 2011 1:44 PM