public static SAPbouiCOM.DataTable GetDataTableFromCLF(SAPbouiCOM.ItemEvent oEvent, SAPbouiCOM.Form oForm) { SAPbouiCOM.ChooseFromListEvent event2 = (SAPbouiCOM.ChooseFromListEvent)oEvent; string chooseFromListUID = event2.ChooseFromListUID; SAPbouiCOM.ChooseFromList list = oForm.ChooseFromLists.Item(chooseFromListUID); return(event2.SelectedObjects); }
/// <summary> /// Choose From List Handler Method /// </summary> /// <param name="oForm"></param> /// <param name="pVal"></param> /// <param name="BubbleEvent"></param> /// <param name="pValiItemEvent"></param> void ChooseFromListHandler(SAPbouiCOM.Form oForm, SAPbouiCOM.ChooseFromListEvent pVal, out bool BubbleEvent, SAPbouiCOM.ItemEvent pValiItemEvent) { BubbleEvent = true; try { //Code if (pVal.ItemUID == "3") { if (pVal.BeforeAction.Equals(false)) { CodeCFLAfter(oForm, pVal, out BubbleEvent); } } } catch (Exception ex) { Events.App_StatusBarEvent( ex.Message , SAPbouiCOM.BoMessageTime.bmt_Short , SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } }
/// <summary> /// After Event for Prepared By CFL /// </summary> /// <param name="oForm"></param> /// <param name="pVal"></param> /// <param name="BubbleEvent"></param> void CodeCFLAfter(SAPbouiCOM.Form oForm, SAPbouiCOM.ChooseFromListEvent pVal, out bool BubbleEvent) { BubbleEvent = true; try { var userCode = pVal.SelectedObjects.GetValue("USER_CODE", 0); string userName = pVal.SelectedObjects.GetValue("U_NAME", 0); string name = GetUserName(userCode); string finalName = name; if (name == userName) { finalName = userName; } int rowVal = 0; if (pVal.Row <= 1) { rowVal = 1; } else { rowVal = pVal.Row; } DataSourceWrapper.SetMatrixValue(oForm, pVal.ItemUID, userCode, "U_Code", rowVal); DataSourceWrapper.SetMatrixValue(oForm, pVal.ItemUID, finalName, "U_Name", rowVal); oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } catch (Exception ex) { Events.App_StatusBarEvent( ex.Message , SAPbouiCOM.BoMessageTime.bmt_Short , SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } }