public void addQryCategor(string catName) { try { SAPbobsCOM.QueryCategories qCat = default(SAPbobsCOM.QueryCategories); qCat = (SAPbobsCOM.QueryCategories)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oQueryCategories); qCat.Name = catName; qCat.Add(); } catch { } }
public static void CargarBusquedasFormateadas() { try { String Query = String.Empty; String CategoryName = "Consultas Addon Recepcion DTE Proveedores"; Int32 CategoryID = 0; SAPbobsCOM.QueryCategories oCategory = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oQueryCategories); oCategory.Name = CategoryName; Int32 ret = oCategory.Add(); switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: Query = "SELECT \"CategoryId\" FROM OQCN WHERE \"CatName\" = '" + CategoryName + "'"; break; default: Query = "SELECT CategoryId FROM OQCN WHERE CatName = '" + CategoryName + "'"; break; } SAPbobsCOM.Recordset oRecordSet = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); oRecordSet.DoQuery(Query); if (!oRecordSet.EoF) { CategoryID = Convert.ToInt32(oRecordSet.Fields.Item(0).Value); } SAPbobsCOM.UserQueries oQuery = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oUserQueries); oQuery.QueryCategory = CategoryID; oQuery.QueryDescription = "Trae Dimension 1"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: oQuery.Query = "Select \"PrcCode\", \"PrcName\" from OPRC where \"DimCode\"= 1 and \"Active\" = 'Y' and \"PrcCode\" NOT IN ('Stelle_Z')"; break; default: oQuery.Query = "Select PrcCode, PrcName from OPRC where DimCode= 1 and Active = 'Y' and PrcCode NOT IN ('Stelle_Z')"; break; } oQuery.QueryType = UserQueryTypeEnum.uqtWizard; oQuery.Add(); oQuery = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oUserQueries); oQuery.QueryCategory = CategoryID; oQuery.QueryDescription = "Trae Dimension 2"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: oQuery.Query = "Select \"PrcCode\", \"PrcName\" from OPRC where \"DimCode\"= 2 and \"Active\" = 'Y' and \"PrcCode\" NOT IN ('Stelle_2')"; break; default: oQuery.Query = "Select PrcCode, PrcName from OPRC where DimCode= 2 and Active = 'Y' and PrcCode NOT IN ('Stelle_2')"; break; } oQuery.QueryType = UserQueryTypeEnum.uqtWizard; oQuery.Add(); oQuery = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oUserQueries); oQuery.QueryCategory = CategoryID; oQuery.QueryDescription = "Trae Dimension 3"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: oQuery.Query = "Select \"PrcCode\", \"PrcName\" from OPRC where \"DimCode\"= 3 and \"Active\" = 'Y' and \"PrcCode\" NOT IN ('Stelle_3')"; break; default: oQuery.Query = "Select PrcCode, PrcName FROM OPRC where DimCode = 3 and Active = 'Y' and PrcCode NOT IN ('Stelle_3')"; break; } oQuery.QueryType = UserQueryTypeEnum.uqtWizard; oQuery.Add(); oQuery = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oUserQueries); oQuery.QueryCategory = CategoryID; oQuery.QueryDescription = "Trae Dimension 4"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: oQuery.Query = "Select \"PrcCode\", \"PrcName\" from OPRC where \"DimCode\"= 4 and \"Active\" = 'Y' and \"PrcCode\" NOT IN ('Stelle_4')"; break; default: oQuery.Query = "Select PrcCode, PrcName FROM OPRC where DimCode = 4 and Active = 'Y' and PrcCode NOT IN ('Stelle_4')"; break; } oQuery.QueryType = UserQueryTypeEnum.uqtWizard; oQuery.Add(); oQuery = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oUserQueries); oQuery.QueryCategory = CategoryID; oQuery.QueryDescription = "Trae Dimension 5"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: oQuery.Query = "Select \"PrcCode\", \"PrcName\" from OPRC where \"DimCode\"= 5 and \"Active\" = 'Y' and \"PrcCode\" NOT IN ('Stelle_5')"; break; default: oQuery.Query = "Select PrcCode, PrcName FROM OPRC where DimCode = 5 and Active = 'Y' and PrcCode NOT IN ('Stelle_5')"; break; } oQuery.QueryType = UserQueryTypeEnum.uqtWizard; oQuery.Add(); oQuery = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oUserQueries); oQuery.QueryCategory = CategoryID; oQuery.QueryDescription = "Trae Cuenta Contable"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: oQuery.Query = "Select \"AcctCode\", \"AcctName\" from OACT order by \"AcctCode\""; break; default: oQuery.Query = "Select AcctCode, AcctName FROM OACT order by AcctCode"; break; } oQuery.QueryType = UserQueryTypeEnum.uqtWizard; oQuery.Add(); Int32 QueryID = 0; String QueryName = "Trae Dimension 1"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: Query = "SELECT \"IntrnalKey\" FROM OUQR WHERE \"QName\" = '" + QueryName + "' and \"QCategory\" = " + CategoryID + ""; break; default: Query = "SELECT IntrnalKey FROM OUQR WHERE QName = '" + QueryName + "' and QCategory = " + CategoryID + ""; break; } oRecordSet = null; oRecordSet = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); oRecordSet.DoQuery(Query); if (!oRecordSet.EoF) { QueryID = Convert.ToInt32(oRecordSet.Fields.Item(0).Value); } SAPbobsCOM.FormattedSearches oFtts = null; oFtts = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oFormattedSearches); oFtts.Action = BoFormattedSearchActionEnum.bofsaQuery; oFtts.FormID = "SEI_DAT"; oFtts.ItemID = "Item_0"; oFtts.ColumnID = "col_Esp"; oFtts.QueryID = QueryID; oFtts.ByField = BoYesNoEnum.tNO; oFtts.ForceRefresh = BoYesNoEnum.tNO; oFtts.Refresh = BoYesNoEnum.tNO; oFtts.Add(); QueryID = 0; QueryName = "Trae Dimension 2"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: Query = "SELECT \"IntrnalKey\" FROM OUQR WHERE \"QName\" = '" + QueryName + "' and \"QCategory\" = " + CategoryID + ""; break; default: Query = "SELECT IntrnalKey FROM OUQR WHERE QName = '" + QueryName + "' and QCategory = " + CategoryID + ""; break; } oRecordSet = null; oRecordSet = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); oRecordSet.DoQuery(Query); if (!oRecordSet.EoF) { QueryID = Convert.ToInt32(oRecordSet.Fields.Item(0).Value); } oFtts = null; oFtts = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oFormattedSearches); oFtts.Action = BoFormattedSearchActionEnum.bofsaQuery; oFtts.FormID = "SEI_DAT"; oFtts.ItemID = "Item_0"; oFtts.ColumnID = "col_Var"; oFtts.QueryID = QueryID; oFtts.ByField = BoYesNoEnum.tNO; oFtts.ForceRefresh = BoYesNoEnum.tNO; oFtts.Refresh = BoYesNoEnum.tNO; oFtts.Add(); QueryID = 0; QueryName = "Trae Dimension 3"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: Query = "SELECT \"IntrnalKey\" FROM OUQR WHERE \"QName\" = '" + QueryName + "' and \"QCategory\" = " + CategoryID + ""; break; default: Query = "SELECT IntrnalKey FROM OUQR WHERE QName = '" + QueryName + "' and QCategory = " + CategoryID + ""; break; } oRecordSet = null; oRecordSet = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); oRecordSet.DoQuery(Query); if (!oRecordSet.EoF) { QueryID = Convert.ToInt32(oRecordSet.Fields.Item(0).Value); } oFtts = null; oFtts = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oFormattedSearches); oFtts.Action = BoFormattedSearchActionEnum.bofsaQuery; oFtts.FormID = "SEI_DAT"; oFtts.ItemID = "Item_0"; oFtts.ColumnID = "col_Cat"; oFtts.QueryID = QueryID; oFtts.ByField = BoYesNoEnum.tNO; oFtts.ForceRefresh = BoYesNoEnum.tNO; oFtts.Refresh = BoYesNoEnum.tNO; oFtts.Add(); QueryID = 0; QueryName = "Trae Dimension 4"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: Query = "SELECT \"IntrnalKey\" FROM OUQR WHERE \"QName\" = '" + QueryName + "' and \"QCategory\" = " + CategoryID + ""; break; default: Query = "SELECT IntrnalKey FROM OUQR WHERE QName = '" + QueryName + "' and QCategory = " + CategoryID + ""; break; } oRecordSet = null; oRecordSet = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); oRecordSet.DoQuery(Query); if (!oRecordSet.EoF) { QueryID = Convert.ToInt32(oRecordSet.Fields.Item(0).Value); } oFtts = null; oFtts = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oFormattedSearches); oFtts.Action = BoFormattedSearchActionEnum.bofsaQuery; oFtts.FormID = "SEI_DAT"; oFtts.ItemID = "Item_0"; oFtts.ColumnID = "col_Catpa"; oFtts.QueryID = QueryID; oFtts.ByField = BoYesNoEnum.tNO; oFtts.ForceRefresh = BoYesNoEnum.tNO; oFtts.Refresh = BoYesNoEnum.tNO; oFtts.Add(); QueryID = 0; QueryName = "Trae Dimension 5"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: Query = "SELECT \"IntrnalKey\" FROM OUQR WHERE \"QName\" = '" + QueryName + "' and \"QCategory\" = " + CategoryID + ""; break; default: Query = "SELECT IntrnalKey FROM OUQR WHERE QName = '" + QueryName + "' and QCategory = " + CategoryID + ""; break; } oRecordSet = null; oRecordSet = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); oRecordSet.DoQuery(Query); if (!oRecordSet.EoF) { QueryID = Convert.ToInt32(oRecordSet.Fields.Item(0).Value); } oFtts = null; oFtts = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oFormattedSearches); oFtts.Action = BoFormattedSearchActionEnum.bofsaQuery; oFtts.FormID = "SEI_DAT"; oFtts.ItemID = "Item_0"; oFtts.ColumnID = "col_Rolp"; oFtts.QueryID = QueryID; oFtts.ByField = BoYesNoEnum.tNO; oFtts.ForceRefresh = BoYesNoEnum.tNO; oFtts.Refresh = BoYesNoEnum.tNO; oFtts.Add(); QueryID = 0; QueryName = "Trae Cuenta Contable"; switch (Conexion_SBO.m_oCompany.DbServerType) { case SAPbobsCOM.BoDataServerTypes.dst_HANADB: Query = "SELECT \"IntrnalKey\" FROM OUQR WHERE \"QName\" = '" + QueryName + "' and \"QCategory\" = " + CategoryID + ""; break; default: Query = "SELECT IntrnalKey FROM OUQR WHERE QName = '" + QueryName + "' and QCategory = " + CategoryID + ""; break; } oRecordSet = null; oRecordSet = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); oRecordSet.DoQuery(Query); if (!oRecordSet.EoF) { QueryID = Convert.ToInt32(oRecordSet.Fields.Item(0).Value); } oFtts = null; oFtts = Conexion_SBO.m_oCompany.GetBusinessObject(BoObjectTypes.oFormattedSearches); oFtts.Action = BoFormattedSearchActionEnum.bofsaQuery; oFtts.FormID = "SEI_DAT"; oFtts.ItemID = "Item_0"; oFtts.ColumnID = "col_Cta"; oFtts.QueryID = QueryID; oFtts.ByField = BoYesNoEnum.tNO; oFtts.ForceRefresh = BoYesNoEnum.tNO; oFtts.Refresh = BoYesNoEnum.tNO; oFtts.Add(); } catch (Exception ex) { String err = ex.Message; } }