Default value calculated
SeKo
Hi all,probably an easy question. I have a UDF which I want to calculate a default value for (based on doc type/date/...) when a new document is created.
I have a rule on the FormLoad in ADD mode to fill in this value. Of course this doesn't work if you press the add button while browsing through some documents.
How can I catch that event? Only with a menuclick or is there somewhere a 'on New document' event?
thanks!
Sebastiaan
Paolo Manfrin
Hi Sebastian, what about FormDataAdd or FormDataModify for both add and update?hth
paolo
SeKo
Hi Paolo,this event is only triggered when clicking the add/modify button. I would like to set the value to a default value based on the type of document and the current date, but the user should be able to modify the value before saving it.
Anders Olsson
Hi Sebastiaan,Unfortunately there is no FormMode event (which would have been handy).
You're on the right track to check for menu clicks. We can add a handler to check menuitem 1282 which is the add menu.
You can add the following code to a rule that is activated on FormLoad. You probably have to adjust to your needs.
[CODE]
// Populate the UDF here
Global.MenuEventHandler menuHandler = new Global.MenuEventHandler(delegate(ref SAPbouiCOM.MenuEvent e, ref bool bubbleEvent)
{
if (e.MenuUID == "1282" && !e.BeforeAction)
{
// Populate the UDF here
}
});
SwissAddonFramework.Global.MenuEvent += menuHandler;
pVal.Form.AddHandler_Close(ModeComponent.FormModes.ALL, new SwissAddonFramework.UI.EventHandling.ItemEvents.FormCloseEventHandler(delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.FormClose e)
{
SwissAddonFramework.Global.MenuEvent -= menuHandler;
}));
[/CODE]
Regards,
Anders
0
Please sign in to leave a comment.
Comments
0 comments