diff --git a/src/org/openbravo/service/integration/sapecc/process/SapEccExporterSynchronizableBusinessObjectExporter.java b/src/org/openbravo/service/integration/sapecc/process/SapEccExporterSynchronizableBusinessObjectExporter.java
--- a/src/org/openbravo/service/integration/sapecc/process/SapEccExporterSynchronizableBusinessObjectExporter.java
+++ b/src/org/openbravo/service/integration/sapecc/process/SapEccExporterSynchronizableBusinessObjectExporter.java
@@ -25,14 +25,12 @@
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
-import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.weld.WeldUtils;
 import org.openbravo.client.application.attachment.AttachImplementationManager;
 import org.openbravo.dal.core.OBContext;
-import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.businessUtility.Preferences;
 import org.openbravo.erpCommon.utility.PropertyException;
@@ -43,7 +41,6 @@
 import org.openbravo.service.external.integration.SynchronizableBusinessObject;
 import org.openbravo.service.external.integration.export.SynchronizableBusinessObjectExternalExporter;
 import org.openbravo.service.external.integration.mapping.ExternalSystemType;
-import org.openbravo.service.external.integration.process.IntegrationDirection;
 import org.openbravo.service.integration.sapecc.communication.IdocSynchronizer;
 import org.openbravo.service.integration.sapecc.communication.IdocSynchronizerStore;
 import org.openbravo.service.integration.sapecc.mapping.templates.IdocDateUtils;
@@ -91,7 +88,7 @@
       String idocType = entityMapping.getMappedEntity();
       for (SynchronizableBusinessObject sbo : sbos) {
         String idocContents = iDocGenerator.generate(idocType, sbo.getProperties());
-        String fileName = getFilePath(idocType);
+        String fileName = getFilePath(entityMapping);
         attachIdocToRecord(idocContents, fileName, sbo);
         iDocsToExport.put(fileName, idocContents);
       }
@@ -114,9 +111,9 @@
 
   }
 
-  private String getFilePath(String idocType) {
-    String idocTypeSubfolder = getIdocTypeSubfolder(idocType);
-    String idocPrefix = getIdocPrefix(idocType);
+  private String getFilePath(EntityMapping entityMapping) {
+    String idocTypeSubfolder = getIdocTypeSubfolder(entityMapping);
+    String idocPrefix = getIdocPrefix(entityMapping);
     String fileName = idocPrefix + "_" + getCurrentDateAsString() + "_" + getRandomSuffix();
     Path path = Paths.get(idocTypeSubfolder, fileName);
     String pathWithoutFiletype = path.toString();
@@ -126,8 +123,7 @@
     return pathWithoutFiletype + XML_EXTENSION;
   }
 
-  private String getIdocTypeSubfolder(String idocType) {
-    EntityMapping entityMapping = getEntityMapping(idocType);
+  private String getIdocTypeSubfolder(EntityMapping entityMapping) {
     String subfolder = null;
     if (entityMapping.getSapeccSubfolder() == null) {
       subfolder = "";
@@ -137,26 +133,14 @@
     return subfolder;
   }
 
-  private String getIdocPrefix(String idocType) {
-    EntityMapping entityMapping = getEntityMapping(idocType);
+  private String getIdocPrefix(EntityMapping entityMapping) {
     if (!StringUtils.isBlank(entityMapping.getSapeccIdocprefix())) {
       return entityMapping.getSapeccIdocprefix();
     } else {
-      return idocType;
+      return entityMapping.getMappedEntity();
     }
   }
 
-  private EntityMapping getEntityMapping(String idocType) {
-    OBCriteria<EntityMapping> criteria = OBDal.getInstance().createCriteria(EntityMapping.class);
-    criteria.add(Restrictions.eq(EntityMapping.PROPERTY_SYSTEMTYPE, SapEccConstants.SYSTEM_TYPE));
-    criteria.add(Restrictions.eq(EntityMapping.PROPERTY_MAPPEDENTITY, idocType));
-    criteria.add(Restrictions.eq(EntityMapping.PROPERTY_INTEGRATIONDIRECTION,
-        IntegrationDirection.EXPORT_FROM_OB.getLabel()));
-    criteria.setFilterOnReadableClients(false);
-    criteria.setFilterOnReadableOrganization(false);
-    return (EntityMapping) criteria.uniqueResult();
-  }
-
   private String getRandomSuffix() {
     return SequenceIdData.getUUID().substring(0, 10);
   }
