cancel
Showing results for 
Search instead for 
Did you mean: 

using FormDataEvent (BeforeAction = True) to update document

Former Member
0 Kudos

Hi,

I am trying to update the document before it gets created in the database using FormDataEvent (FORM_DATA_ADD, BeforeAction = True). it always give me an error. Do we allow to do that within FormDataEvent ?

Regards,

David

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

you can update just by UI, what are you trying to update?

Former Member
0 Kudos

I need to add extra line on the invoice or change the document discount before it gets posted in the system.

David

former_member689126
Active Contributor
0 Kudos

Hi

Please post you code

Regards

Arun

Former Member
0 Kudos

Here is my code. It doesn't work with FormDataEvent.

void SBO_Application_FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent)

{

BubbleEvent = true;

try

{

if (BusinessObjectInfo.FormTypeEx == "133" && BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD && BusinessObjectInfo.BeforeAction)

{

{

// 10% discount on the document

((SAPbouiCOM.EditText) (SAPbouiCOM.EditText)SBO_Application.Forms.Item(BusinessObjectInfo.FormUID).Items.Item("24").Specific).Value = "10";

}

}

}

catch (Exception e)

{

Debug.Print(e.ToString());

}

}

And it worked fine with ItemEvent

void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)

{

BubbleEvent = true;

try

{

if (pVal.FormTypeEx == "133" && pVal.ItemUID == "1" && pVal.BeforeAction && pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)

{

{

// 10% discount on the document

((SAPbouiCOM.EditText) (SAPbouiCOM.EditText)SBO_Application.Forms.Item(FormUID).Items.Item("24").Specific).Value = "10";

}

}

}

catch (Exception e)

{

Debug.Print(e.ToString());

}

}