Dear All,
I am using a UDF on 'Bill of Material' Form in SAP. This UDF is named as Current_User. I want in this UDF the user name that is currently logged in to SAP. I am able to get user name at form load event. But when 'Bill of Material' Form comes in ADD Mode, the user name doesn't display. What can I do for this problem.? Here is my code:
public override void Handle_SBO_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
{
BubbleEvent = true;
try
{
if ((mst_FormUIDModal != null))
{
if (FormUID != mst_FormUIDModal)
{
bool dbo_FormFound = false;
foreach (SAPbouiCOM.Form dsa_Form in this.SBO_Application.Forms)
{
if (dsa_Form.UniqueID == mst_FormUIDModal)
{
if (FormUID != mst_FormUIDModal)
{
if (this.SBO_Application.Forms.Item(mst_FormUIDModal).Selected == false)
{
this.SBO_Application.Forms.Item(mst_FormUIDModal).Select();
}
BubbleEvent = false;
return;
}
dbo_FormFound = true;
}
}
if (!dbo_FormFound)
{
this.mst_FormUIDModal = null;
}
}
}
if (pVal.BeforeAction == false)
{
switch (pVal.EventType)
{
case BoEventTypes.et_FORM_LOAD:
{
if (pVal.FormType == -672)
{
Program.Curr_User = SBO_Company.UserName;
doc_form = this.SBO_Application.Forms.GetForm(pVal.FormType.ToString(), pVal.FormTypeCount);
((SAPbouiCOM.EditText)doc_form.Items.Item("U_User").Specific).Value = Program.Curr_User;
}
} break;