on 12-19-2022 12:31 PM
Hello Friends,
does anyone know how to do like a RunTime updae of a Grid when Data change?
If I have a Grid that shows me all Buisness Partners and a new BP has been added then the Grid should be updated without need to press an Update Button for example!
I am using SDK.
Any Idees? specific Events maybe? anything like that?
or I should add an Update Button and keep clicking it ?
Thanks in Advance
Hi marour,
You can use the following sample code:
public void FormDataEvent (ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent)
{
BubbleEvent = true;
if (BusinessObjectInfo.BeforeAction == true && BusinessObjectInfo.Type == "2" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD)
{
MessageBox.Show("Data is not added yet. ActionSuccess is " + BusinessObjectInfo.ActionSuccess + "");
}
if (BusinessObjectInfo.BeforeAction == false && BusinessObjectInfo.Type == "2" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD)
{
string Key = BusinessObjectInfo.ObjectKey;
SAPbobsCOM.BusinessPartners oBP = (SAPbobsCOM.BusinessPartners)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners);
oBP.Browser.GetByKeys(Key);
var CardName = oBP.CardName;
MessageBox.Show("Data is added successfully. ActionSuccess is " + BusinessObjectInfo.ActionSuccess + "");
}
}<br>
BusinessObjectInfo.Type=2 means that Business Partners are being added.
Variable Key will contain the primary key of the Business Object(BusinessPartners-CardCode) value.
Once the new Business Partner is added, you can open or get your User Form and Load the data again to the grid.
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi marour,
SBO_Application.FormDataEvent += new SAPbouiCOM._IApplicationEvents_FormDataEventEventHandler(ref FormDataEvent);
It should be implemented/used the same way, you use other events like Menu Events, Item Events etc. for System/User Forms.
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
I understand this point very well but my problem is the i want to trigger an Event that is happening in a Systemform which i didnt implement in my SDK-Code at all because its already there with all functions.
so I want to use something that is happening outside of Code to do something on a Form that i created.
I still can not find how to connect them!
The FormDataEvent must be implementet in the Business Partner Form right? I mean to be able to trigger the Add-Action for example or i did miss something here?
It worked at the end.. Thank you very much
Hi marour,
You can use the following sample code:
public void FormDataEvent (ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent)
{
BubbleEvent = true;
if (BusinessObjectInfo.BeforeAction == true && BusinessObjectInfo.Type == "2" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD)
{
MessageBox.Show("Data is not added yet. ActionSuccess is " + BusinessObjectInfo.ActionSuccess + "");
}
if (BusinessObjectInfo.BeforeAction == false && BusinessObjectInfo.Type == "2" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD)
{
string Key = BusinessObjectInfo.ObjectKey;
SAPbobsCOM.BusinessPartners oBP = (SAPbobsCOM.BusinessPartners)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners);
oBP.Browser.GetByKeys(Key);
var CardName = oBP.CardName;
MessageBox.Show("Data is added successfully. ActionSuccess is " + BusinessObjectInfo.ActionSuccess + "");
}
}<br>
BusinessObjectInfo.Type=2 means that Business Partners are being added.
Variable Key will contain the primary key of the Business Object(BusinessPartners-CardCode) value.
Once the new Business Partner is added, you can open or get your User Form and Load the data again to the grid.
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi marour,
You can use the following sample code:
public void FormDataEvent (ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent)
{
BubbleEvent = true;
if (BusinessObjectInfo.BeforeAction == true && BusinessObjectInfo.Type == "2" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD)
{
MessageBox.Show("Data is not added yet. ActionSuccess is " + BusinessObjectInfo.ActionSuccess + "");
}
if (BusinessObjectInfo.BeforeAction == false && BusinessObjectInfo.Type == "2" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD)
{
string Key = BusinessObjectInfo.ObjectKey;
SAPbobsCOM.BusinessPartners oBP = (SAPbobsCOM.BusinessPartners)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners);
oBP.Browser.GetByKeys(Key);
var CardName = oBP.CardName;
MessageBox.Show("Data is added successfully. ActionSuccess is " + BusinessObjectInfo.ActionSuccess + "");
}
}
BusinessObjectInfo.Type=2 means that Business Partners are being added.
Variable Key will contain the primary key of the Business Object(BusinessPartners-CardCode) value.
Once the new Business Partner is added, you can open or get your User Form and Load the data again to the grid.
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi marour,
You can use the following logic:
1. Use the FormDataEvent to capture the Add/Update of new/existing Business Partner. Refer to SDK Help file for FormDataEvent.
2. Clear the Grid Data and upload the data again using the same SQL Query.
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi and Thank you again,
I am still struggeling about how is it possible to trigger the FormDataEvent from a system Form and use it in a Form that i created using SDK.
I still do not know how to catch the event that is coming from the systemForm into my Form to give the clear and upload data orders to my Grid.
Hello ankit.chauhan1 ,
Thank you very much for your answer.
1- I create a new Business Partner normaly so i open a new BP Form.
2- Yes! I user SQL Query
3- Grid exists on a User Form created using SDK.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
8 | |
7 | |
5 | |
4 | |
3 | |
2 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.