← Zurück zur Übersicht

xECM SQL Selects

Useful SQL Selects to query the xECM database.

Get by DataID Business Workspace Links to SAP Business Objects

Database selection to get business workspaces links (referenced SAP IDs).

SELECT ty.BUSINESS_OBJECT_TYPE, li.ID_BO, li.DataID 
FROM OTSAPXECM_WKSP_LINKS li 
INNER JOIN OTSAP_BO_TYPES ty ON ty.ID_BO_TYPE = li.ID_BO_TYPE 
WHERE li.DataID = <bws_dataid>

Select Workspaces with Metadata

Database selection to get business workspaces with metadata.

SELECT b.DataID, b.Name, md.ValStr as UserID 
FROM DTree b 
INNER JOIN DTreeAncestors a ON a.AncestorID = <parentfolder> AND a.DataID = b.DataID 
INNER JOIN LLAttrData md ON md.DefID = <categoryid> AND md.AttrID = <attrid> AND md.ID = b.DataID AND md.VerNum = b.VersionNum 
WHERE b.SubType = 848

Select Documents in a Folder

Database selection to get documents inside a specific folder of the business workspaces.

SELECT f.DataID, f.Name, d.DataID, d.Name 
FROM DTreeAncestors af 
INNER JOIN DTree f ON f.DataID = af.DataID 
INNER JOIN DTreeAncestors ad ON f.DataID = ad.AncestorID 
INNER JOIN DTree d ON d.DataID = ad.DataID 
WHERE af.AncestorID = <parentfolder> AND f.Name = '<name of folder>' AND f.SubType = 0 AND d.SubType = 144

Select Documents and Workspaces with Metadata

SELECT mt.ValStr AS CountryOfWork, m.ValStr AS UserID, b.DataID AS BWSID, d.DataID AS DocID, d.Name AS DocName, v.MimeType 
FROM DTreeAncestors a 
INNER JOIN DTree b ON b.DataID = a.DataID AND b.SubType = 848 
INNER JOIN DTree d ON d.OwnerID = b.DataID AND d.SubType = 144 
INNER JOIN DVersData v ON v.DocID = d.DataID AND v.Version = d.VersionNum 
INNER JOIN LLAttrData m ON m.DefID = <categoryid 1> AND m.AttrID = <attrid 1> AND m.ID = b.DataID AND m.VerNum = b.VersionNum 
INNER JOIN LLAttrData mt ON mt.DefID = <categoryid 2> AND mt.AttrID = <attrid 2> AND mt.ID = b.DataID AND mt.VerNum = b.VersionNum 
WHERE a.AncestorID = <parentfolder> AND mt.ValStr = 'Switzerland'

Get SAP Workspace Relations

SELECT ty.BUSINESS_OBJECT_TYPE, li.ID_BO, li.DataID 
FROM OTSAPXECM_WKSP_LINKS li 
INNER JOIN OTSAP_BO_TYPES ty ON ty.ID_BO_TYPE = li.ID_BO_TYPE 
WHERE li.DataID = <bws_dataid>

Get Classifications of a Node

SELECT D.OWNERID, D.DATAID, D.PARENTID, D.NAME, C.CID, C.STATUS 
FROM DTREE D 
INNER JOIN LLCLASSIFY C ON D.DATAID = C.ID 
WHERE C.CID = <classificationid> AND D.OWNERID > 0