public static void ClearUDVIfExist(string formId, string itemId, string colId) { string strQuery = "select \"IndexID\", \"ItemID\", \"ColID\" from CSHS WHERE \"FormID\" = '" + formId + "' AND \"ItemID\" = '" + itemId + "' AND \"ColID\" = '" + colId + "'"; Recordset oRecordSet = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); FormattedSearches oFormattedSearches = (FormattedSearches)oCompany.GetBusinessObject(BoObjectTypes.oFormattedSearches); try { oRecordSet.DoQuery(strQuery); if (oRecordSet.RecordCount > 0) { int formattedSearchKey = Convert.ToInt32(oRecordSet.Fields.Item(0).Value); oFormattedSearches.GetByKey(formattedSearchKey); oFormattedSearches.Remove(); } } catch (Exception ex) { MsgBoxWrapper(ex.Message + " " + ex.StackTrace); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(oFormattedSearches); System.Runtime.InteropServices.Marshal.ReleaseComObject(oRecordSet); } }
public static void ClearAllUDV() { string strQuery = "select \"IndexID\", \"ItemID\", \"ColID\" from CSHS"; Recordset oRecordSet = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); FormattedSearches oFormattedSearches = (FormattedSearches)oCompany.GetBusinessObject(BoObjectTypes.oFormattedSearches); try { oRecordSet.DoQuery(strQuery); while (!oRecordSet.EoF) { int formattedSearchKey = Convert.ToInt32(oRecordSet.Fields.Item(0).Value); oFormattedSearches.GetByKey(formattedSearchKey); oFormattedSearches.Remove(); oRecordSet.MoveNext(); } } catch (Exception ex) { MsgBoxWrapper(ex.Message + " " + ex.StackTrace); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(oFormattedSearches); System.Runtime.InteropServices.Marshal.ReleaseComObject(oRecordSet); } }
internal override string GetFormattedDescription() { return("[" + FormattedSearches .With(x => x[0]) .Return(x => x.FormID, string.Empty) + "].[" + FormattedSearches .With(x => x[0]) .Return(x => x.ItemID, string.Empty)); }
public static void CreateUDV() { string formId, itemId, colId, queryName; int queryId, controlType, lRetCode = 0; Recordset oRecordSet = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); oRecordSet = AccessMatrixEngine.GetAllConfiguration(); while (!oRecordSet.EoF) { formId = oRecordSet.Fields.Item("U_FormId").Value.ToString(); itemId = oRecordSet.Fields.Item("U_ItemId").Value.ToString(); colId = oRecordSet.Fields.Item("U_ColumnId").Value.ToString(); queryName = oRecordSet.Fields.Item("U_QueryName").Value.ToString(); controlType = Convert.ToInt32(oRecordSet.Fields.Item("U_ControlType").Value.ToString()); if (formId == "UDO_FT_UserProject") { string zz = "asd"; } if (queryName == "") { oRecordSet.MoveNext(); continue; } queryId = GetQueryId(queryName); ClearUDVIfExist(formId, itemId, (controlType == 1 ? "-1" : colId));//If control is textbox, SAP return the colUID value as "1". But UDV only works as "-1". FormattedSearches oFormattedSearches = (FormattedSearches)oCompany.GetBusinessObject(BoObjectTypes.oFormattedSearches); oFormattedSearches.FormID = formId; oFormattedSearches.ItemID = itemId; oFormattedSearches.ColumnID = (controlType == 1 ? "-1" : colId); //If control is textbox, SAP return the colUID value as "1". But UDV only works as "-1". oFormattedSearches.Action = BoFormattedSearchActionEnum.bofsaQuery; oFormattedSearches.QueryID = queryId; lRetCode = oFormattedSearches.Add(); if (lRetCode != 0) { string errMsg = AddOnUtilities.oCompany.GetLastErrorDescription(); AddOnUtilities.MsgBoxWrapper(errMsg, MsgBoxType.B1StatusBar, BoMessageTime.bmt_Short, true); } oRecordSet.MoveNext(); } }