Define field format on own Form as date field

Heiko Merz

Hey,

 

I created an own form via Customize - New Menu, which is opening when I hit the entry in the menu.

 

I got 2 fields in there called "Date Current Year" and "Date Previous Year", which can be filled by users.

 

It works already now, but the fields are not defined as Date Fields - they are just text fields.


 


My question is: How can I define the 2 fields as Date fields, so users can handle them as SAP standard date fields ?


 


Any help would be great.



Kind regards,


Heiko



 

I used this code:

string labelText = "Date Current Year:";

Label Descr1 = Label.CreateNew("DE1");

Descr1.SetSizeAndPosition(10, 5, 100, 15);

Descr1.Value = labelText;

Descr1.FontStyle = Item.FontStyles.Bold;

Descr1.Enabled = false;


TextEdit TE = TextEdit.CreateNew("TE1");

TE.DisplayValue = DateTime.Today.ToShortDateString();

TE.Value = System.Convert.ToDateTime(TE.Value).Date.ToShortDateString();

TE.SetSizeAndPosition(140, 5, 100, 15);

TE.Enabled = true;

TE.TabOrder = 0;


string labelText2 = "Date Prev. Year:";

Label Descr2 = Label.CreateNew("DE2");

Descr2.SetSizeAndPosition(10, 25, 100, 15);

Descr2.Value = labelText2;

Descr2.FontStyle = Item.FontStyles.Bold;

Descr2.Enabled = false;


TextEdit TE2 = TextEdit.CreateNew("TE2");

TE2.DisplayValue = "31.12." + (int.Parse(DateTime.Today.Year.ToString()) - 1).ToString(); //DateTime.Today.ToShortDateString();

TE2.SetSizeAndPosition(140, 25, 100, 15);

TE2.Enabled = true;

TE2.TabOrder = 1;



Button bu1 = Button.CreateNew("B_ZUW");

bu1.Left = 7; bu1.Height = 23; bu1.Width = 78; bu1.Top = 140; bu1.Value = "RUN";

Button bu2 = Button.CreateNew("2");

bu2.Left = 92; bu2.Height = 23; bu2.Width = 78; bu2.Top = 140;


Form frm = Form.CreateNewForm("COR_CUSTOM_FSK", "COR_CUS_FSK" + SwissAddonFramework.Utils.UniqueStringGenerator.Next());

frm.Value = "Choose CY and PY";

frm.Width = 310;

frm.Height = 220;

frm.Top = 200;

frm.Left = 50;

frm.DefButton = "2";


frm.AddItem(bu1);

frm.AddItem(bu2);

frm.AddItem(TE2);

frm.AddItem(Descr2);

frm.AddItem(TE);

frm.AddItem(Descr1);

frm.Load();


Heiko Merz

Got it - thanks to all :D


0

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post