02-16-2017 12:34 PM - edited 02-04-2024 6:38 AM
Hi Experts,
I have a requirements on project management window to do some calculations and change some form values (Planned cost and Actual cost) using DI API on Update event handler, the values are updated successfully on database but are not refreshed in the form until I press "Refresh button".on the toolbar.
How to make form refreshed with new values once updated. or is there an event - which I can handle in code - that happens after Update event completed?
if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD || pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE)
{
//Code that will change planned and cost values
}
// if there is another event that happens after the update is completed, so I can activate the refresh in the toolbar
if (pVal.EventType == <Some event>)
{
Application.SBO_Application.ActivateMenuItem("1304");
}
I have been trying use oform.Update() & oForm.Refresh() and other workarounds with no luck
Thanks for your help.
Hi Shuqair,
You can use the item_pressed event on ItemEvent with beforeAction property equals false, but you need set some global variable that indicates that your update works correctly. Something like this:
private bool _updated = false;
private void Application_FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent)
{
BubbleEvent = true;
if (BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE
&& BusinessObjectInfo.ActionSuccess && !BusinessObjectInfo.BeforeAction)
{
//Do your update
_updated = true;
}
}
private void Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
{
BubbleEvent = true;
if(!pVal.BeforeAction && pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED && _updated
&& pVal.ItemUID.Equals("the id of your add/update button"))
{
Application.SBO_Application.ActivateMenuItem("1304");
_updated = false;
}
}
Hope it helps.
Kind Regards,
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shuqair,
The global variable share your value on the scope of your application. But is not possible that the users use the same instance of one add-on concurrently. When an user log on SAP B1 and starts your add-on a new scope of the add-on will be created for this user, even this user log in a SAP B1 client in a server where there is a lot of other users logged.
Use global variables can be a problem in Web Applications, not in this situation.
Hope it clears.
Kind Regards,
Diego Lother
You tried doing it in the classic style:
if (pVal.EventType == <Some event>)
{
Application.SBO_Application.ActivateMenuItem("1289"); //Previous data record
Application.SBO_Application.ActivateMenuItem("1288"); //Following data record
}
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
9 | |
5 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.