diff --git a/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filterextention/filterConditionProcess.js b/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filterextention/filterConditionProcess.js
index f410cb6d05146ae82e7bbf5016ddcb5d32cae509..89417141617570df1b3f8086d49d8a17beabc0ee 100644
--- a/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filterextention/filterConditionProcess.js
+++ b/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filterextention/filterConditionProcess.js
@@ -1,5 +1,4 @@
+import("Salesproject_lib");
 import("system.result");
-import("Sql_lib");
-import("system.vars");
 
-result.string(newWhereIfSet( "SALESPROJECT.PHASE", vars.get("$local.rawvalue")));
\ No newline at end of file
+result.string(SalesprojectPhaseFilterUtils.makeFilterCondition());
\ No newline at end of file
diff --git a/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filterextention/groupQueryProcess.js b/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filterextention/groupQueryProcess.js
index eb4293c44f98b55df38ff494a122f8cef7077ab5..feb925020ad0b58a6ca2fb7d379302cc00545cea 100644
--- a/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filterextention/groupQueryProcess.js
+++ b/entity/Salesproject_entity/recordcontainers/db/filterextensions/phase_filterextention/groupQueryProcess.js
@@ -1,31 +1,4 @@
-import("system.logging");
-import("Sql_lib");
+import("Salesproject_lib");
 import("system.result");
-import("system.vars");
-import("KeywordRegistry_basic");
-import("Keyword_lib");
-        
-var order = vars.get("$local.order");
-var sqlHelper = new SqlMaskingUtils();
-var groupedList = "SALESPROJECT.PHASE"
-var condition = vars.get("$local.condition");
-var stmt = new SqlBuilder().from("SALESPROJECT").join("AB_KEYWORD_ENTRY", newWhere("AB_KEYWORD_ENTRY.KEYID = SALESPROJECT.PHASE").and("AB_KEYWORD_ENTRY.AB_KEYWORD_CATEGORY_ID", KeywordUtils.getCategoryIdByName($KeywordRegistry.salesprojectPhase()))).groupBy(groupedList + ", AB_KEYWORD_ENTRY.SORTING, AB_KEYWORD_ENTRY.KEYID");
 
-if (condition != "  ")
-    stmt.where(condition);
-
-if (vars.get("$local.count")) // TRUE if the count of the records is needed
-{
-    stmt.select(["1 COUNT", groupedList]) //from ACTIVITY where " + condition + " group by "+groupedList+") X";
-    stmt = newSelect("STMT.COUNT")
-    .from(stmt, "STMT")
-    
-} 
-else 
-{
-    stmt.select([groupedList , KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(),"AB_KEYWORD_ENTRY.KEYID"), "count(*)", "count(*)"])
-    if (order != null)
-        stmt.orderBy("AB_KEYWORD_ENTRY.SORTING, " + order);
-}
-
-result.string(stmt.toString());
\ No newline at end of file
+result.string(SalesprojectPhaseFilterUtils.makeGroupQueryProcess());
\ No newline at end of file
diff --git a/process/Salesproject_lib/process.js b/process/Salesproject_lib/process.js
index 057749c13b05b09b9490f97b010d0bdb36178cb3..d515adbca8ed32999dd71a4fdd210dd437a8f154 100644
--- a/process/Salesproject_lib/process.js
+++ b/process/Salesproject_lib/process.js
@@ -410,3 +410,58 @@ SalesprojectConversionRate.prototype._getTitleOfKey = function (pKey, pIsGroupin
         
     return pKey;
 }
+
+/**
+ * Methods used by the Salesproject.
+ * Do not create an instance of this!
+ * 
+ * @class
+ */
+function SalesprojectPhaseFilterUtils() {}
+
+/**
+ * Builds a Sql-condition for a salesproject filter extension. This allows to filter via the salesproject phase whilst havin them in the correct Order
+ * 
+ * @return {String} condition
+ */
+SalesprojectPhaseFilterUtils.makeFilterCondition = function()
+{
+    return newWhereIfSet( "SALESPROJECT.PHASE", vars.get("$local.rawvalue"));
+}
+
+/**
+ * Builds a Sql-condition for a salesproject filter extension. This allows to filter via the salesproject phase whilst havin them in the correct Order
+ * 
+ * @return {String} condition
+ */
+SalesprojectPhaseFilterUtils.makeGroupQueryProcess = function()
+{
+    var order = vars.get("$local.order");
+    var sqlHelper = new SqlMaskingUtils();
+    var groupedList = "SALESPROJECT.PHASE"
+    var condition = vars.get("$local.condition");
+    var stmt = new SqlBuilder().from("SALESPROJECT").join("AB_KEYWORD_ENTRY", newWhere("AB_KEYWORD_ENTRY.KEYID = SALESPROJECT.PHASE").and("AB_KEYWORD_ENTRY.AB_KEYWORD_CATEGORY_ID", KeywordUtils.getCategoryIdByName($KeywordRegistry.salesprojectPhase()))).groupBy(groupedList + ", AB_KEYWORD_ENTRY.SORTING, AB_KEYWORD_ENTRY.KEYID");
+
+    if (!Utils.isNullOrEmptyString(condition.trim()))
+    {
+        stmt.where(condition);
+    }
+
+    if (vars.get("$local.count")) // TRUE if the count of the records is needed
+    {
+        stmt.select(["1 COUNT", groupedList]) //from ACTIVITY where " + condition + " group by "+groupedList+") X";
+        stmt = newSelect("STMT.COUNT")
+        .from(stmt, "STMT")
+
+    } 
+    else 
+    {
+        stmt.select([groupedList , KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(),"AB_KEYWORD_ENTRY.KEYID"), "count(*)", "count(*)"])
+        if (order != null)
+        {
+            stmt.orderBy("AB_KEYWORD_ENTRY.SORTING, " + order);
+        }
+    }
+
+        return stmt.toString();
+}